linux系统删除lammps任务,linux下的lammps安装编译教程

a4c26d1e5885305701be709a3d33442f.png

系统:centos6.7

需要的软件:ifort、icc、fftw、mpich、lammps

1、安装ifort、icc:

#mount

TLF-SOFT-Intel.Cluster.Toolkit.Compiler.Edition.3.2.1.015.LINUX-SPYRAL.iso

/mnt -o loop(ifort的iso文件)

#cd /mnt/

#./install.sh

#vi /etc/profile写入:

source /opt/intel/composer_xe_2015.0.090/bin/iccvars.sh

intel64

source /opt/intel/composer_xe_2015.0.090/bin/ifortvars.sh

intel64

source /opt/intel/composer_xe_2015.0.090/mkl/bin/mklvars.sh

intel64

(mklvarsem64t.sh=mklvars.sh

intel64)

Source

.bashrc

2、安装mpich(新CPU一定要用最新版本的openmpi)

#mkdir /opt/mpich

#./configure

--prefix=/opt/openmpi CC=icc FC=ifort CXX=icpc

--enable-mpi-fortran

#make

#make install

#vi /etc/profile写人:

export MPI_HOME=/opt/mpich

export PATH=$MPI_HOME/bin:$PATH

export LD_LIBRARY_PATH=$MPI_HOME/lib:$LD_LIBRARY_PATH

3、安装fftw:

#mkdir /opt/fftw

#./configure --prefix=/opt/intel/fftw CC=gcc MPICC=mpicc FC=ifort

F77=ifort  --enable-mpi

--enable-openmp

--enable-threads

--enable-avx

--enable-shared=yes

#make

#make install

4编辑Mafile.mpi(在/lamps/src/MAKE目录下),修改成为红色部分一样(mpi为并行,serial为串行安装)

# mpi = MPI with its default compiler

SHELL = /bin/sh

#

---------------------------------------------------------------------

# compiler/linker settings

# specify flags and libraries needed for your compiler

CC = mpicxx -cxx=icc

CCFLAGS = -g -O3

SHFLAGS = -fPIC

DEPFLAGS = -M

LINK = mpicxx -cxx=icc

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 -DLAMMPS_MEMALIGN=64

# 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/opt/mpich/include

MPI_PATH =

-L/opt/mpich/lib

MPI_LIB = -lmpich

# 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/opt/fftw3/include

FFT_PATH =

-L/opt/fftw3/lib

FFT_LIB = -lfftw3

# JPEG and/or PNG library

# see discussion in Section 2.2 (step 7) of manual

# only needed if -DLAMMPS_JPEG or -DLAMMPS_PNG listed with

LMP_INC

# INC = path(s) for jpeglib.h and/or png.h

# PATH = path(s) for JPEG library and/or PNG library

# LIB = name(s) of JPEG library and/or PNG library

JPG_INC =

JPG_PATH =

JPG_LIB =

#

---------------------------------------------------------------------

# build rules and dependencies

# do not 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)

EXTRA_CPP_DEPENDS = $(PKG_CPP_DEPENDS)

EXTRA_LINK_DEPENDS = $(PKG_LINK_DEPENDS)

# Path to src files

vpath %.cpp ..

vpath %.h ..

# Link target

$(EXE): $(OBJ) $(EXTRA_LINK_DEPENDS)

$(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o

$(EXE)

$(SIZE) $(EXE)

# Library targets

lib: $(OBJ) $(EXTRA_LINK_DEPENDS)

$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)

shlib: $(OBJ) $(EXTRA_LINK_DEPENDS)

$(CC) $(CCFLAGS) $(SHFLAGS) $(SHLIBFLAGS) $(EXTRA_PATH) -o $(EXE)

\

$(OBJ)

$(EXTRA_LIB) $(LIB)

# Compilation rules

%.o:%.cpp

$(CC) $(CCFLAGS) $(SHFLAGS) $(EXTRA_INC) -c

$<

# Individual dependencies

depend : fastdep.exe $(SRC)

@./fastdep.exe $(EXTRA_INC) -- $^ > .depend || exit 1

fastdep.exe: ../DEPEND/fastdep.c

cc -O -o $@ $<

sinclude .depend

修改好后保存退出,然后回到src目录下

输入命令:make

mpi

如果编译成功后会生成一个lmp_mpi的文件,即表示成功。

5、测试

如果没出错,将会在src目录下生成lmp_mpi可执行文件

将lmp_mpi这个可执行文件复制出来,放到你想要的文件夹下(为了方便输入,可以将其重命名为1)测试并行:

在有这个可执行程序的文件夹下放入 in.*文件(比如in.crack),在这个文件夹下进入终端,输入:

# mpirun -np 2 ./1表示用2个核心运算)

没出错,表示安装完成!!!

注意:看计算需要用到的包,在lammps的src目录下,

输入命令:make package-status

找到需要的包,然后输入:make yes-需要的包名,再输入:make

mpi编译即可。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值