LAMMPS 16Mar18 (stable release) for LX with GPU support (gcc)

Webpage

http://lammps.sandia.gov/

Version

16Mar18

Build Environment

  • GCC 5.3.1
  • Intel MKL 2018 Update 2
  • Intel MPI 2017.3.196
  • libjpeg-turbo 1.2.90
  • CUDA 8.0.61

Files Required

  • lammps-stable.tar.gz (16Mar18)
  • (some files are obtained in the following script)

Build Procedure

(2018/7/4: update)

#!/bin/sh

VERSION=16Mar18
INSTALL_PREFIX=/local/apl/lx/lammps${VERSION}-gnu-CUDA8

BASEDIR=/home/users/${USER}/Software/LAMMPS/${VERSION}
LAMMPS_TARBALL=${BASEDIR}/lammps-stable.tar.gz

#WORKDIR=/work/users/${USER}
WORKDIR=/home/users/${USER}/ramdisk
WORKDIR_LAMMPS=${WORKDIR}/lammps-${VERSION}
WORKDIR_LAMMPS_ESC=`echo ${WORKDIR_LAMMPS} | sed -e 's/\//\\\\\//g'`

PARALLEL=12

module purge
module load mkl/2018.0.2
module load mpi/intelmpi/2018.2.199
module load scl/devtoolset-5
module load cuda/8.0

#-- libs

MKLROOT_ESC=`echo /local/apl/lx/intel2018update2/compilers_and_libraries_2018.2.199/linux/mkl | sed -e 's/\//\\\\\//g'`
LATTE_GIT= # latte
LATTEDIR=${WORKDIR_LAMMPS}/lib/latte/LATTE
LATTEDIR_ESC="${WORKDIR_LAMMPS_ESC}\/lib\/latte\/LATTE"
METIS_VER=5.1.0
METIS=http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-${METIS_VER}.tar.gz
BML=https://github.com/lanl/bml.git
PROGRESS=https://github.com/lanl/qmd-progress.git
VMD_PLUGIN_INC=`echo /local/apl/lx/vmd193/lib/plugins/include | sed -e 's/\//\\\\\//g'` # molfile
VORO_VER=0.4.6                                                   # voronoi
VORO=http://math.lbl.gov/voro++/download/dir/voro++-${VORO_VER}.tar.gz

#------------------------------------------------------------------
umask 0022

cd ${WORKDIR}
if [ -d lammps-${VERSION} ]; then
  mv lammps-${VERSION} lammps_erase
  rm -rf lammps_erase &
fi

tar zxf ${LAMMPS_TARBALL}
cd lammps-${VERSION}

# setup makefiles, libraries, and external resources
## main
sed -e "/g++_openmpi =/s/.*/# rccs = Intel MPI, MKL FFT + g++ /" \
    -e "/OMPI_CXX/d" \
    -e "s/^CCFLAGS.*/CCFLAGS =   -g -O3 -fopenmp/" \
    -e "s/^LINKFLAGS.*/LINKFLAGS =   -g -O -fopenmp/" \
    -e "s/DLAMMPS_GZIP/DLAMMPS_GZIP -DLAMMPS_JPEG/" \
    -e "s/^FFT_INC.*/FFT_INC =   -DFFT_FFTW3 -L${MKLROOT_ESC}\/..\/compiler\/lib\/intel64  -m64 -I${MKLROOT_RSC}\/include/" \
    -e "s/^FFT_PATH.*/FFT_PATH =     -L${MKLROOT_ESC}\/lib\/intel64 -Wl,--no-as-needed/" \
    -e "s/^FFT_LIB.*/FFT_LIB =      -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl/" \
    -e "s/^JPG_LIB.*/JPG_LIB =     -ljpeg/" \
    src/MAKE/OPTIONS/Makefile.g++_openmpi > src/MAKE/MINE/Makefile.rccs
## atc
( cd lib/atc && \
  sed -e s/lammps.linalg/lammps.empty/ Makefile.mpic++ > Makefile.rccs && \
  make -f Makefile.rccs -j ${PARALLEL} && \
  cd ../../ )
## awpmd
( cd lib/awpmd && \
  sed -e s/linalg/empty/ Makefile.mpi > Makefile.rccs && \
  make -f Makefile.rccs -j ${PARALLEL} && \
  cd ../../ )
## colvars
( cd lib/colvars && \
  make -f Makefile.mpi -j ${PARALLEL} && \
  cd ../../ )
