24小时热门版块排行榜    

查看: 2728  |  回复: 3
本帖产生 1 个 模拟EPI ,点击这里进行查看

qphll

金虫 (正式写手)

[交流] 【分享】Lammps 安装, X64, PGI, MPICH, FFTW 已有2人参与

需要认真尝试Lammps的REAX, 于是认真地在机器上面安装了一下新的版本, 22Nov10

(1) X64, PGI, 对应的FFTW和MPICH准备妥当;

(2) lib下的reax, poems, meam, 分别make, 生成需要的lib文件;

(3) # cd src
     # make yes-standard
     # make no-gpu
    # make no-USER-ATC
   
(4) Makefile.pgi 文件内容, 注意MPICH和FFTW对应的版本!!

# pgi = Portland Group compiler, pgCC, MPICH, FFTW

SHELL = /bin/sh
.SUFFIXES: .cpp .d

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

CC =                mpicxx
CCFLAGS =        -fast
DEPFLAGS =        -M
LINK =                mpicxx
LINKFLAGS =             -Bstatic
LIB =           -lstdc++ -lpthread -lpgf90 -lpghpf_mpi -lpghpf2 -lpgf90rtl -lpgftnrtl
ARCHIVE =        ar
ARFLAGS =        -rc
SIZE =                size

# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use

# LAMMPS ifdef options, see doc/Section_start.html

LMP_INC =        -DLAMMPS_GZIP -I/share/lhuang4/lammps-22Nov10/src/Obj_pgi -I../../lib/atc

# MPI library, can be src/STUBS dummy lib
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library

MPI_INC =       -I/usr/local/apps/mpich2/pgi105x64/1.3a2/include
#MPI_PATH =        -L/usr/local/apps/mpich2/pgi105x64/1.3a2/lib
#MPI_LIB =        -lmpich

# FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
# INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library

FFT_INC =       -DFFT_FFTW  -I/usr/local/apps/fftw/pgi105x64/2.1.5/include
FFT_PATH =   
FFT_LIB =        /usr/local/apps/fftw/pgi105x64/2.1.5/lib/libfftw.a

# additional system libraries needed by LAMMPS package libraries
# these settings are IGNORED if the corresponding LAMMPS package
#   (e.g. gpu, meam) is NOT included in the LAMMPS build
# SYSLIB = names of libraries
# SYSPATH = paths of libraries

#gpu_SYSLIB =       -lcudart
meam_SYSLIB =      -lpthread -lpgf90 -lpgc
reax_SYSLIB =      -lpthread -lpgf90 -lpgc
user-atc_SYSLIB =  -L/usr/local/apps/acml/acml4.3.0/pgi64/lib -lacml

#gpu_SYSPATH =      -L/usr/local/cuda/lib64
#meam_SYSPATH =     /usr/local/pgi/linux86-64/10.5/lib
#reax_SYSPATH =     /usr/local/pgi/linux86-64/10.5/lib
user-atc_SYSPATH =        

# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section

include        Makefile.package

EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(PKG_SYSLIB)

# Link target

$(EXE):        $(OBJ)
        $(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
        $(SIZE) $(EXE)

# Library target

lib:        $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)

# Compilation rules

%.o:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) -c $<

%.d:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@

# Individual dependencies

DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)

(6)  # make pgi  生成可执行文件 lmp_pgi

(7) 测试exmaple里面的reax文件, 并行计算, 测试通过.

仅供大家参考.
回复此楼
Life, Love, Laugh.
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qphll

金虫 (正式写手)

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
zh1987hs(金币+10):谢谢 2010-11-24 08:53:08
更新了一下, 有更详细信息.

The key point here is that you compile all the fortran files and c++ files using PGI compilers,

which are:

Fortran: pgf90
C++:     mpicxx

PLEASE ALSO PAY ATTENTION TO FFTW AND MPICH VERSIONS.


(1) # cd lib/reax
     # make -f Makefile.pgf90

The following is the contents of Makefile.pgf90 for reax

###The beginning of Makefile.pgf90
# *
# *_________________________________________________________________________*
# *      Fortran Library for Reactive Force Field                           *
# *      DESCRIPTION: SEE READ-ME                                           *
# *      FILE NAME: Makefile                                                *
# *      CONTRIBUTING AUTHORS: Hansohl Cho(MIT), Aidan Thompson(SNL)        *
# *                            and Greg Wagner(SNL)                         *
# *      CONTACT: hansohl@mit.edu, athompson@sandia.gov, gjwagne@sandia.gov *
# *_________________________________________________________________________*/

