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

Fastest DFT Dirac #21

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Fastest DFT Dirac #21

wants to merge 8 commits into from

Conversation

certik
Copy link
Contributor

@certik certik commented Oct 25, 2023

TODO:

  • Refactor these changes so that regular use is unaffected
    • Put the new eigensolver into a new subroutine
    • Expose accurate_eigensolver = .false. to the top driver
    • Either keep symmetry check commented out, or expose via a parameter

Run with:

$ fpm test --profile=release --flag "-ffast-math -march=native -framework Accelerate " test_dft_dirac_fast --verbose
$ time build/gfortran_BDCD69B59C14BD7C/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.4220418857676123     
 SCF iteration:           8
 SCF convergence error:   5.9357534701121040E-003
 SCF iteration:           9
 SCF convergence error:   1.8806871048582252E-003
 SCF iteration:          10
 SCF convergence error:   1.0455984192958567E-004
 SCF iteration:          11
 SCF convergence error:   3.2101015676744282E-005
 SCF iteration:          12
 SCF convergence error:   1.1781998182414100E-005
 SCF iteration:          13
 SCF convergence error:   1.2883829185739160E-006
 SCF iteration:          14
 SCF convergence error:   8.7908847490325570E-007
 Comparison of calculated and reference energies

 Total energy:
               E           E_ref     error
 -28001.13232613 -28001.13232549  6.45E-07

 Eigenvalues:
   n               E           E_ref     error
   1  -4223.41902078  -4223.41902046  3.21E-07
   2   -789.48978230   -789.48978233  3.07E-08
   3   -761.37447596   -761.37447597  1.65E-08
   4   -622.84809453   -622.84809456  3.38E-08
   5   -199.42980561   -199.42980564  3.01E-08
   6   -186.66371306   -186.66371312  6.59E-08
   7   -154.70102661   -154.70102667  6.81E-08
   8   -134.54118022   -134.54118029  6.72E-08
   9   -128.01665731   -128.01665738  7.02E-08
  10    -50.78894802    -50.78894806  4.95E-08
  11    -45.03717123    -45.03717129  5.97E-08
  12    -36.68861043    -36.68861049  5.96E-08
  13    -27.52930618    -27.52930624  5.95E-08
  14    -25.98542885    -25.98542891  5.75E-08
  15    -13.88951417    -13.88951423  6.03E-08
  16    -13.48546963    -13.48546969  6.33E-08
  17    -11.29558706    -11.29558710  4.17E-08
  18     -9.05796421     -9.05796425  4.43E-08
  19     -7.06929559     -7.06929563  4.12E-08
  20     -3.79741619     -3.79741623  3.41E-08
  21     -3.50121715     -3.50121718  3.41E-08
  22     -0.14678836     -0.14678838  2.99E-08
  23     -0.11604714     -0.11604717  2.92E-08
  24     -1.74803993     -1.74803995  2.87E-08
  25     -1.10111897     -1.10111900  3.12E-08
  26     -0.77578414     -0.77578418  3.45E-08
  27     -0.10304078     -0.10304082  3.04E-08
  28     -0.08480199     -0.08480202  3.05E-08
  29     -0.16094726     -0.16094728  2.65E-08
build/gfortran_BDCD69B59C14BD7C/test/test_dft_dirac_fast  0.40s user 0.01s system 99% cpu 0.404 total

@HaoZeke
Copy link
Contributor

HaoZeke commented Oct 25, 2023

FC=$(which ifort) FFLAGS="-O3 -xHost -ipo -no-prec-div -fp-model fast=2" meson setup bbdir -Dwith_tests=True --buildtype="release"
The Meson build system
Version: 1.2.2
Source dir: /home/rgoswami/Git/Github/Fortran/featom
Build dir: /home/rgoswami/Git/Github/Fortran/featom/bbdir
Build type: native build
Project name: featom
Project version: 0.1.0
Fortran compiler for the host machine: /home/rgoswami/micromamba/envs/fe/bin/ifort (intel 2021.6.0 "ifort (IFORT) 2021.6.0 20220226")
Fortran linker for the host machine: /home/rgoswami/micromamba/envs/fe/bin/ifort ld.bfd 2.40
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /home/rgoswami/micromamba/envs/fe/bin/pkg-config (0.29.2)
Run-time dependency mkl-dynamic-lp64-seq found: YES 2023.2
Build targets in project: 10

image

image

dftatom
image

image

@certik
Copy link
Contributor Author

certik commented Nov 4, 2023

Now I am getting:

$ 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.4220427360905887     
 SCF iteration:           8
 SCF convergence error:   5.9356854835641570E-003
 SCF iteration:           9
 SCF convergence error:   1.8808454151439946E-003
 SCF iteration:          10
 SCF convergence error:   1.0470713459653780E-004
 SCF iteration:          11
 SCF convergence error:   3.1351717552752234E-005
 SCF iteration:          12
 SCF convergence error:   1.1768872354878113E-005
 SCF iteration:          13
 SCF convergence error:   1.4806355466134846E-006
 SCF iteration:          14
 SCF convergence error:   1.2302534742048010E-006
 Comparison of calculated and reference energies

 Total energy:
               E           E_ref     error
 -28001.13232593 -28001.13232549  4.44E-07

 Eigenvalues:
   n               E           E_ref     error
   1  -4223.41902067  -4223.41902046  2.16E-07
   2   -789.48978219   -789.48978233  1.45E-07
   3   -761.37447593   -761.37447597  4.10E-08
   4   -622.84809453   -622.84809456  3.56E-08
   5   -199.42980557   -199.42980564  7.33E-08
   6   -186.66371306   -186.66371312  6.80E-08
   7   -154.70102661   -154.70102667  6.69E-08
   8   -134.54118022   -134.54118029  7.39E-08
   9   -128.01665731   -128.01665738  6.98E-08
  10    -50.78894801    -50.78894806  5.64E-08
  11    -45.03717123    -45.03717129  6.10E-08
  12    -36.68861043    -36.68861049  5.81E-08
  13    -27.52930618    -27.52930624  5.81E-08
  14    -25.98542885    -25.98542891  5.96E-08
  15    -13.88951417    -13.88951423  6.22E-08
  16    -13.48546963    -13.48546969  5.95E-08
  17    -11.29558705    -11.29558710  4.38E-08
  18     -9.05796421     -9.05796425  4.14E-08
  19     -7.06929560     -7.06929563  3.80E-08
  20     -3.79741619     -3.79741623  3.64E-08
  21     -3.50121715     -3.50121718  3.50E-08
  22     -0.14678835     -0.14678838  3.12E-08
  23     -0.11604713     -0.11604717  3.12E-08
  24     -1.74803992     -1.74803995  3.07E-08
  25     -1.10111897     -1.10111900  3.33E-08
  26     -0.77578414     -0.77578418  3.52E-08
  27     -0.10304078     -0.10304082  3.20E-08
  28     -0.08480199     -0.08480202  3.18E-08
  29     -0.16094726     -0.16094728  2.62E-08
build/gfortran_565E65E7876A06C6/test/test_dft_dirac_fast  0.35s user 0.00s system 99% cpu 0.360 total

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants