lammps CUDA 编译

cuda7.5.18 lammps10Aug15  compiled on 2015/09/15
-------------------
tar –zxvf openmpi-1.4.5.tar.gz
cd openmpi-1.4.5
./configure --prefix=/opt/opnmpi
make
make install
设置环境变量
gedit ~/.bashrc
PATH=/opt/cuda/bin:/opt/openmpi/bin:$PATH
LD_LIBRARY_PATH=/opt/cuda/lib64:/opt/openmpi/lib:/opt/fftw2/lib:$LD_LIBRARY_PATH
最后source ~/.bashrc
测试openmpi是否安装成功
which mpicc
which mpiexec
which mpirun


配置lammps
http://lammps.sandia.gov/tars/lammps.tar.gz
tar xvf lammps.tar.gz


首先编译gpu package
cd lammps/lib/gpu
修改Makefile.linux
CUDA_HOME = /opt/cuda
# Kelper CUDA
CUDA_ARCH = -arch=sm_30    ##########这个值参考这里https://developer.nvidia.com/cuda-legacy-gpus
CUDA_LIB = -L$(CUDA_HOME)/lib64 -L/opt/cuda/lib64/stubs  ####这里貌似与以前不同了
(将其他CUDA_ARCH注释掉)
最后make -f Makefile.linux
生成nvc_get_devices,可以运行一下,看看GPU的信息


修改Makefile.lammps
gpu_SYSINC = -I/opt/cuda/include
gpu_SYSLIB = -lcudart -lcuda
gpu_SYSPATH = -L/opt/cuda/lib64  -L/opt/cuda/lib64/stubs
然后编译自定义包,我们需要用到user-cuda
cd ../cuda
修改Makefile.common
CUDA_INSTALL_PATH = /opt/cuda
然后make:
make cufft=2 precision=2 arch=21
最后会生成liblammpscuda.a


然后安装所需要的包:
make yes-asphere
make yes-class2
make yes-colloid
make yes-dipole
make yes-granular
make yes-user-misc
make yes-user-cg-cmm
安装GPU和USER-CUDA package
make yes-gpu
make yes-user-cuda


编译lammps
使用/src/MAKE/Makefile.openmpi作为模版
cp MAKE/Makefile.mpi MAKE/Makefile.gpu
vi MAKE/Makefile.gpu


#MPI_INC =  -I/opt/openmpi/include     ###这个按前面的配置路径来
#MPI_PATH = 
#MPI_LIB = -L/opt/openmpi/lib -lmpi


JPG_INC =  -I/share/apps/jpeg/include -DLAMMPS_JPEG   ###需要事先安装这个库
JPG_PATH =
JPG_LIB = -L/share/apps/jpeg/lib -ljpeg




然后
make gpu
于是生成 lmp_gpu
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章