Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANCOPT optimizer not consistent for gcc @ macOS-14.6.1 #1099

Closed
marcelmbn opened this issue Sep 13, 2024 · 1 comment · Fixed by #1102
Closed

ANCOPT optimizer not consistent for gcc @ macOS-14.6.1 #1099

marcelmbn opened this issue Sep 13, 2024 · 1 comment · Fixed by #1102
Assignees
Labels
bug Something isn't working driver: optimization Related to the geometry optimization driver platform: MacOS Related to using this project on MacOS

Comments

@marcelmbn
Copy link
Member

marcelmbn commented Sep 13, 2024

Describe the bug
Geometry optimizer leads to different results for ifort @ ubuntu-20.04 and gcc @ macOS-14.6.1.

To Reproduce
Steps to reproduce the behaviour:

xtb_dev C13H14.xyz --opt --gfn 2 --cycles 1

Relevant lines of code

      write(*,*) "Uaug before davidson"
      do i = 1, nvar1
         write(*,*) Uaug(i,1)
      end do
      call solver_sdavidson(nvar1,r4dum,Aaug,Uaug,eaug,fail,.false.)
      write(*,*) "Uaug after davidson"
      do i = 1, nvar1
         write(*,*) Uaug(i,1)
      end do

solver_sdavidson leads to different results for both architectures for Uaug, even though all input variables are equal for both architectures. Possible reasons might be blas_dot or sdot functions that lead to different results for different architectures and compilers. (In some examples, norm2 and sqrt(sdot(x, var1, 1, var1, 1)) led to different results.

Output showing the error

Please provide all input and output file such that we confirm your report.

........................................................................
.............................. CYCLE    1 ..............................
........................................................................

 iter      E             dE          RMSdq      gap      omega  full diag
   1    -35.5785110 -0.355785E+02  0.129E-04    4.46       0.0  T
   2    -35.5785110 -0.205844E-10  0.784E-05    4.46     245.5  T
   3    -35.5785110  0.249401E-10  0.458E-05    4.46     419.8  T
     SCC iter.                  ...        0 min,  0.003 sec
     gradient                   ...        0 min,  0.002 sec
 * total energy  :   -34.9341040 Eh     change       -0.7595276E-09 Eh
   gradient norm :     0.0325983 Eh/α   predicted     0.0000000E+00 (-100.00%)
 Uaug before davidson
  -6.26123365E-05
  -9.22085601E-05
  -6.20031715E-05
  -4.61859192E-04
....
  0.999469101    
 Uaug after davidson
  -6.26123365E-05
  -9.22085601E-05
  -6.20031715E-05
  -4.61859192E-04
  ...
  0.999469101    
   displ. norm   :     0.0325983 α      lambda        0.0000000E+00
   maximum displ.:     0.0170929 α      in ANC's #43, #45, #63, ...

   *** FAILED TO CONVERGE GEOMETRY OPTIMIZATION IN 1 ITERATIONS ***

Expected behaviour
Numerically equal results for all systems, on which xtb is compilable.

........................................................................
.............................. CYCLE    1 ..............................
........................................................................

 iter      E             dE          RMSdq      gap      omega  full diag
   1    -35.5785110 -0.355785E+02  0.271E-05    4.46       0.0  T
   2    -35.5785110 -0.175504E-11  0.151E-05    4.46    1277.3  T
   3    -35.5785110 -0.177636E-12  0.996E-06    4.46    1931.4  T
     SCC iter.                  ...        0 min,  0.004 sec
     gradient                   ...        0 min,  0.003 sec
 * total energy  :   -34.9341040 Eh     change       -0.3772840E-09 Eh
   gradient norm :     0.0325980 Eh/α   predicted     0.0000000E+00 (-100.00%)

 Uaug before davidson
 -6.2612402E-05
 -9.2208698E-05
 -6.2002968E-05
 -4.6185814E-04
 ...
  0.9994691    
 Uaug after davidson
 -4.5103282E-03
 -6.6389972E-03
 -4.4081416E-03
 -3.2373566E-02
...
  0.9863185    
   displ. norm   :     0.1671367 α      lambda       -0.3699289E-02
   maximum displ.:     0.0759934 α      in ANC's #43, #15, #45, ...

   *** FAILED TO CONVERGE GEOMETRY OPTIMIZATION IN 1 ITERATIONS ***

Additional context
C13H14.xyz.txt
xtb.log

@marcelmbn marcelmbn added bug Something isn't working driver: optimization Related to the geometry optimization driver platform: MacOS Related to using this project on MacOS labels Sep 13, 2024
@marcelmbn marcelmbn self-assigned this Sep 13, 2024
@marcelmbn marcelmbn linked a pull request Sep 17, 2024 that will close this issue
@marcelmbn
Copy link
Member Author

Reason for the divergence (at least as far I see) was linking the "wrong" BLAS library (Apple Accelerate BLAS instead of openblas). Using openblas solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver: optimization Related to the geometry optimization driver platform: MacOS Related to using this project on MacOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant