Cannot find lcufft when compiling lammps with kokkos and gpu

I’ve used the following command to build and compile kokkos with no errors:

cmake …/ -D CMAKE_CXX_COMPILER=/home/ao/Desktop/kokkos-4.0.00/bin/nvcc_wrapper
-D Kokkos_ARCH_AMPERE86=ON -D Kokkos_ENABLE_OPENMP=yes -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ENABLE_CUDA_LAMBDA=ON …/cmake

with this I can build,compile and create an executable lammps with kokkos but not using the gpu/cuda, conversely I can compile with the gpu but no kokkos.

If I try to build lammps with kokkos and gpu

cmake -C …/cmake/presets/kokkos-cuda.cmake -C …/cmake/presets/most.cmake -DKokkos_ARCH_GPU=yes …/cmake

the build output looks good … last lines

– Kokkos Devices: CUDA;CUDA_LAMBDA;SERIAL
– Kokkos Architecture: AMPERE86;GPU
– <<< FFT settings >>>
– Primary FFT lib: FFTW3
– Using double precision FFTs
– Using threaded FFTs
– Kokkos FFT: cuFFT
– <<< Building Tools >>>
– Configuring done
– Generating done
– Build files have been written to: /home/ao/Desktop/lammps-28Mar2023/build-kgrx

and the compile proceeds no errors until the end: ( multiple “unused result” warnings

[100%] Building CXX object CMakeFiles/lammps.dir/home/ao/Desktop/lammps-28Mar2023/src/OPT/pair_eam_fs_opt.cpp.o
[100%] Linking CXX static library liblammps.a
[100%] Built target lammps
[100%] Building CXX object CMakeFiles/lmp.dir/home/ao/Desktop/lammps-28Mar2023/src/main.cpp.o
[100%] Linking CXX executable lmp
/usr/bin/ld: cannot find -lcufft: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/lmp.dir/build.make:120: lmp] Error 1
make[1]: *** [CMakeFiles/Makefile2:391: CMakeFiles/lmp.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

libcufft does exist and the full path for libcufft is in /usr/local/cuda/lib64 in bashrc, but as I understand it is a runtime option and may not be accessed during the compile/linking.

The question may be then how to tell cmake access the/a libcufft.so ? Do I copy a version into /usr/bin/

Release Linux Mint 21.1 Vera 64-bit NVIDIA-SMI 525.85.12 Driver Version: 525.85.12
CUDA Version: 12.0

small update. in the build process the link libcufft.so.11 is included and it does point to
usr/local/cuda-12.0/lib64/libcufft.so.11 the executable

I compiled without error using the individual package commands:

cmake …/cmake/presets/most.cmake -D PKG_KOKKOS=yes -D Kokkos_ARCH_AMPERE86=ON -D Kokkos_ENABLE_CUDA=ON -D Kokkos_ARCH_GPU=yes -D Kokkos_ENABLE_SERIAL=ON BUILD_OMP=ON …/cmake

and also compiled without error using the following without the first -C option
cmake …/cmake/presets/most.cmake -C …/cmake/presets/kokkos-cuda.cmake -DKokkos_ARCH_AMPERE86=ON -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_GPU=yes -D PKG_REAXFF=yes …/cmake

But if I used the -C option
cmake -C …/cmake/pr…

then the error appears
/usr/bin/ld: cannot find -lcufft: No such file or directory
collect2: error: ld returned 1 exit status

So apparently prepopulating the cache affects the outcome

regards,
pb

1 Like