Skip to content

Benchmark results #16

@certik

Description

@certik

As of e7747e6 on Apple M1 Max and GFortran 11.3.0:

$ fpm test --profile=release --flag "-ffast-math -march=native" test_dft_schroed_fast --verbose
[...]
+ build/gfortran_565E65E7876A06C6/test/test_dft_schroed_fast
[...]
$ fpm test --profile=release --flag "-ffast-math -march=native" test_dft_dirac_fast --verbose
[...]
+ build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast 
[...]

And then benchmark using:

$ time build/gfortran_565E65E7876A06C6/test/test_dft_schroed_fast
 SCF convergence error:  0.28258872238814092     
 SCF convergence error:   8.2495113254026364E-003
 SCF convergence error:   5.2116623764959513E-003
 SCF convergence error:   2.1089267579554871E-003
 SCF convergence error:   1.6365563510589709E-005
 SCF convergence error:   8.5098749877943192E-006
 SCF convergence error:   4.4540042836160865E-006
 SCF convergence error:   1.6731351859533561E-008
 SCF convergence error:   7.0714598621179903E-009
 SCF convergence error:   4.5291272954273154E-009
 Comparison of calculated and reference energies

 Total energy:
               E           E_ref     error
 -25658.41788786 -25658.41788885  9.92E-07

 Eigenvalues:
   n               E           E_ref     error
   1  -3689.35513954  -3689.35513984  2.99E-07
   2   -639.77872802   -639.77872809  7.10E-08
   3   -619.10855022   -619.10855018  3.79E-08
   4   -161.11807323   -161.11807321  1.58E-08
   5   -150.97898021   -150.97898016  4.68E-08
   6   -131.97735833   -131.97735828  4.30E-08
   7    -40.52808426    -40.52808425  1.17E-08
   8    -35.85332086    -35.85332083  2.56E-08
   9    -27.12321233    -27.12321230  3.27E-08
  10    -15.02746011    -15.02746007  4.23E-08
  11     -8.82408941     -8.82408940  1.32E-08
  12     -7.01809223     -7.01809220  2.35E-08
  13     -3.86617516     -3.86617513  3.00E-08
  14     -0.36654337     -0.36654335  1.55E-08
  15     -1.32597631     -1.32597632  1.11E-08
  16     -0.82253797     -0.82253797  2.62E-09
  17     -0.14319019     -0.14319018  4.86E-09
  18     -0.13094786     -0.13094786  5.40E-10
build/gfortran_565E65E7876A06C6/test/test_dft_schroed_fast  0.03s user 0.00s system 89% cpu 0.037 total
$ time build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast
 SCF iteration:           1
 SCF iteration:           2
 SCF iteration:           3
 SCF iteration:           4
 SCF iteration:           5
 SCF iteration:           6
 SCF iteration:           7
 SCF convergence error:   2.4220429767083260     
 SCF iteration:           8
 SCF convergence error:   5.9353570468374528E-003
 SCF iteration:           9
 SCF convergence error:   1.8809300891007297E-003
 SCF iteration:          10
 SCF convergence error:   1.0439264224260114E-004
 SCF iteration:          11
 SCF convergence error:   3.1819967261981219E-005
 SCF iteration:          12
 SCF convergence error:   1.1597509001148865E-005
 SCF iteration:          13
 SCF convergence error:   1.4384913811227307E-006
 SCF iteration:          14
 SCF convergence error:   1.2588679965119809E-006
 SCF iteration:          15
 SCF convergence error:   1.3697535905521363E-007
 SCF iteration:          16
 SCF convergence error:   1.8208083929494023E-008
 Comparison of calculated and reference energies

 Total energy:
               E           E_ref     error
 -28001.13232560 -28001.13232549  1.17E-07

 Eigenvalues:
   n               E           E_ref     error
   1  -4223.41902054  -4223.41902046  8.12E-08
   2   -789.48978235   -789.48978233  2.00E-08
   3   -761.37447600   -761.37447597  2.56E-08
   4   -622.84809459   -622.84809456  2.05E-08
   5   -199.42980565   -199.42980564  5.06E-09
   6   -186.66371313   -186.66371312  7.93E-09
   7   -154.70102668   -154.70102667  4.47E-09
   8   -134.54118030   -134.54118029  8.25E-09
   9   -128.01665739   -128.01665738  7.53E-09
  10    -50.78894806    -50.78894806  4.06E-09
  11    -45.03717128    -45.03717129  3.42E-09
  12    -36.68861048    -36.68861049  4.16E-09
  13    -27.52930624    -27.52930624  3.80E-09
  14    -25.98542890    -25.98542891  3.84E-09
  15    -13.88951423    -13.88951423  4.44E-09
  16    -13.48546969    -13.48546969  4.49E-09
  17    -11.29558710    -11.29558710  1.76E-09
  18     -9.05796425     -9.05796425  1.16E-09
  19     -7.06929563     -7.06929563  4.20E-12
  20     -3.79741623     -3.79741623  1.40E-09
  21     -3.50121719     -3.50121718  1.86E-09
  22     -0.14678839     -0.14678838  5.78E-09
  23     -0.11604717     -0.11604717  5.88E-09
  24     -1.74803996     -1.74803995  7.41E-09
  25     -1.10111901     -1.10111900  7.85E-09
  26     -0.77578419     -0.77578418  7.87E-09
  27     -0.10304082     -0.10304082  5.31E-09
  28     -0.08480203     -0.08480202  4.84E-09
  29     -0.16094729     -0.16094728  3.27E-09
