There are 2 options for GPU support in LAMMPS: via the GPU package and the KOKKOS package. Depending on your simulation and the features that are available with these packages, you can decide which package to use at run time. To build these 2 packages in a single LAMMPS binary, you can following cmake configuration:Â
mkdir build
cd build
cmake -D PKG_KSPACE=on -D PKG_MOLECULE=ON -D PKG_RIGID=ON -D PKG_CLASS2=on -D PKG_AMOBEA=on -D PKG_ASPHERE=on -D PKG_REPLICA=on -D PKG_GPU=on -D GPU_API=cuda -D GPU_ARCH=sm_80 -D BUILD_MPI=yes -D BUILD_OMP=on -D PKG_KOKKOS=on -D Kokkos_ARCH_PASCAL60=off -D Kokkos_ARCH_NATIVE=yes -D Kokkos_ARCH_AMPERE80=ON -D Kokkos_ENABLE_CUDA=yes -D Kokkos_ENABLE_OPENMP=yes -D CMAKE_CXX_COMPILER=`which mpicxx` -D MPI_C_COMPILER=`which mpicc` -DFFT_KOKKOS=CUFFT ../cmake
make -j4
Note that you need -D Kokkos_ARCH_AMPERE80=on for the KOKKOS package, the GPU package is actually built with all the architectures from 60 through 90.
If your cluster has Intel MKL, you can use FFT provided by MKL
module load mkl
which should set the environment variable MKLROOT and then specify -DFFTW3_INCLUDE_DIR to $MKLROOT/include/fftw. Otherwise, you can use -DFFT=FFTW3, or use the default KISS FFT as above. The cmake command would be
cmake -D PKG_KSPACE=on -D PKG_MOLECULE=ON -D PKG_RIGID=ON -D PKG_CLASS2=on -D PKG_AMOBEA=on -D PKG_ASPHERE=on -D PKG_REPLICA=on -D PKG_GPU=on -D GPU_API=cuda -D GPU_ARCH=sm_80 -D BUILD_MPI=yes -D BUILD_OMP=on -D PKG_KOKKOS=on -D Kokkos_ARCH_PASCAL60=off -D Kokkos_ARCH_NATIVE=yes -D Kokkos_ARCH_AMPERE80=ON -D Kokkos_ENABLE_CUDA=yes -D Kokkos_ENABLE_OPENMP=yes -D CMAKE_CXX_COMPILER=`which mpicxx` -D MPI_C_COMPILER=`which mpicc` -DFFT=MKL -DFFTW3_INCLUDE_DIR=$MKLROOT/include/fftw -DFFT_KOKKOS=CUFFT ../cmake