Compiling LAMMPS
LAMMPS is a classical molecular dynamics code, and an acronym for Large-scale Atomic/Molecular Massively Parallel Simulator.[1]
These are instructions for compiling LAMMPS 31Mar2017. These instructions may not work for any other version. Proteus has some version(s) installed: see LAMMPS
It is important to understand the LAMMPS build procedure. Consult the official documentation.[2]
Installing Pre-compiled Version♯
Use the Conda method documented here: https://docs.lammps.org/Install_conda.html
Basic Outline♯
This is a basic outline of the old Makefile-based build process.
- Build a "basic" LAMMPS (i.e. without any "packages", standard or
user). This basic LAMMPS can be serial or OMP (multithreaded) or
MPI. E.g.
make mpi
- If the basic build is successful, add packages:
make yes-
package_name
- And recompile:
make mpi
- If using a package causes a build failure, you can try to fix it
yourself, or remove the package:
make no-
package_name
The Cmake build process is recommended for newer versions of LAMMPS. It is much more straightforward. See below.
Source Code♯
Download a tarball from: http://lammps.sandia.gov/download.html#tar
You may also use svn or git to download updates. See instructions elsewhere at the download link above.
The official git repository as of Oct 2016 is https://github.com/lammps/lammps
Intel Composer XE 2015.1.133 + OpenMPI 1.8.1 + Python 3.6.x♯
In addition to the official LAMMPS build documentation, you must be familiar with the Intel Link Line Advisor:
https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
We will use the Intel MKL and its FFTW3 interface. We will build a hybrid MPI-OpenMP executable, i.e. each MPI process will run multithreaded. The total number of separate MPI processes will be fewer than a pure MPI executable, but each MPI process will run more than one thread so that the total number of computational threads is constant.
Environment for Intel Composer XE♯
Load these modules:
shared
proteus
gcc/4.8.1
sge/univa
intel/composerxe/2015.1.133
proteus-openmpi/intel/2015/1.8.1-mlnx-ofed
python/intel/2015/3.6.2
Other modules will be loaded automatically by the ones above.
For convenience, we define an environment variable for the top level of the LAMMPS source code distribution.
export LAMMPS_SRC=~/src/lammps-16Feb16
Proteus-specific Makefile for Intel Composer XE♯
Download the Proteus-specific makefile from LAMMPS_Makefile.proteus-intel.txt.
and save it to the directory
$LAMMPS_SRC/src/MAKE/MINE/ (you may have to create this directory -- "cd MAKE ; make MINE" )
with the name Makefile.proteus-intel
Makefile Snippet for Python 3.x Integration♯
The distributed makefile snippet for Python integration does not work with a shared Python library. Download the makefile snippet from LAMMPS_Makefile.lammps-python3.txt
if you want to use Python integration. Save it to the directory
$LAMMPS_SRC/lib/python/
with the name Makefile.lammps
Build with Intel Composer XE♯
First, build a "basic" version:
[juser@proteusi01 ~]$ cd $LAMMPS_SRC/src
[juser@proteusi01 src]$ make -j 4 proteus-intel >> Make.proteus-intel.out 2>&1 &
Then, add packages, and build incrementally:[3]
[juser@proteusi01 src]$ make yes-python
Installing package python
[juser@proteusi01 src]$ make -j 4 proteus-intel >> Make.proteus-intel.out 2>&1 &
The pattern is to do:
make yes-PACKAGENAME
make -j 4 proteus-intel >> Make.proteus-intel.out 2>&1 &
for whatever "package" you wish to include. The order of build is significant: this ordering may or may not be documented.
And the following packages in order -- the USER-OMP package must be last (n.b. the package OPT seems to cause build errors):
misc
manybody
mpiio
user-intel
user-omp
The resulting executable will be:
$LAMMPS_SRC/src/lmp_proteus-intel
GCC 4.8.1 + Open MPI 1.8.1 + Python 2.7.x♯
The basic outline is the same as for building with Intel Composer XE. The makefile is different to handle:
- different base compiler
- generic FFTW3 library
Environment for GCC♯
Load these modules:
gcc/4.8.1
proteus-openmpi/gcc/64/1.8.1-mlnx-ofed
proteus-fftw3/gcc/64/3.3.3
python/2.7-current
Proteus-specific Makefile for GCC♯
Download the Proteus-specific makefile from LAMMPS_Makefile.proteus-gcc.txt.
and save it to the directory
$LAMMPS_SRC/src/MAKE/MINE/ (you may have to create this directory -- "cd MAKE ; make MINE" )
with the name Makefile.proteus-gcc
Makefile snippet for Python 2.7 integration♯
This is the same as for the Intel compilation.
The distributed makefile snippet for Python integration does not work with a shared Python library. Download the makefile snippet from LAMMPS_Makefile.lammps-python2.txt.
if you want to use Python integration. Save it to the directory
$LAMMPS_SRC/lib/python/
with the name Makefile.lammps
Build with GCC♯
First, build a "basic" version:
[juser@proteusi01 ~]$ cd $LAMMPS_SRC/src
[juser@proteusi01 src]$ make -j 4 proteus-gcc >> Make.proteus-gcc.out 2>&1 &
Then, add packages, and build incrementally:[4]
[juser@proteusi01 src]$ make yes-python
Installing package python
[juser@proteusi01 src]$ make -j 4 proteus-gcc >> Make.proteus-gcc.out 2>&1 &
The pattern is to do:
make yes-PACKAGENAME
make -j 4 proteus-gcc >> Make.proteus-gcc.out 2>&1 &
for whatever "package" you wish to include. The order of build is significant: this ordering may or may not be documented.
And the following packages in order -- the USER-OMP package must be last (n.b. the package OPT seems to cause build errors):
misc
manybody
mpiio
user-omp
The resulting executable will be:
$LAMMPS_SRC/src/lmp_proteus-gcc
GCC 4.8.1 + CUDA 6.0♯
We have not yet been successful in getting a CUDA-enabled build. If you wish to work on this, see the relevant official documentation:
- http://lammps.sandia.gov/doc/accelerate_gpu.html
- http://lammps.sandia.gov/doc/accelerate_kokkos.html
The GPU package and the Kokkos package seem to be mutually exclusive. The Kokkos "package" is unlike the usual "USER" packages: it seems to directly modify the base Makefiles. Our recommendation is to not use Kokkos, for now.
Environment♯
You may need to set the CUDA_HOME environment variable.
Packages♯
- gpu
- omp
- misc
- mpiio
- manybody
- python
lib/gpu/Nvidia.makefile♯
Has to be modified to include the full path to the bin2c
executable:
BIN2C = /cm/shared/apps/cuda60/toolkit/6.0.37/bin/bin2c
GCC 4.8.1 + CUDA 9.0♯
Use Cmake.
Intel Composer XE 2019u1♯
For building on the new (ic23) Skylake nodes. Use Cmake.
Modules Needed♯
The GCC modulefile is needed because Intel C++ relies on GCC's C++ library.
gcc/7.4.0
intel/composerxe/2019u1
proteus-openmpi/intel/2019/3.1.4
zlib/cloudflare/intel/2019/1.2.8
For Python, use the one in /usr/local:
/usr/local/bin/python3
Using Cmake♯
LAMMPS now provides a Cmake build system. To try it out:
module load cmake
cd lammps-stable_16Mar2018/cmake
mkdir BUILD
cd BUILD
ccmake ../cmake
and adjust the configuration.
Intel Composer XE CFLAGS to optimize for architecture of build host:
-O3 -xHost
For the CPU version, make sure to turn on both
BUILD_OMP
PKG_USER-OMP
See: https://sourceforge.net/p/lammps/mailman/message/36704824/
FIXME? INTEL_LRT_MODE=none
Official documentation (sparse): https://lammps.sandia.gov/doc/Build_cmake.html
Axel Kohlmeyer recommends using GCC instead of Intel compilers.
Writing Your Own Makefile♯
Currently, it is not difficult to create your own makefile. Just use one
of the existing examples in the distribution, in the directory
src/MAKE/OPTIONS/
. The directory src/MAKE/MACHINES/
contains
makefiles for various existing supercomputer facilities. Start with a
sample that already works. You can test if it works by running "make
sample" in the src
directory.
- Create the directory
src/MAKE/MINE
- Copy one of the examples to
src/MAKE/MINE
, renaming it, say, toMakefile.myname
- Modify the first line of
Makefile.myname
to set a description of the makefile
# myname = MYNAME by My Name
- Modify at least these definitions and maybe others (e.g. FFT):
CC
OPTFLAGS
CCFLAGS
LINK
-- generally set to be the same asCC
MPI_INC
Running♯
The section on running LAMMPS and benchmarking has been moved to LAMMPS - Running
See Also♯
- LAMMPS - see the Running section for details
- Old (2013) example makefile for using IntelMKL
References♯
[2] LAMMPS User Documentation - Getting Started