mir-group / pair_allegro

LAMMPS pair style for Allegro deep learning interatomic potentials with parallelization support
https://www.nature.com/articles/s41467-023-36329-y
MIT License
33 stars 8 forks source link

Error during final linking step for LAMMPS #7

Closed timloose closed 1 year ago

timloose commented 1 year ago

I'm having trouble linking the final lmp executable with libtorch and Kokkos.

My environment is gcc/9.1.0 (same issue with gcc 10.1.0 and 10.2.0, and different issues with older gcc versions) cuda/11.2 libtorch/1.12.0 cudnn/8.4.1 cmake/3.19 mkl/2017

The following cmake command succeeded (with a warning about save runtime search paths for lmp)

cmake ../cmake -DCMAKE_PREFIX_PATH=/project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/ -DPKG_KOKKOS=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_PASCAL60=ON -DCUDNN_INCLUDE_PATH=/project2/gavoth/loose/CGnequip/conda/include/ -DCUDNN_LIBRARY_PATH=/project2/gavoth/loose/CGnequip/conda/lib/libcudnn.so

The error I receive when I actually make LAMMPS is:

[100%] Linking CXX executable lmp
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `powf@GLIBC_2.27'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `log2f@GLIBC_2.27'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgammaf@GLIBC_2.23'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `expf@GLIBC_2.27'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `exp2f@GLIBC_2.27'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `lgamma@GLIBC_2.23'
/software/gcc-9.1.0-el7-x86_64/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /project2/gavoth/loose/CGnequip/allegro_lammps/libtorch/libtorch/lib/libtorch_cpu.so: undefined reference to `logf@GLIBC_2.27'
collect2: error: ld returned 1 exit status
make[2]: *** [lmp] Error 1
make[1]: *** [CMakeFiles/lmp.dir/all] Error 2
make: *** [all] Error 2

My assumption is that I have either not found a good version of gcc or libtorch.

anjohan commented 1 year ago

Hi @timloose ,

If I remember correctly, you need to download the "cxx11 ABI" version of libtorch when building with Kokkos+CUDA.

Best wishes, Anders

timloose commented 1 year ago

Hey Anders,

Thanks for the reply. I thought I had done that, but I redownloaded to check- still getting the same error. I looked into it more and it seems like the real issue is that the glibc version on my cluster is insufficient. I went ahead and compiled without Kokkos in the meantime with no issues.

Best, Tim

anjohan commented 1 year ago

Ah, that rings a bell!

If you have very light Allegro models and think you could benefit from the Kokkos acceleration, you can build pytorch yourself, which will just use your local glibc version.