Compile LAMMPS on GPU on Sherlock

From Micro and Nano Mechanics Group
Jump to navigation Jump to search

Compile LAMMPS on GPU on Sherlock

Mikael Jorda

Created july 2015


This tutorial explains how to install, compile and use LAMMPS with GPUs on the cluster Sherlock


Installing and compiling LAMMPS on sherlock

In order to use LAMMPS on GPU, you must compile it with the cuda library. The process is a little bit different from the usual compilation of LAMMPS.

Download LAMMPS

Go to the LAMMPS website (http://lammps.sandia.gov/download.html) and download the most recent stable version of the code. Put it in your Codes directory and unzip it

tar -zxvf lammps-stable.tar.gz

or

The following command can be used to checkout a specific reversion of LAMMPS from our svn server.

svn checkout -r 23 http://micro.stanford.edu/svn/LAMMPS ~/Codes/LAMMPS.svn/

1. Copy Makefile.mc2 into Codes/LAMMPS.svn/src/MAKE/ directory using the following commands

cd ~/Codes/LAMMPS
wget http://micro.stanford.edu/mediawiki/images/f/fb/Makefile.mc2.txt -O ./src/MAKE/Makefile.mc2 

2. In any directory, type the following command

Export TARGET=sherlock

(or add it to your bash_profile not to have to type it every time you connect to the cluster)

3. In your home directory, make a folder named usr

mkdir ~/usr 

4. Download the fftw library and unzip it using the following commands

cd ~/usr
wget http://micro.stanford.edu/mediawiki/images/9/9e/Fftw.tar -O fftw.tar
tar –zxvf fftw.tar

5. Make sure you have the modules for using mpi complier and cuda, you can load the modules by adding the below two lines to your bash_profile file.

vi ~/.bash_profile (You can use whatever text editor to open the file and add the following lines)
module load mpich/3.1.4
module load cuda 

Save the file and log out. Next time when you log in, the compilers should work for you.

Compile LAMMPS with gpu

You need first to build the GPU library. Go to your lammps/lib/gpu folder. Copy the generic linux mkefile

cp Makefile.linux Makefile.sherlock

You have to modify 3 parameters in this file

Using the GPU for a LAMMPS run

Modify the input script

Request GPUs on Sherlock