Lammps GPU 版本安装测试

标签:
cudagpugpu计算hpclammpsit |
1.
2.
3.
4.
a)
网站下载:http://lammps.sandia.gov/download.html;目前最新为lammps-10Oct12
$ tar –xzvf lammps.tar.gz
b)
$ cd lammps-10Oct12/lib/gpu
修改Makefile文件; 选择CUDA路径和GPU架构(红色部分)
$ vi Makefile.linux
#
CUDA_HOME = /opt/cuda/cuda5.0
NVCC = nvcc
# Kelper CUDA
CUDA_ARCH = -arch=sm_30
# Tesla CUDA
#CUDA_ARCH = -arch=sm_21
# newer CUDA
#CUDA_ARCH = -arch=sm_13
# older CUDA
#CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE
CUDA_PRECISION = -D_SINGLE_SINGLE
CUDA_INCLUDE = -I$(CUDA_HOME)/include
CUDA_LIB = -L$(CUDA_HOME)/lib64
CUDA_OPTS = -DUNIX -O3 -Xptxas -v --use_fast_math
CUDR_CPP = mpicxx -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK
CUDR_OPTS = -O2 # -xHost -no-prec-div -ansi-alias
BIN_DIR = ./
OBJ_DIR = ./
LIB_DIR = ./
AR = ar
BSH = /bin/sh
CUDPP_OPT = -DUSE_CUDPP -Icudpp_mini
include Nvidia.makefile
$ make –f Makefile.linux
c)
$ cd lammps-10Oct12/lib/cuda
$ rm *.o
$ make CUDA_INSTALL_PATH=/opt/cuda/cuda5.0 cufft=2 precision=2 arch=30
d)
$ cd lammps-10Oct12/src
$ make clean-all
$ make no-all
$ make yes-molecule
$ make yes-kspace
$ make yes-asphere
$ make yes-gpu
$ make yes-user-cuda
$ vi MAKE/Makefile.gpu
# openmpi = Redhat 5.x , mpic++, OpenMPI-1.4.5, FFTW2
SHELL = /bin/sh
# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler
CC =
CCFLAGS =
SHFLAGS =
DEPFLAGS
=
LINK =
LINKFLAGS
=
LIB =
SIZE =
ARCHIVE =
ARFLAGS =
SHLIBFLAGS
=
# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use
# if you change any -D setting, do full re-compile after "make clean"
# LAMMPS ifdef settings, OPTIONAL
# see possible settings in doc/Section_start.html#2_2 (step 4)
LMP_INC =
# MPI library, REQUIRED
# see discussion in doc/Section_start.html#2_2 (step 5)
# can point to dummy MPI library in src/STUBS as in Makefile.serial
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library
MPI_INC = -I/opt/openmpi/include
MPI_PATH =
MPI_LIB = -L/opt/openmpi/lib -lmpi
# FFT library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 6)
# can be left blank to use provided KISS FFT library
# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library
FFT_INC =
FFT_PATH =
FFT_LIB =
# JPEG library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 7)
# only needed if -DLAMMPS_JPEG listed with LMP_INC
# INC = path for jpeglib.h
# PATH = path for JPEG library
# LIB = name of JPEG library
JPG_INC =
JPG_PATH =
JPG_LIB =
# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section
include Makefile.package.settings
include Makefile.package
EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) $(PKG_SYSINC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)
# Link target
$(EXE): $(OBJ)
# Library targets
lib:
shlib:
# Compilation rules
%.o:%.cpp
%.d:%.cpp
# Individual dependencies
DEPENDS = $(OBJ:.o=.d)
sinclude $(DEPENDS)
# make gpu
编译结束后,在当前目录中会出现一个可执行文件 lmp_gpu; 即为LAMMPS的运行文件。
5.
进入lammps-10Oct12/bench/GPU;有三个测试实例。我们以lj为例。
a)
$ mpirun –np 8 ~/lammps-10Oct12/src/lmp_gpu –c off –v x 32 –v y 32 –v z32 –v t 1000 < in.lj.cpu
8 为MPI进程数;
-c off 关闭CUDA;
x, y, z 定义问题的大小;
t 为模拟步数
b)
$ mpirun –np 8 ~/lammps-10Oct12/lmp_gpu –sf gpu –c off –v x 32 –v y 32 –v z 32 –v t 1000 < in.lj.gpu
c)
$ mpirun –np 8 ~/lammps-10Oct12/lmp_gpu –sf cuda–v x 32 –v y 32 –v z 32 –v t 1000 < in.lj.cuda
具体参考README文件。