-
Notifications
You must be signed in to change notification settings - Fork 1
Installation on Midway3
These are the specific instructions on how to build LAMMPS and lammps-dlext on Midway3.
Load the necessary modules
module load python/anaconda-2021.05 openmpi/4.1.2+gcc-7.4.0 cuda/11.2 cmake/3.19 clang ffmpeg/5.1 fftw3
Activate the pysages3
virtual environment
source activate pysages3
Non-admin users should clone the pysages3 environment instead
conda config --set pip_interop_enabled false # the cloning step below may fail otherwise
conda create --clone pysages3 --prefix=/path/to/pysages3-dev
source activate /path/to/pysages3-dev
Clone the LAMMPS repository
git clone https://github.com/lammps/lammps.git
cd lammps
git checkout stable_23Jun2022 # or any other branch you want to build
Configure LAMMPS with KOKKOS and PYTHON packages, and install LAMMPS to the same location as the pysages3
virtual environment
BUILD_PATH=build
PYTHON_EXECUTABLE=$CONDA_PREFIX/bin/python
INSTALL_PREFIX=$(${PYTHON_EXECUTABLE} -c "import sys; print(sys.prefix)")
cmake -S cmake -B $BUILD_PATH \
-C cmake/presets/most.cmake \
-C cmake/presets/nolib.cmake \
-C cmake/presets/kokkos-cuda.cmake \
-DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-DBUILD_SHARED_LIBS=ON \
-DFFT=KISS \
-DKokkos_ARCH_PASCAL60=OFF \
-DKokkos_ARCH_AMPERE80=ON \
-DLAMMPS_EXCEPTIONS=ON \
-DPKG_MPI=ON \
-DPKG_OPENMP=ON \
-DPython_EXECUTABLE=${PYTHON_EXECUTABLE}
cmake --build $BUILD_PATH --target install -j8
cd $BUILD_PATH
make install-python
If the build succeeds, the shared library liblammps.so is installed into $INSTALL_PREFIX/lib64.
To test the installation of the LAMMPS python module
${PYTHON_EXECUTABLE} -c "from lammps import lammps; p = lammps()"
You can also check if lammps
is listed in the python environment via ${PYTHON_EXECUTABLE} -m pip list
.
Clone the lammps-dlext repository
git clone https://github.com/SSAGESLabs/lammps-dlext.git
cd lammps-dlext
With the same python environment as above active, configure and build lammps-dlext
BUILD_PATH=build
cmake -S . -B $BUILD_PATH -DCMAKE_PREFIX_PATH=$CONDA_PREFIX/lib64/cmake
cmake --build $BUILD_PATH --target install -j4
Alternatively to setting CMAKE_PREFIX_PATH
you can directly set the following:
- The path to
LAMMPS_ROOT
(most likely$CONDA_PREFIX/lib64/cmake/LAMMPS
if you installed LAMMPS as above). - When compiling with Kokkos support, the path to
Kokkos_ROOT
(likely to be$CONDA_PREFIX/lib64/cmake/Kokkos
). See also the Kokkos documentation.
If during compilation you encounter an error stating that dlpack/dlpack.h
cannot be
found, try adding -DFETCH_DLPACK=ON
at the end of the first cmake command above.