Download the code from Github: (develop version)

Unzip it and upload to the supercomputer (e.g. our own cluster)

Go into the folder you will see something like this:

Compile lib/gpu

Go into the lib/gpu folder:

Load modules: (1) nvidia/cuda/11.2 (2) nvidia/hpc-sdk/21.2 (3) compiler/gcc/10.2. In here you should make sure that you have these two libraries: (1) libcudart (2) libcuda. In my own system I have:

  • Location for libcudart: `/cluster/spack/opt/spack/linux-centos8-zen2/gcc-10.2.0/nvhpc-21.2-a24t637mgoibc4gp7a6ftp6vab2p5tdg/Linux_x86_64/21.2/cuda/lib64`
  • Location for libcuda: `/install/netboot/centos8/x86_64/gpu/rootimg/usr/lib64`

Add both of them to LD_LIBRARY_PATH (really important)

In here the mpirun (or mpicxx) should be compiled with nvcc

We can modify `Makefile.cuda`:

  • CUDA_HOME = /usr/local/cuda --> CUDA_HOME = /cluster/spack/opt/spack/linux-centos8-zen2/gcc-10.2.0/nvhpc-21.2-a24t637mgoibc4gp7a6ftp6vab2p5tdg/Linux_x86_64/21.2/cuda
  • CUDA_ARCH = -gencode arch=compute_70,code=[sm_70,compute_70]
  • CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs -L/install/netboot/centos8/x86_64/gpu/rootimg/usr/lib64

Then we can use `make -f Makefile.cuda -j 8` to compile the code and get: (1) libgpu.a (2) nvc_get_devices

Compile src

Go into src folder.

Load module `openmpi` (for this we need to use the mpirun compiled by gcc, not nvcc)

Once you have successfully compiled lib/gpu, you can use `make yes-gpu` to install that package

Then use `make gpu -j 8` to install

After successful installation you will have an executable named `lmp_gpu`, you can check whether you have all the libraries by using `ldd lmp_gpu` command:

All the packages are found

Packages needed

Every time you install a package, you need to make clean-all first, then use make yes-package_name to install that package, then use make gpu -j 8 to recompile the executable for LAMMPS