Skip to content
Jim Stone edited this page Aug 30, 2022 · 11 revisions

The code uses cmake to manage builds. In-source builds are not allowed; you must create a new build directory:

$ mkdir build
$ cd build

Then run cmake (version 3.0 or later) for the specific target architecture in the build subdirectory as follows:

Default build for cpu

$ cmake3 ../

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

$ cmake3 -D PROBLEM=name ../

To build in debug mode, add

$ cmake3 -D CMAKE_BUILD_TYPE=Debug ../

Default build for cpu with MPI

$ cmake3 -D Athena_ENABLE_MPI=ON ../

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

$ cmake3 -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 ../