# To compile and link LAMMPS to the reax library generated by this Makefile,
# you need to first install the reax package (make yes-reax), after which the
# file Makefile.package should look something like:

# PKG_INC =  -I../../lib/reax
# PKG_PATH = -L../../lib/reax
# PKG_LIB =  -lreax

# PKG_SYSPATH = $(reax_SYSPATH)
# PKG_SYSLIB =  $(reax_SYSLIB)

# The reax_SYSPATH and reax_SYSLIB variables contain compiler options
# giving the paths of needed FORTRAN libraries, and their names, respectively
#

SHELL = /bin/sh

# ------ FILES ------

SRC = reax_connect.F reax_inout.F reax_lammps.F reax_poten.F reax_reac.F reax_charges.F

HEADERFILES = reax_defs.h *.blk

# ------ DEFINITIONS ------

LIB = libreax.a
OBJ =   $(SRC:.F=.o)

# ------ SETTINGS ------

F90 =           pgf90
F90FLAGS =      -O
ARCHIVE =        ar
ARCHFLAG =        -rc
USRLIB =
SYSLIB =

# ------ MAKE PROCEDURE ------

lib:         $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)

# ------ COMPILE RULES ------

%.o:%.F $(HEADERFILES)
        $(F90) $(F90FLAGS) -c $<

# ------ CLEAN ------

clean:
        -rm *.o $(LIB)

### The ending of Makefile.pgf90

(2) # cd lib/meam
     # make -f Makefile.pgf90

The following is the contents of Makefile.pgf90 for meam

###The beginning of Makefile.pgf90
# *
# *_________________________________________________________________________*
# *      MEAM: MODEFIED EMBEDDED ATOM METHOD                                *
# *      DESCRIPTION: SEE READ-ME                                           *
# *      FILE NAME: Makefile                                                *
# *      AUTHORS: Greg Wagner, Sandia National Laboratories                 *
# *      CONTACT: gjwagne@sandia.gov                                        *
# *_________________________________________________________________________*/

SHELL = /bin/sh

# ------ FILES ------

SRC = meam_data.F meam_setup_done.F meam_setup_global.F meam_setup_param.F meam_dens_init.F meam_dens_final.F meam_force.F meam_cleanup.F

FILES = $(SRC) Makefile

# ------ DEFINITIONS ------

LIB = libmeam.a
OBJ =   $(SRC:.F=.o)

# ------ SETTINGS ------

F90 =           pgf90
F90FLAGS =      -O
ARCHIVE =        ar
ARCHFLAG =        -rc
USRLIB =
SYSLIB =

# ------ MAKE PROCEDURE ------

lib:         $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)

# ------ COMPILE RULES ------

%.o:%.F
        $(F90) $(F90FLAGS) -c $<

# ------ CLEAN ------

clean:
        -rm *.o *.mod *~ $(LIB)

tar:
        -tar -cvf ../MEAM.tar $(FILES)

### The ending of Makefile.pgf90


(3) # cd lib/poems

You have to modify the Makefile.icc included there and save it as Makefile.pgi

     # make -f Makefile.pgi

The following is the contents of Makefile.pgi for poems

### The beginning of Makefile.pgi
# *
# *_________________________________________________________________________*
# *      POEMS: PARALLELIZABLE OPEN SOURCE EFFICIENT MULTIBODY SOFTWARE     *
# *      DESCRIPTION: SEE READ-ME                                           *
# *      FILE NAME: Makefile                                                *
# *      AUTHORS: See Author List                                           *
# *      GRANTS: See Grants List                                            *
# *      COPYRIGHT: (C) 2005 by Authors as listed in Author’s List          *
# *      LICENSE: Please see License Agreement                              *
# *      DOWNLOAD: Free at www.rpi.edu/~anderk5                             *
# *      ADMINISTRATOR: Prof. Kurt Anderson                                 *
# *                     Computational Dynamics Lab                          *
# *                     Rensselaer Polytechnic Institute                    *
# *                     110 8th St. Troy NY 12180                           *
# *      CONTACT:        anderk5@rpi.edu                                    *
# *_________________________________________________________________________*/



SHELL = /bin/sh


# ------ FILES ------

SRC_MAIN = workspace.cpp system.cpp poemsobject.cpp
INC_MAIN = workspace.h system.h poemsobject.h

SRC_BODY =      body.cpp rigidbody.cpp particle.cpp inertialframe.cpp
INC_BODY =      bodies.h body.h rigidbody.h particle.h inertialframe.h


SRC_JOINT =     joint.cpp revolutejoint.cpp prismaticjoint.cpp sphericaljoint.cpp \
    freebodyjoint.cpp body23joint.cpp mixedjoint.cpp
