Skip to content
Jim Stone edited this page Sep 1, 2022 · 11 revisions

Due to the large number of options required to manage building AthenaK and Kokkos on different architectures, the code no longer uses a configure script (as in Athena++), but instead adopts cmake (must be version 3.0 or later) to manage builds. In-source builds are not allowed; you must create a new build directory in which cmake can be run, for example:

$ mkdir build
$ cd build

Kokkos provides many options for controlling cmake, see their documentation.

Before running cmake it is important to ensure the correct compilers, cuda toolkits (if required), and MPI libraries (if required) are properly loaded (see Requirements).

The following are useful cmake options frequently used with AthenaK

Building for different architectures

The

Default build for cpu

$ cmake ../

Build for cpu with custom problem generator (located in /src/pgen/name.cpp)

$ cmake -D PROBLEM=name ../

To build in debug mode, add

$ cmake -D CMAKE_BUILD_TYPE=Debug ../

Default build for cpu with MPI

$ cmake -D Athena_ENABLE_MPI=ON ../

Default build for Intel Broadwell cpu with Intel C++ compiler and GCC C compiler

$ cmake -DCMAKE_CXX_COMPILER=icpc -D Kokkos_ARCH_BDW=On -D Kokkos_ENABLE_OPENMP=ON
-D CMAKE_CXX_FLAGS="-O3 -inline-forceinline -qopenmp-simd -qopt-prefetch=4 -diag-disable 3180 "
-D CMAKE_C_FLAGS="-O3 -finline-functions" ../

Default build for NVidia V100 gpu (e.g. cuda at IAS; requires gcc and cudatoolkit)

$ cmake3 -DKokkos_ENABLE_CUDA=On -DKokkos_ARCH_VOLTA70=On -DCMAKE_CXX_COMPILER=${path_to_code}/kokkos/bin/nvcc_wrapper ../

Default build for NVidia A100 gpu (e.g. apollo at IAS; requires gcc and cudatoolkit)

$ cmake3 -DKokkos_ENABLE_CUDA=On -DKokkos_ARCH_AMPERE80=On -DCMAKE_CXX_COMPILER=${path_to_code}/kokkos/bin/nvcc_wrapper ../