Compile LAMMPS on GPU on Sherlock: Difference between revisions
No edit summary |
|||
| (5 intermediate revisions by the same user not shown) | |||
| Line 12: | Line 12: | ||
==Installing and compiling LAMMPS on 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=== |
===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=== |
===Compile LAMMPS with gpu=== |
||
You need first to build the GPU library. Go to your lammps/lib/gpu folder. |
|||
Copy the generic linux makefile |
|||
cd ~/Codes/LAMMPS/lib/gpu |
|||
cp Makefile.linux Makefile.sherlock |
|||
You have to modify 3 lines in this file. Open it and replace the values of CUDA_HOME, CUDA_ARCH and CUDA_PREC with the following |
|||
vi Makefile.sherlock |
|||
CUDA_HOME = /share/sw/free/cuda/6.5 |
|||
CUDA_ARCH = -arch=sm_35 |
|||
CUDA_PREC = -D_DOUBLE_DOUBLE |
|||
==Using the GPU for a LAMMPS run== |
==Using the GPU for a LAMMPS run== |
||
Latest revision as of 22:45, 22 July 2015
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 makefile
cd ~/Codes/LAMMPS/lib/gpu cp Makefile.linux Makefile.sherlock
You have to modify 3 lines in this file. Open it and replace the values of CUDA_HOME, CUDA_ARCH and CUDA_PREC with the following
vi Makefile.sherlock
CUDA_HOME = /share/sw/free/cuda/6.5 CUDA_ARCH = -arch=sm_35 CUDA_PREC = -D_DOUBLE_DOUBLE