## gpu
( cd lib/gpu && \
  sed -e "/^CUDA_ARCH/s/arch=sm.*/arch=sm_60/" \
      -e "/^CUDA_LIB/s/$/ -L\\\$(CUDA_HOME)\/lib64\/stubs/" \
      Makefile.linux > Makefile.rccs && \
  make -f Makefile.rccs -j ${PARALLEL} && \
  sed -i -e "/^gpu_SYSPATH/s/$/ -L\\\$(CUDA_HOME)\/lib64\/stubs/" \
      Makefile.lammps && \
  cd ../../ )
## h5md
( cd lib/h5md && \
  make -f Makefile.mpi -j ${PARALLEL} && \
  cd ../../ )
## latte (make jobserver not available?)
## METIS, BML, and (qmd-)PROGRESS are also built
( cd lib/latte && \
  git clone ${LATTE_GIT} && \
    cd LATTE && \
    wget ${METIS} && \
    tar zxf metis-${METIS_VER}.tar.gz && \
    cd metis-${METIS_VER} && \
    make config prefix=../../install && \
    make install && \
    cd ../ && \
    git clone ${BML} && \
    cd bml && \
    EXTRA_CFLAGS="-fPIC" EXTRA_FFLAGS="-fPIC" sh example_build.sh && \
    cd build/ && \
    make && \
    make install && \
    cd ../../ && \
    git clone ${PROGRESS} && \
    cd qmd-progress && \
    EXTRA_FCFLAGS="-fPIC" EXTRA_LINK_FLAGS="-fPIC" CMAKE_PREFIX_PATH=${LATTEDIR}/metis-5.1.0/install PROGRESS_GRAPHLIB=yes PKG_CONFIG_PATH=${LATTEDIR}/bml/install/lib64/pkgconfig ./build.sh configure && \
    cd build/ && \
    make && \
      cd src/ && \
      gcc -DGLOBAL_DEBUG=PROGRESS_LOG_DEBUG \
          -DMETIS_INDEX_KIND=4 \
          -DMETIS_REAL_KIND=0d0 \
          -O3 -DNDEBUG -fPIC \
          -I${LATTEDIR}/bml/install/include \
          -fopenmp \
          -o CMakeFiles/progress.dir/prg_memory_consumption.c.o \
          -c ${LATTEDIR}/qmd-progress/src/prg_memory_consumption.c && \
      cd ../ && \
    make install && \
    cd ../../ && \
    sed -i -e "s/fopenmp/fopenmp -fPIC/" \
           -e "s/^LIB =.*/LIB = -L${MKLROOT_ESC}\/lib\/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl/" \
           -e "s/^METIS =.*/METIS = ON/" \
           -e "s/^PROGRESS =.*/PROGRESS = ON/" \
           -e "s/.(HOME)/${LATTEDIR_ESC}/" \
           -e "s/metis\///" \
           -e "s/install\/lib/install\/lib64/" \
           makefile.CHOICES && \
    make && \
    cd ../ && \
  ln -s LATTE/src includelink && \
  ln -s LATTE liblink && \
  ln -s LATTE/src/latte_c_bind.o filelink.o && \
  echo "latte_SYSINC = -I../../lib/latte/LATTE/src -I../../lib/latte/LATTE/bml/install/include -I../../lib/latte/LATTE/qmd-progress/install/include" > Makefile.lammps && \
  echo "latte_SYSLIB = -fopenmp ../../lib/latte/filelink.o -llatte -L../../lib/latte/LATTE/qmd-progress/install/lib64 -lprogress -L../../lib/latte/LATTE/bml/install/lib64 -lbml_fortran -lbml -L../../lib/latte/LATTE/metis-5.1.0/install/lib -lmetis" >> Makefile.lammps && \
  echo -n "latte_SYSPATH = -fopenmp" >> Makefile.lammps && \
  cd ../../ )
## meam
( cd lib/meam && \
  sed -e s/mpifort/mpif90/ Makefile.mpi > Makefile.rccs && \
  make -f Makefile.rccs -j ${PARALLEL} && \
  cd ../../ )
## molfile
#### plugin location: /local/apl/lx/vmd193/lib/plugins/LINUXAMD64/molfile
( cd lib/molfile && \
  sed -i -e "s/molfile_SYSINC.*/molfile_SYSINC =-I$VMD_PLUGIN_INC/" Makefile.lammps && \
  cd ../../ )
## poems
( cd lib/poems && \
  make -f Makefile.g++ -j ${PARALLEL} && \
  cd ../../ )
## reax
( cd lib/reax && \
  make -f Makefile.gfortran -j ${PARALLEL} && \
  cd ../../ )
## voronoi
( cd lib/voronoi && \
  wget ${VORO} && \
  tar zxf voro++-${VORO_VER}.tar.gz && \
    cd voro++-${VORO_VER} && \
    sed -i -e "s/^CFLAGS=.*/CFLAGS=-Wall -ansi -pedantic -fPIC/" config.mk && \
    make -j ${PARALLEL} && \
    cd ../ && \
  ln -s voro++-${VORO_VER}/src includelink && \
  ln -s voro++-${VORO_VER}/src liblink && \
  cd ../../ )

