开此帖的目的是因为安装并行版LAMMPS的时候,在网上找了很多教程,并且follow各个step也无错误,但始终没有得到并行版的可执行程序,可能由于此前的教程比较久远的缘故。所以综合了各个版本的教程加上各种搜索后最终搞定,并测试了两三台电脑可行后,分享给大家。
在此默认为电脑是Ubuntu系统,并且电脑已下载LAMMPS, mpich, fftw等
Step1:安装编译器
sudo apt-get install g++
sudo apt-get install build-essential gfortran
Step2: 安装mpich
cd mpich-3.3.3
sudo ./configure --prefix=/home/user/Installer/mpich3 ###安装路径,需自行修改
sudo make
sudo make install
Step3: 安装fftw
cd fftw-3-2.2
sudo ./configure --enable-float --enable-mpi --prefix=/home/user/Installer/fftw3 ### 同上
sudo make
sudo make install
Step4: 修改Makefile.mpi 文件
CC = mpic++
CCFLAGS = -g -O3
SHFLAGS = -fPIC
DEPFLAGS = -M
LINK = mpic++
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 2.2 (step 4) of manual
LMP_INC = -DLAMMPS_GZIP
# MPI library
# see discussion in Section 2.2 (step 5) of 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 #-I/home/user/Installer/mpich3/include
MPI_PATH = #-L/home/user/Installer/mpich3/lib
MPI_LIB = #-lmpich -lmpl -lpthread
# FFT library
# see discussion in Section 2.2 (step 6) 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/home/user/Installer/fftw3/include
FFT_PATH = -L/home/user/Installer/fftw3/lib
FFT_LIB = -lfftw3
Step5: 常规LAMMPS的安装
cd ~/lammps/src/STUBS/
make
cd ..
make mpi
执行完后在src目录下会生成一个lmp_mpi可执行文件,完成。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。