brucefan1983 / NEP_CPU

CPU version of NEP
GNU General Public License v3.0
49 stars 15 forks source link

Table speedup #18

Closed brucefan1983 closed 1 year ago

brucefan1983 commented 1 year ago

To enable the table, one can modify line 20 in src/nep.h:

// #define USE_TABLE_FOR_RADIAL_FUNCTIONS

The speedup is even higher in the CPU versions of NEP here because memory accessing in CPU is relatively cheaper compared to floating point arithmetics. From my tests, one can get a 2X speedup for typical models.

Force is only accurate at the level of 1e-6 eV/A compared to the analytical version: image

chem-william commented 1 year ago

On my end, this is an awesome change! I compiled LAMMPS with the OneAPI intel compilers and Intel make file with 42 cpus and I see an almost two-times speedup (simulation time 4min 56sec -> 2min 32secs)

I ran a simulation with a bunch of gold and looking at the trajectory with ase gui they look qualitatively similar. There are differences, but I think they could be because its chaotic systems. I don't have any hard properties to look at yet.

brucefan1983 commented 1 year ago

Thanks for the tests. At least you confirmed the expected 2x speedup and that the MD results are reasonale. Whether there will be any risk in some MD application is something that one should keep in mind. So far I have not seen any risk. For heat transport which is sensitive to energy conservation we also got consistent results between table and non-table versions. Because the default is not to enable table, I think it is safe to merge the PR now.