Lammps-29Oct20 软件安装教程-以昆山中心为例

1. 安装编译Lammps-29Oct20

(1) 下载 lammps-29Oct20.tar.gz 程序安装包,并将安装包拷贝至目录 /public/home/username/soft下。

(2) 在 /public/home/username/soft 目录下执行命令:

tar –xvf lammps-29Oct20.tar.gz  #解压

(3) 加载安装所需编译环境:

module purge  #将系统默认编译器关闭
module load compiler/intel/2017.5.239  #加载Intel编译器      
module load mpi/intelmpi/2017.4.239  #加载Intelmpi并行       
module load mathlib/fftw/3.3.8/double/intel  #加载fftw数学库

(4) 确保编译环境加载成功:

which icc
/opt/hpc/software/compiler/intel/intel-compiler-2017.5.239/bin/intel64/icc

which mpiifort
/public/software/mpi/intelmpi/2017.4.239/intel64/bin/mpiifort

(5) 进入 /public/home/username/soft/lammps-29Oct20/src 目录,在 src/ 目录下输入:

make yes-all  #先把所有包安装了

(6) 在src/目录下输入:

make no-lib  #卸载一些需要链接外部数学库的package

(7) 修改Makefile文件:

① 目录 /public/home/username/soft/lammps-29Oct20/src/MAKE 中,将Makefile.mpi 文件复制,另存为Makefile.cpu,即:

cp Makefile.mpi Makefile.cpu

② 修改src/MAKE/目录下的Makefile.cpu如下:

SHELL = /bin/sh

# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler

export OMPI_CXX = icc
CC =            mpicxx -std=c++11
CCFLAGS =       -g -O3 
SHFLAGS =       -fPIC
DEPFLAGS =      -M

LINK =          mpicxx -std=c++11
LINKFLAGS =     -g -O
LIB = 
SIZE =          size

ARCHIVE =       ar
ARFLAGS =       -rc
SHLIBFLAGS =    -shared

# ---------------------------------------------------------------------
# LAMMPS-specific settings, all OPTIONAL
# specify settings for LAMMPS features you will use
# if you change any -D setting, do full re-compile after "make clean"

# LAMMPS ifdef settings
# see possible settings in Section 3.5 of the manual

LMP_INC =       -DLAMMPS_GZIP

# MPI library
# see discussion in Section 3.4 of the manual
# MPI wrapper compiler/linker can provide this info
# can point to dummy MPI library in src/STUBS as in Makefile.serial

# use -D MPICH and OMPI settings in INC to avoid C++ lib conflicts
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library

MPI_INC =       -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I/public/software/mpi/intelmpi/2017.4.239/intel64/include
MPI_PATH =      -L/public/software/mpi/intelmpi/2017.4.239/intel64/lib
MPI_LIB =       -lmpi

# FFT library
# see discussion in Section 3.5.2 of manual
# 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 =  -DFFT_FFTW3 -I/public/software/mathlib/fftw/3.3.8/double/intel/include 
FFT_PATH =  -L/public/software/mathlib/fftw/3.3.8/double/intel/lib
FFT_LIB = -lfftw3

(8) 在src/目录下,执行:

make cpu -j 4

安装结束后src目录下会生成lmp_cpu可执行文件。

2. 配置环境

(1) 在 ~/.bashrc文件中添加环境变量:

vi ~/.bashrc
export PATH=$PATH:/public/home/username/soft/lammps-29Oct20/src

(2) 更新环境变量:

source ~/.bashrc

3. 任务提交测试

在bench目录下找到输入文件in.lj,编写任务提交脚本:

#!/bin/bash
#SBATCH -J lammps
#SBATCH -N 2
#SBATCH -n 64
#SBATCH -p kshctest

module purge
module load compiler/intel/2017.5.239         
module load mpi/intelmpi/2017.4.239           
module load mathlib/fftw/3.3.8/double/intel

export PATH=$PATH:/public/home/username/soft/lammps-29Oct20/src

mpirun -np 64 lmp_cpu < in.lj

results matching ""

    No results matching ""