创建编译目录,并下载lammps安装包
mkdir /opt/build
cd /opt/build
wget https://github.com/lammps/lammps/archive/refs/tags/patch_17Feb2022.zip
unzip patch_17Feb2022.zip
cd patch_17Feb2022
编译intel mpi版本lammps,编译完成后会在 src 目录生成可执行文件" lmp_intel_cpu_intelmpi"
source /opt/intel/bin/compilervars.sh intel64
cd src
make yes-all
make no-lib
make -j 10 intel_cpu_intelmpi
可以用如下命令清空编译环境
make clean-all
make clean-machine
make no-all
编译 intel mpi GPU版本lammps,编译完成后会在 src 目录生成可执行文件" lmp_intel_cpu_intelmpi" ,为了便于区分,可将名称改为:lmp_intel_cpu_intelmpi_cuda
source /opt/intel/bin/compilervars.sh intel64
cd /opt/build/lammps-patch_17Feb2022/lib/gpu
vim Makefile.linux
CUDA_ARCH = -arch=sm_70 #修改Makefile.linux,将CUDA_ARCH置为sm_70
make -f Makefile.linux
可以用 ”make -f Makefile.linux clean“ 命令清理编译环境
export CUDA_HOME=/usr/local/cuda
export PATH=/usr/local/cuda/bin:$PATH
export CPATH=/usr/local/cuda/include:$CPATH
export LIBRARY_PATH=/usr/local/cuda/lib64:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
cd ../../src
make yes-all
make yes-gpu
make no-lib
make -j 10 intel_cpu_intelmpi
运行lammps任务
mpirun -np 12 lmp_intel_cpu_intelmpi -in demo.in #运行cpu版本
mpirun -np 12 lmp_intel_cpu_intelmpi_gpu -sf gpu -pk gpu 1 -in demo.in #运行gpu版本