Skip to content

Build instructions

Sam Reeve edited this page Apr 14, 2021 · 11 revisions

The following shows how to build, configure, and test CabanaMD.

Dependencies

CabanaMD has the following dependencies:

Dependency Version Required Details
CMake 3.11+ Yes Build system
MPI GPU Aware if CUDA Enabled Yes Message Passing Interface
Kokkos 3.2.0 Yes Provides portable on-node parallelism
Cabana master Yes Performance portable particle algorithms
CUDA 9+ No Programming model for NVIDIA GPUs
HIP 3.5+ No Programming model for AMD GPUs
ArborX master No Performance portable geometric search
libnnp 2.0.1 No Neural network potential

Build Kokkos, followed by Cabana: https://github.com/ECP-copa/Cabana/wiki/Build-Instructions

Build instructions are available for both CPU and GPU. Note that Cabana must be compiled with Cajita and MPI.

Obtaining CabanaMD

Clone the master branch:

   git clone https://github.com/ECP-copa/CabanaMD.git

CPU Build

After building Kokkos and Cabana for CPU:

# Change directories as needed
export KOKKOS_DIR=$HOME/kokkos
export CABANA_DIR=$HOME/Cabana

cd ./CabanaMD
export CBNMD_INSTALL_DIR=`pwd`/build/install
mkdir build
cd build
pwd
cmake \
    -D CMAKE_PREFIX_PATH="$CABANA_DIR" \
    -D CMAKE_INSTALL_PREFIX=$CBNMD_INSTALL_DIR \
    \
    .. ;
make install
cd ../../

CabanaMD will build for all Kokkos enabled backends. The vector length flag sets the Cabana::AoSoA vector length for all particle properties.

GPU Build

After building Kokkos and Cabana for GPU: https://github.com/ECP-copa/Cabana/wiki/Build-Instructions#GPU-Build

the GPU build is identical to that above except the options passed to CMake:

cmake \
    -D CMAKE_CXX_COMPILER=$KOKKOS_SRC_DIR/bin/nvcc_wrapper \
    -D CMAKE_PREFIX_PATH="$CABANA_DIR" \
    -D CMAKE_INSTALL_PREFIX=$CBNMD_INSTALL_DIR \
    \
    .. ;

Optional data layouts

It is possible to change the data layouts of the per-atom properties at compile time. This includes the number of properties per Cabana AoSoA and the vector length for each AoSoA; these options are controlled with CabanaMD_LAYOUT and CabanaMD_VECTORLENGTH, respectively. The former must be 1, 2, or 6, while the latter must be an integer power of 2 (either a list with one per AoSoA or one value used for all).

    -D CabanaMD_LAYOUT=2 \
    -D CabanaMD_VECTORLENGTH="1;32" \

Optional neural network potential build

If using the optional neural network potential, the n2p2 library (https://github.com/CompPhysVienna/n2p2) must be compiled first (see instructions here: https://compphysvienna.github.io/n2p2/Interfaces/if_cabanamd.html) Additional CMake flags for the location of the n2p2 library and enabling the potential are needed (with additional optional vector length setting and maximum symmetry function preallocation setting):

    -D N2P2_DIR=$N2P2_DIR \
    -D CabanaMD_ENABLE_NNP=ON \
    -D CabanaMD_VECTORLENGTH_NNP=1 \
    -D CabanaMD_MAXSYMMFUNC_NNP=30 \

Optional ArborX neighbor list build

If using the optional ArborX library (https://github.com/arborx/ArborX), it must be enabled in the Cabana build.

Build, Test, and Install

Once configured, build and install CabanaMD with:

   make -j $BUILD_NUM_THREADS
   make install

Ensure installation by checking the installed libraries an headers in CBNMD_INSTALL_DIR. If tests are enable you can run the CabanaMD unit test suite with:

cd build
ctest