INC_JOINT =     joints.h joint.h revolutejoint.h prismaticjoint.h sphericaljoint.h \
    freebodyjoint.h body23joint.h mixedjoint.h

SRC_POINT =     point.cpp fixedpoint.cpp
INC_POINT =     points.h point.h fixedpoint.h

SRC_SOLVE = solver.cpp  
INC_SOLVE = solver.h  

SRC_ORDERN = onsolver.cpp onfunctions.cpp onbody.cpp
INC_ORDERN = onsolver.h onfunctions.h onbody.h

SRC_MAT =       virtualmatrix.cpp matrix.cpp matrixfun.cpp mat3x3.cpp virtualcolmatrix.cpp \
    colmatrix.cpp vect3.cpp virtualrowmatrix.cpp rowmatrix.cpp mat6x6.cpp vect6.cpp \
    fastmatrixops.cpp colmatmap.cpp eulerparameters.cpp vect4.cpp norm.cpp mat4x4.cpp \
   
INC_MAT =       matrices.h virtualmatrix.h matrix.h matrixfun.h mat3x3.h virtualcolmatrix.h \
    colmatrix.h vect3.h virtualrowmatrix.h rowmatrix.h mat6x6.h vect6.h \
    fastmatrixops.h colmatmap.h eulerparameters.h vect4.h norm.h mat4x4.h

SRC_MISC = poemstreenode.cpp
INC_MISC = poemslist.h poemstreenode.h poemstree.h poemsnodelib.h SystemProcessor.h defines.h POEMSChain.h

SRC = $(SRC_MAIN) $(SRC_BODY) $(SRC_JOINT) $(SRC_POINT) $(SRC_SOLVE) $(SRC_ORDERN) $(SRC_MAT) $(SRC_MISC)
INC = $(INC_MAIN) $(INC_BODY) $(INC_JOINT) $(INC_POINT) $(INC_SOLVE) $(INC_ORDERN) $(INC_MAT) $(INC_MISC)

FILES = $(SRC) $(INC) Makefile Authors_List.txt Grants_List.txt POEMS_License.txt README Copyright_Notice

# ------ DEFINITIONS ------

LIB = libpoems.a
OBJ =   $(SRC:.cpp=.o)

# ------ SETTINGS ------

CC =                mpicxx
CCFLAGS =       -O  -fast
ARCHIVE =        ar
ARCHFLAG =        -rc
DEPFLAGS =      -M
LINK =                mpicxx
LINKFLAGS =        -O
USRLIB =
SYSLIB =

# ------ MAKE PROCEDURE ------

lib:         $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(LIB) $(OBJ)

# ------ COMPILE RULES ------

%.o:%.cpp
        $(CC) $(CCFLAGS) -c $<
%.d:%.cpp
        $(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@               

# ------ DEPENDENCIES ------

DEPENDS = $(OBJ:.o=.d)

# ------ CLEAN ------

clean:
        -rm *.o *.d *~ $(LIB)

tar:       
        -tar -cvf ../POEMS.tar $(FILES)

### The ending of Makefile.pgi




(4) By successfully completing the previous (1), (2) and (3), you should have got the three library files, namely, libreax.a, libpoems.a, libmeam.a under lib/reax, lib/poems, and lib/meam, respectively.

# cd src
# make yes-standard
# make no-gpu
# make no-USER-ATC
# make pgi

(5) The makefile we are using is at /src/MAME, Makefile.pgi

The following is the contents of Makefile.pgi for Lammps

### The beginning of Makefile.pgi
# pgi = Portland Group compiler, pgCC, MPICH, FFTW

SHELL = /bin/sh
.SUFFIXES: .cpp .d

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

CC =                mpicxx
CCFLAGS =        -fast
DEPFLAGS =        -M
LINK =                mpicxx
LINKFLAGS =             -Bstatic
LIB =           -lstdc++ -lpthread -lpgf90 -lpghpf_mpi -lpghpf2 -lpgf90rtl -lpgftnrtl
ARCHIVE =        ar
ARFLAGS =        -rc
SIZE =                size

# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use

# LAMMPS ifdef options, see doc/Section_start.html

LMP_INC =        -DLAMMPS_GZIP -I/share/lhuang4/lammps-3Oct10/src/Obj_pgi -I../../lib/atc

# MPI library, can be src/STUBS dummy lib
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library

MPI_INC =       -I/usr/local/apps/mpich2/pgi105x64/1.3a2/include
#MPI_PATH =        -L/usr/local/apps/mpich2/pgi105x64/1.3a2/lib
#MPI_LIB =        -lmpich

# FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
# INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library

FFT_INC =       -DFFT_FFTW  -I/usr/local/apps/fftw/pgi105x64/2.1.5/include
FFT_PATH =   
FFT_LIB =        /usr/local/apps/fftw/pgi105x64/2.1.5/lib/libfftw.a

# additional system libraries needed by LAMMPS package libraries
# these settings are IGNORED if the corresponding LAMMPS package
#   (e.g. gpu, meam) is NOT included in the LAMMPS build
# SYSLIB = names of libraries
# SYSPATH = paths of libraries

#gpu_SYSLIB =       -lcudart
meam_SYSLIB =      -lpthread -lpgf90 -lpgc
reax_SYSLIB =      -lpthread -lpgf90 -lpgc
user-atc_SYSLIB =  -L/usr/local/apps/acml/acml4.3.0/pgi64/lib -lacml

#gpu_SYSPATH =      -L/usr/local/cuda/lib64
#meam_SYSPATH =     /usr/local/pgi/linux86-64/10.5/lib
#reax_SYSPATH =     /usr/local/pgi/linux86-64/10.5/lib
user-atc_SYSPATH =        

# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section

include        Makefile.package

EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(PKG_SYSLIB)

# Link target

$(EXE):        $(OBJ)
        $(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) $(LIB) -o $(EXE)
        $(SIZE) $(EXE)

# Library target

lib:        $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)

