-
Notifications
You must be signed in to change notification settings - Fork 50
Build CPU
The following shows how to build a simple working version of Cabana that operates on CPU.
If you prefer to use an existing install of Kokkos, skip this step and move to building Cabana.
Please note, you can also obtain Kokkos from spack if desired.
To build Kokkos manually:
# TODO: YOU, THE USER, SHOULD CHANGE THIS TO YOUR DESIRED PATH
export KOKKOS_INSTALL_DIR=$KOKKOS_SRC_DIR/build/install
cd ./kokkos
mkdir build
cd build
cmake \
-D CMAKE_BUILD_TYPE="Release" \
-D CMAKE_INSTALL_PREFIX=$KOKKOS_INSTALL_DIR \
-D Kokkos_ENABLE_OPENMP=ON \
-D Kokkos_ENABLE_SERIAL=ON \
.. ;
make install
cd ../.. # Go back to top level dir
See kokkos/BUILD.md
for further options and optimization flags for your specific architecture.
Cabana will be built with any of the parallel backends that Kokkos was built with (e.g. Serial, OpenMP, Pthread, and CUDA). The REQUIRE
options ensure a given backend desired for Cabana was built for Kokkos.
The core library is always enabled, while the grid subpackage is enabled by default if MPI is available. Examples, unit tests, and performance tests are available, but not enabled by default. Note that Cabana is now a header-only library.
# TODO: YOU, THE USER, SHOULD CHANGE THESE TO YOUR DESIRED PATHS
export KOKKOS_INSTALL_DIR=`pwd`/kokkos/build/install
export CABANA_INSTALL_DIR=`pwd`/Cabana/build/install
cd ./Cabana
mkdir build
cd build
cmake \
-D CMAKE_BUILD_TYPE="Debug" \
-D CMAKE_PREFIX_PATH=$KOKKOS_INSTALL_DIR \
-D CMAKE_INSTALL_PREFIX="$CABANA_INSTALL_DIR" \
-D Cabana_REQUIRE_OPENMP=ON \
-D Cabana_ENABLE_EXAMPLES=ON \
-D Cabana_ENABLE_TESTING=ON \
-D Cabana_ENABLE_PERFORMANCE_TESTING=OFF \
-D Cabana_ENABLE_GRID=ON \
.. ;
make install
To build an optimized version of Cabana change CMAKE_BUILD_TYPE
from Debug
to Release
.
If you want to set additional compiler options (such as asking the compiler to do platform specific optimizations or generate detailed warnings), as with any cmake
application, you can use the variable CMAKE_CXX_FLAGS
. An example of this looks like:
-D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic"
Cabana - A Co-Designed Library for Exascale Particle Simulations