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

LAMMPS-Allegro compile failed #52

Open
ChengQIAN93 opened this issue Aug 19, 2024 · 1 comment
Open

LAMMPS-Allegro compile failed #52

ChengQIAN93 opened this issue Aug 19, 2024 · 1 comment

Comments

@ChengQIAN93
Copy link

ChengQIAN93 commented Aug 19, 2024

Hi,

I'm trying to use pair allegro, but I'm having problems compiling it and would like to seek help from the developers.

When I try to compile lammps following the tutorial in Github, it goes smoothly at first and no errors appear. But eventually it will prompt the following error message.

[ 98%] Linking CXX static library liblammps.a
[ 98%] Built target lammps
[ 98%] Building CXX object CMakeFiles/lmp.dir/public/home/cqian/00-APP/LAMMPS-NequIP/lammps/src/main.cpp.o
[100%] Linking CXX executable lmp
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cpp.so: undefined reference to `[email protected]'
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cpp.so: undefined reference to `[email protected]'
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cu.so: undefined reference to `[email protected]'
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cu.so: undefined reference to `[email protected]'
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cpp.so: undefined reference to `[email protected]'
/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch/lib/libtorch_cuda_cpp.so: undefined reference to `[email protected]'
collect2: error: ld returned 1 exit status
make[2]: *** [lmp] Error 1
make[1]: *** [CMakeFiles/lmp.dir/all] Error 2
make: *** [all] Error 2

this is the cmake command

cmake ../cmake -DCMAKE_PREFIX_PATH=/public/home/cqian/00-APP/LAMMPS-NequIP/libtorch -DMKL_INCLUDE_DIR="$CONDA_PREFIX/include"

Do anyone know how to solve this problem ?

Thanks.

@samueldyoung29ctr
Copy link

Looks like you need to add the folders containing libcudart to $LD_LIBRARY_PATH before compiling. On NERSC Perlmutter for example, this is done by loading the cudatoolkit/12.2 or similar module. cudatoolkit/12.2 adds /opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64, which contains libcudart.so.

# Best way is to load a CUDA module if it is available on your machine
module load  cudatoolkit/12.2

# ...or add the library path yourself it there is no module, e.g.
export LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64:$LD_LIBRARY_PATH

# ...or if your system has no module but has `$CUDA_HOME` defined,
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH

If the linker also can't find libcuda.so, you may also need to add the stubs directory to $LD_LIBRARY_PATH. On NERSC Perlmutter, this directory is at /opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64/stubs and contains things like libcuda.so, libnppc.so, etc.

# Add stubs folder directly.
export LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64/stubs:$LD_LIBRARY_PATH

# ...or if your system has no module but has `$CUDA_HOME` defined,
export LD_LIBRARY_PATH=$CUDA_HOME/lib64/stubs:$LD_LIBRARY_PATH

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

No branches or pull requests

2 participants