# Compilation rules

%.o:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) -c $<

%.d:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@

# Individual dependencies

DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)

### The ending of Makefile.pgi

(6) You may notice that there is still room of optimizing the Makefile.pgi, but some parameters are left there purposely for further reference when you decide to try out GPU or take advantage of USER-ATC, et. al.

GOOD LUCK!

[ Last edited by qphll on 2010-11-24 at 07:54 ]
Life, Love, Laugh.
2楼2010-11-24 07:50:36
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

qphll

金虫 (正式写手)

★ ★ ★ ★ ★ ★ ★ ★ ★ ★
zh1987hs(金币+10):谢谢 2010-12-04 23:13:31
Install Lammps on Mac OS X 10.6 (Snow Leopard) without GPU library.

(1) Mac OS X 10.6.5

(2) Xcode 3.2.x is isntalled.

(3) getting gfortran from http://hpc.sf.net : gfortran-snwleo-intel-bin.tar.gz
instrucion:
(A) gunzip gfortran-snwleo-intel-bin.tar.gz
(B) sudo tar -xf gfortran-snwleo-intel-bin.tar -C /

(4) getting git from http://code.google.com/p/git-osx-installer/
(5) getting Lammps at some directory:
git clone http://git.icms.temple.edu/lammps-ro.git mylammps
(see http://lammps.sandia.gov/download.html)
the latest lammps is downloaded in directory: mylammps

(6) installation of OpenMPI
getting OpenMPI from http://www.open-mpi.org/software/ompi/v1.4/
expanding tar file and:
./configure
make all
make check
sudo make install

(7) installation of FFTW
use FFTW version 2.1.5
http://www.fftw.org/download.html
expanding tar file and:
./configure
make all
make check
sudo make install

(8) make of LAMMPS
(A) at directories in src/lib: atc, meam, poems, reax
atc: make -f Makefile.g++
meam: make -f Makefile.gfortran
poems: make -f Makefile.g++
reax: make -f Makefile.gfortran
(B) at mylammps/src/MAKE, modification of Makefile.openmpi
#meam_SYSLIB = -lifcore -lsvml -lompstub -limf #comment out
#reax_SYSLIB = -lifcore -lsvml -lompstub -limf #comment out
meam_SYSLIB = -lgfortran #added
reax_SYSLIB = -lgfortran #added
(C) generating makefile
make yes-all
make no-gpu #without GPU
(D)at src
“make openmpi” generates executable binary: lmp_openmpi in src.

(9) execution of Lammps
mpirun -np N lmp_openmpi < in.lammps.script #N is a number of MPI process
#see Lammps manual for details.
Life, Love, Laugh.
3楼2010-12-04 23:00:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

傲梅映雪

铁杆木虫 (正式写手)

引用回帖:
3楼: Originally posted by qphll at 2010-12-04 23:00:50
Install Lammps on Mac OS X 10.6 (Snow Leopard) without GPU library.

(1) Mac OS X 10.6.5

(2) Xcode 3.2.x is isntalled.

(3) getting gfortran from http://hpc.sf.net : gfortran-snwleo-intel-bin ...

?????

[ 发自小木虫客户端 ]
4楼2015-03-22 21:46:35
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 qphll 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见