Compiling LAMMPS: Difference between revisions
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
Setup environment for using GNU compiler suite, Open MPI, and compilation flags suitable for this cluster and the version of GNU compiler currently installed. | Setup environment for using GNU compiler suite, Open MPI, and compilation flags suitable for this cluster and the version of GNU compiler currently installed. | ||
{{Cmd|source /home/bgo/shared/bin/selector-compiler -gq|source /home/bgo/shared/bin/selector-mpi - | {{Cmd|source /home/bgo/shared/bin/selector-compiler -gq|source /home/bgo/shared/bin/selector-mpi -i gnu-openmpi -fq|export CFLAGS{{=}}"-O3 -pipe --param l1-cache-size{{=}}32 --param l1-cache-line-size{{=}}64 --param l2-cache-size{{=}}15360 -march{{=}}core2 -mcx16 -msahf -mmovbe -maes -mpclmul -mpopcnt -mabm -mbmi -mavx -mtune{{=}}generic"|export CXXFLAGS{{=}}"${CFLAGS}"|export FCFLAGS{{=}}"${CFLAGS}"|export FFLAGS{{=}}"${CFLAGS}"}} | ||
For an explanation of {{C|selector-mpi}} and {{C|selector-compiler}} see [[Initial Setup]]. | For an explanation of {{C|selector-mpi}} and {{C|selector-compiler}}, see [[Selector-mpi]] and [[Initial Setup]]. | ||
== Configure LAMMPS for compilation == | == Configure LAMMPS for compilation == | ||
Line 19: | Line 19: | ||
The {{C|Make.py}} script of LAMMPS requires python2.7. | The {{C|Make.py}} script of LAMMPS requires python2.7. | ||
The python script does not accept | The python script does not accept {{C|CFLAGS}} parameters like {{C|--param l1-cache-line-size{{=}}64}}, and also expects the parameters to NOT have a '-' in front. Therefore, the {{C|CFLAGS}} environmental variable can not be directly used here. | ||
{{Cmd|cd src|python2.7 ./Make.py -png yes -jpg yes -s ffmpeg gzip exceptions -fft fftw3 dir{{=}}/home/bgo/shared/gnu-openmpi -a file -m none -mpi mpi dir{{=}}/home/bgo/shared/gnu-openmpi -cc /home/bgo/shared/gnu-openmpi/bin/mpiCC -flags CCFLAGS add 12 O3 march{{=}}core2 mcx16 msahf mmovbe maes mpclmul mpopcnt mabm mbmi mavx mtune{{=}}generic -j 8|make yes-all|make no-{GPU,KIM,KOKKOS,VORONOI} no-USER-{ATC,AWPMD,OMP,QUIP,H5MD,SMD,VTK} }} | {{Cmd|cd src|python2.7 ./Make.py -png yes -jpg yes -s ffmpeg gzip exceptions -fft fftw3 dir{{=}}/home/bgo/shared/gnu-openmpi -a file -m none -mpi mpi dir{{=}}/home/bgo/shared/gnu-openmpi -cc /home/bgo/shared/gnu-openmpi/bin/mpiCC -flags CCFLAGS add 12 O3 march{{=}}core2 mcx16 msahf mmovbe maes mpclmul mpopcnt mabm mbmi mavx mtune{{=}}generic -j 8|make yes-all|make no-{GPU,KIM,KOKKOS,VORONOI} no-USER-{ATC,AWPMD,OMP,QUIP,H5MD,SMD,VTK} }} | ||
The CFLAGS parameters that could not be specified on the command line can be manually added to {{Path|MAKE/MINE/Makefile.auto}}. | The {{C|CFLAGS}} parameters that could not be specified on the command line can be manually added to {{Path|MAKE/MINE/Makefile.auto}}. | ||
== Compiling LAMMPS Libraries == | == Compiling LAMMPS Libraries == | ||
Line 37: | Line 37: | ||
=== Library === | === Library === | ||
Add {{C|-L/home/bgo/packages/lib}} to FFT_PATH in {{Path|MAKE/MINE/Makefile.auto}} so that libpython2.7.so can be found when linking. Any of the _PATH variables will work, I just chose FFT_PATH because that was closest to where my cursor was at the time! | Add {{C|-L/home/bgo/packages/lib}} to {{C|FFT_PATH}} in {{Path|MAKE/MINE/Makefile.auto}} so that libpython2.7.so can be found when linking. Any of the {{C|*_PATH}} variables will work, I just chose {{C|FFT_PATH}} because that was closest to where my cursor was at the time! | ||
==== Shared Library ==== | ==== Shared Library ==== | ||
Line 46: | Line 46: | ||
{{Cmd|make clean-all|make -j7 mode{{=}}lib auto}} | {{Cmd|make clean-all|make -j7 mode{{=}}lib auto}} | ||
[[Category:Tutorials]] |
Latest revision as of 10:44, 21 April 2017
Instructions and tips on compiling LAMMPS.
Flory.usm.edu
Compiling LAMMPS on flory.usm.edu cluster
Initial setup
Setup environment for using GNU compiler suite, Open MPI, and compilation flags suitable for this cluster and the version of GNU compiler currently installed.
user $
source /home/bgo/shared/bin/selector-compiler -gq
user $
source /home/bgo/shared/bin/selector-mpi -i gnu-openmpi -fq
user $
export CFLAGS="-O3 -pipe --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=15360 -march=core2 -mcx16 -msahf -mmovbe -maes -mpclmul -mpopcnt -mabm -mbmi -mavx -mtune=generic"
user $
export CXXFLAGS="${CFLAGS}"
user $
export FCFLAGS="${CFLAGS}"
user $
export FFLAGS="${CFLAGS}"
For an explanation of selector-mpi and selector-compiler, see Selector-mpi and Initial Setup.
Configure LAMMPS for compilation
The Make.py script of LAMMPS requires python2.7.
The python script does not accept CFLAGS parameters like --param l1-cache-line-size=64, and also expects the parameters to NOT have a '-' in front. Therefore, the CFLAGS environmental variable can not be directly used here.
{{Cmd|cd src|python2.7 ./Make.py -png yes -jpg yes -s ffmpeg gzip exceptions -fft fftw3 dir=/home/bgo/shared/gnu-openmpi -a file -m none -mpi mpi dir=/home/bgo/shared/gnu-openmpi -cc /home/bgo/shared/gnu-openmpi/bin/mpiCC -flags CCFLAGS add 12 O3 march=core2 mcx16 msahf mmovbe maes mpclmul mpopcnt mabm mbmi mavx mtune=generic -j 8|make yes-all|make no-{GPU,KIM,KOKKOS,VORONOI} no-USER-{ATC,AWPMD,OMP,QUIP,H5MD,SMD,VTK} }}
The CFLAGS parameters that could not be specified on the command line can be manually added to MAKE/MINE/Makefile.auto.
Compiling LAMMPS Libraries
user $
python2.7 ./Make.py -j 8 -colvars make=g++ -a lib-colvars
user $
python2.7 ./Make.py -j 8 -meam make=gfortran -a lib-meam
user $
python2.7 ./Make.py -j 8 -poems make=g++ -a lib-poems
user $
python2.7 ./Make.py -j 8 -qmmm make=gfortran -a lib-qmmm
user $
python2.7 ./Make.py -j 8 -reax make=gfortran -a lib-reax
Compiling LAMMPS
Standalone Binary (Executable)
user $
make clean-all
user $
make -j7 auto
user $
cp src/lmp_auto /home/bgo/shared/gnu-openmpi/bin/lmp
Library
Add -L/home/bgo/packages/lib to FFT_PATH in MAKE/MINE/Makefile.auto so that libpython2.7.so can be found when linking. Any of the *_PATH variables will work, I just chose FFT_PATH because that was closest to where my cursor was at the time!
user $
make clean-all
user $
make -j7 mode=shlib auto
Static Library
user $
make clean-all
user $
make -j7 mode=lib auto