#----

# now make lammps
cd src
make yes-all no-ext
make no-KOKKOS \
     yes-GPU \
     no-LATTE \
     yes-VORONOI \
     yes-USER-H5MD \
     yes-USER-MOLFILE \
     yes-USER-NETCDF
make -j ${PARALLEL} rccs
make -j ${PARALLEL} rccs mode=shlib
cd ../

# mkdir and install files
mkdir -p ${INSTALL_PREFIX}/src
cp src/lmp_rccs src/liblammps_rccs.so src/*.h ${INSTALL_PREFIX}/src
ln -s ${INSTALL_PREFIX}/src/liblammps_rccs.so ${INSTALL_PREFIX}/src/liblammps.so
cp -r LICENSE \
      README \
      bench/ \
      doc/ \
      examples/ \
      potentials/ \
      python/ \
      tools/ \
   ${INSTALL_PREFIX}
cp lib/h5md/LICENSE ${INSTALL_PREFIX}/LICENSE-h5md
cp lib/voronoi/voro++-${VORO_VER}/LICENSE ${INSTALL_PREFIX}/LICENSE-voro++

## latte extra
#mkdir -p ${INSTALL_PREFIX}/lib/latte/LATTE
#cp -r lib/latte/LATTE/{LICENSE_GPL-2.0,latte.in,MATRIX,Manual,Restarts,TBparam,animate,examples,tests,tools} ${INSTALL_PREFIX}/lib/latte/LATTE

#mkdir -p ${INSTALL_PREFIX}/lib/latte/LATTE/bml
#cp -r lib/latte/LATTE/bml/{LICENSE.md,install,examples} ${INSTALL_PREFIX}/lib/latte/LATTE/bml

#mkdir -p ${INSTALL_PREFIX}/lib/latte/LATTE/metis-${METIS_VER}
#cp -r lib/latte/LATTE/metis-${METIS_VER}/{LICENSE.txt,install} ${INSTALL_PREFIX}/lib/latte/LATTE/metis-${METIS_VER}

#mkdir -p ${INSTALL_PREFIX}/lib/latte/LATTE/qmd-progress
#cp -r lib/latte/LATTE/qmd-progress/{LICENSE.md,install,examples} ${INSTALL_PREFIX}/lib/latte/LATTE/qmd-progress

List of Packages

ASPHERE, BODY, CLASS2, COLLOID, COMPRESS, CORESHELL, DIPOLE, GPU, GRANULAR
KSPACE, LATTE, MANYBODY, MC, MEAM, MISC, MOLECULE, MPIIO, OPT, PERI, POEMS
PYTHON, QEQ, REAX, REPLICA, RIGID, SHOCK, SNAP, SRD, VORONOI

USER-ATC, USER-AWPMD, USER-CGDNA, USER-CGSDK, USER-COLVARS,
USER-DIFFRACTION, USER-DPD, USER-DRUDE, USER-EFF, USER-FEP,
USER-H5MD, USER-INTEL, USER-LB, USER-MANIFOLD, USER-MEAMC,
USER-MESO, USER-MGPT, USER-MISC, USER-MOLFILE, USER-NETCDF,
USER-OMP, USER-PHONON, USER-QTB, USER-REAXC, USER-SMTBQ,
USER-SPH, USER-TALLY, USER-UEF

Tests

  • The results of the tests were equivalent to the no-GPU version tests, so skipped here. Please check this page for detail.
  • GPU test was performed with in.rhodo sample in bench/ directory. (The same one can be found in samples/.)

Notices

  • Files installed in /local/apl/lx/lammps16Mar18-gnu-CUDA8/. (can also be accessed from /local/apl/lx/lammps16Mar18-gnu-CUDA)
  • Exe file (lmp_rccs) and LAMMPS library can be found in src/. (There is also a symbolic link to that dir: bin/.)
  • Sample job scripts are available in samples/ directory.
  • Python module files are copied to python/ directory.
  • LAMMPS header files in src/ directory are also copied in src/ directory.
  • vmd molfile plugin files are available in /local/apl/lx/vmd193/lib/plugins/LINUXAMD64/molfile directory.

Changelog

  • (2018/7/4) LAMMPS and LATTE licenses are (GPL v2 OR LATER), so there is no problem.
  • (2018/7/3) LATTE was removed from the installation due to the license conflict between METIS (Apache License 2.0; used in LATTE) and LAMMPS (GPL v2). While LATTE might be installed without METIS, we are not planning to build that version of LAMMPS for now.