build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast  0.78s user 0.04s system 100% cpu 0.806 total

Now apply the following patch:

$ git diff
diff --git a/src/dirac.f90 b/src/dirac.f90
index 0fc99c0..957aeb7 100644
--- a/src/dirac.f90
+++ b/src/dirac.f90
@@ -234,7 +234,7 @@ contains
     real(dp) :: E_dirac_shift
     integer :: idx
     logical :: accurate_eigensolver
-    accurate_eigensolver = .true.
+    accurate_eigensolver = .false.
     iter = iter + 1
     print *, "SCF iteration:", iter
     Vin = reshape(x, shape(Vin))

And

$ time build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast
 SCF iteration:           1
 SCF iteration:           2
 SCF iteration:           3
 SCF iteration:           4
 SCF iteration:           5
 SCF iteration:           6
 SCF iteration:           7
 SCF convergence error:   2.4220430676850810     
 SCF iteration:           8
 SCF convergence error:   5.9354385557526257E-003
 SCF iteration:           9
 SCF convergence error:   1.8807012675097212E-003
 SCF iteration:          10
 SCF convergence error:   1.0478643525857478E-004
 SCF iteration:          11
 SCF convergence error:   3.1437355573871173E-005
 SCF iteration:          12
 SCF convergence error:   1.1697793524945155E-005
 SCF iteration:          13
 SCF convergence error:   1.4564047887688503E-006
 SCF iteration:          14
 SCF convergence error:   1.1532956705195829E-006
 SCF iteration:          15
 SCF convergence error:   4.6789864427410066E-007
 SCF iteration:          16
 SCF convergence error:   4.9017762648873031E-007
 Comparison of calculated and reference energies

 Total energy:
               E           E_ref     error
 -28001.13232497 -28001.13232549  5.13E-07

 Eigenvalues:
   n               E           E_ref     error
   1  -4223.41902063  -4223.41902046  1.75E-07
   2   -789.48978203   -789.48978233  2.98E-07
   3   -761.37447602   -761.37447597  4.29E-08
   4   -622.84809451   -622.84809456  5.05E-08
   5   -199.42980565   -199.42980564  6.11E-09
   6   -186.66371313   -186.66371312  3.46E-09
   7   -154.70102667   -154.70102667  2.87E-09
   8   -134.54118030   -134.54118029  5.74E-09
   9   -128.01665739   -128.01665738  5.19E-09
  10    -50.78894806    -50.78894806  2.26E-10
  11    -45.03717128    -45.03717129  5.89E-09
  12    -36.68861048    -36.68861049  4.33E-09
  13    -27.52930624    -27.52930624  4.18E-09
  14    -25.98542890    -25.98542891  4.04E-09
  15    -13.88951423    -13.88951423  4.37E-09
  16    -13.48546969    -13.48546969  3.98E-09
  17    -11.29558710    -11.29558710  1.05E-09
  18     -9.05796425     -9.05796425  3.44E-09
  19     -7.06929563     -7.06929563  1.40E-09
  20     -3.79741623     -3.79741623  3.13E-10
  21     -3.50121719     -3.50121718  1.96E-09
  22     -0.14678839     -0.14678838  4.34E-09
  23     -0.11604717     -0.11604717  5.56E-09
  24     -1.74803996     -1.74803995  6.32E-09
  25     -1.10111901     -1.10111900  6.28E-09
  26     -0.77578419     -0.77578418  6.33E-09
  27     -0.10304082     -0.10304082  4.15E-09
  28     -0.08480203     -0.08480202  3.90E-09
  29     -0.16094728     -0.16094728  2.24E-09
build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast  0.54s user 0.03s system 100% cpu 0.565 total

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions