Ubuntu
切换到根目录(root)
sudo -s
一 安装fftw
1下载源码包fftw-2.1.5.tar.gz,解压 tar xvzf fftw-2.1.5.tar.gz
2 cd fftw-2.1.5.
3 ./configure --prefix=/opt/mathlib/fftw215-gnu --enable-float
其它选项:
4 make
5 make install
二 安装mpich
1下载mpich.tar.gz
2 cd mpich-1.2.7**
3 ./configure --prefix=/opt/mpich-gnu
4 make
5 make install
三 编辑/etc/hosts.equiv文件,在其中加入本机主机名(用hostname可以得到),单独一行!
前三步都在root下进行。
下面的步骤都在自己的用户中进行
四 安装lammps
1 tar xvzf lammps.tar.gz
2 cd lammps**
3 cd src
4 vim MAKE/Makefile.g++
修改mpich的安装路径
修改fftw的安装路径
(每个都有两处,include前面和lib前面的部分)
# g++ = RedHat Linux box, g++, MPICH2, FFTW
SHELL = /bin/sh
# System-specific settings
CC = g++
CCFLAGS = -g -O -DFFT_FFTW -DLAMMPS_GZIP -
DMPICH_IGNORE_CXX_SEEK -I/opt/mathlib/fftw215-gnu/include -I/opt/mpich-
gnu/include
DEPFLAGS = -M
LINK = g++ -L/opt/mathlib/fftw215-gnu/lib -L/opt/mpich-
gnu/lib
LINKFLAGS = -g -O
USRLIB = -lfftw -lmpich
SYSLIB = -lpthread
ARCHIVE = ar
ARFLAGS = -rc
SIZE = size
# Link target
$(EXE): $(OBJ)
$(LINK) $(LINKFLAGS) $(OBJ) $(USRLIB) $(SYSLIB) -o $(EXE)
$(SIZE) $(EXE)
# Library target
lib: $(OBJ)
$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)
# Compilation rules
%.o:%.cpp
$(CC) $(CCFLAGS) -c $<
%.d:%.cpp
$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@
# Individual dependencies
DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)
5 make g++ (在src目录下)
生成lmp_g++
四 运行lammps
1 cd ../bench
2 /opt/mpich-gnu/bin/mpirun -np 16 ../src/lmp_g++
Fedora
与ubuntu下编译略有不同
第一、二、四步同上(MPICH与MPICH2皆可,此处安装的是后者)
第三步改为:
三 并行环境设置
普通用户即可
$ cd $HOME
$ touch .mpd.conf
$ chmod 600 .mpd.conf
然后运行mpdboot。
如没上述设置运行时可能出现如下错误
mpiexec_Fedora: cannot connect to local mpd (/tmp/mpd2.console_mse406); possible causes:
1. no mpd is running on this host
2. an mpd is running but was started without a "console" (-n option)
In case 1, you can start an mpd on this host with:
mpd &
and you will be able to run jobs just on this host.
For more details on starting mpds on a set of hosts, see
the MPICH2 Installation Guide.
第五步 运行lammps
1 cd ../bench
2 /opt/mpich-gnu/bin/mpirun -np 16 ../src/lmp_g++
原帖地址: