(mini)miniPIC uses CMake (version ≥ 3.22) as a build system. For using Kokkos, you have three options (by order of recommendation):
- Using CMake FetchContent
- Using a Git submodule
- Using an installed instance of Kokkos
CMake would download an archive of Kokkos and decompress it in external/kokkos by default.
git clone https://github.com/CExA-project/mini-minipic.gitGit would clone the Kokkos repo in external/kokkos and switch to a stable branch.
git clone --recurse-submodules https://github.com/CExA-project/mini-minipic.gitIf you have cloned without the submodules (i.e. git clone <url of the repo>):
git submodule update --initKokkos would be already installed, either by an administrator or by yourself.
Kokkos installation
git clone --branch <kokkos version> https://github.com/kokkos/kokkos.git
cd kokkos
cmake -B build -DCMAKE_INSTALL_PREFIX=/path/to/kokkos/install <kokkos extra flags>
cmake --build build --parallel
cmake --install buildPlease check the documentation for the Kokkos flags. Note that you need one build (and one installation directory) per backend and architecture.
git clone https://github.com/CExA-project/mini-minipic.gitThen, you would need to tell CMake where to find Kokkos with -DKokkos_ROOT=/path/to/kokkos/install.
Without any option provided, the sequential backend should be used.
cmake -B build
cmake --build build
Building in the root directory is not supported.
By default, the code is compiled with Kokkos serial backend (sequential mode).
Note that you have to add -DKokkos_ROOT=</path/to/kokkos/install> if you use an already installed instance of Kokkos.
CMake generic options:
-DCMAKE_CXX_COMPILER=<compiler choice>: specify the compiler to use;-DCMAKE_BUILD_TYPE=<build type>: specify the build (most commons areDebugandRelease).
Project specific options:
-DMINI_MINIPIC_DEBUG=<ON/OFF>: enable/disable debug messages (OFFby default);-DMINI_MINIPIC_WARNING=<ON/OFF>: enable/disable compiler warnings (add-Wall,-Wextra, and-Wpedantic,OFFby default);-DMINI_MINIPIC_KOKKOS_SCATTER_VIEW=<ON/OFF>: use Kokkos scatter views for projection operator (OFFby default);-DMINI_MINIPIC_IMPLEMENTATION=<implementation>: which implementation to use (exercise,kokkos, or any directory with valid files, default to the former);-DMINI_MINIPIC_SETUP=<setup>: which setup to build and run with (antenna,b_cst,beam,e_cst,thermal, default to the former);-DMINI_MINIPIC_KOKKOS_SOURCE_DIRECTORY=</path/to/kokkos/sources>: Path to the local source directory of Kokkos (default to./external/kokkos).
When getting Kokkos with CMake FetchContent or with a Git submodule, you should pass Kokkos options directly. See the Kokkos CMake options documentation.
cmake -B build
cmake --build build --parallel 10cmake -B build -DCMAKE_CXX_COMPILER=g++ -DKokkos_ENABLE_OPENMP=ON
cmake --build build --parallel 10cmake -B build -DCMAKE_CXX_COMPILER=clang++
cmake --build build --parallel 10cmake -B build -DKokkos_ENABLE_CUDA=ON -DKokkos_ARCH_AMPERE80=ON
cmake --build build --parallel 10When using an already installed instance of Kokkos, you should specify its location to CMake at configuration time. Kokkos options would be automatically transferred.
cmake -B build -DKokkos_ROOT=/path/to/kokkos/install
cmake --build build --parallel 10