CMake Keywords#
Important
With version 3.0 all Kokkos CMake keywords are prefixed with Kokkos_ which is case-sensitive.
Recall that to set a keyword in CMake you used the syntax -Dkeyword_name=value
.
Note
The ccmake
graphical user interface offers a convenient way to explore
available CMake options and their current values. It may be more up to date
with the Kokkos version that you are using.
A word of warning: variables with names containing IMPL
are private
implementation details. Avoid modifying these unless you have a deep
understanding of their implications and are aware that they might change
without notice.
This page is organized in four sections:
Backend selection#
Default State: All backends are disabled by default. This ensures you explicitly choose the backends you need for your specific hardware setup. If no backend is enabled explicitly, the Serial backend will be enabled.
Enabling Backends:
You can enable backends by configuring with -DKokkos_ENABLE_<BACKEND>=ON
flag, where <BACKEND>
is replaced with the specific backend you want to
enable (e.g. -DKokkos_ENABLE_CUDA=ON
for CUDA).
- Restrictions:
Mutual Exclusion: You can only have one device backend (e.g., CUDA, HIP, SYCL) and one host parallel backend (e.g., OpenMP, C++ threads) enabled at the same time. This is because these backends manage parallelism in potentially conflicting ways.
Host Backend Requirement: At least one host backend must always be enabled. This is because Kokkos code execution typically starts on the host (CPU) before potentially being offloaded to devices (GPUs, accelerators). If you don’t explicitly enable a host backend, Kokkos will automatically enable the Serial backend, which provides a sequential execution model.
Serial backend#
Description/info |
|
---|---|
|
To build the Serial backend targeting CPUs |
Host parallel backends#
Description/info |
|
---|---|
|
To build the OpenMP backend targeting CPUs |
|
To build the C++ Threads backend |
|
[Experimental] To build the HPX backend |
Device backends#
Description/info |
|
---|---|
|
To build the CUDA backend targeting NVIDIA GPUs |
|
To build the HIP backend targeting AMD GPUs |
|
To build the SYCL backend targeting Intel GPUs |
|
[Experimental] To build the OpenMP Target backend for offloading to accelerator devices |
|
[Experimental] To build the OpenACC backend for offloading to accelerator devices |
Options#
General options#
Description/info |
Default |
|
---|---|---|
|
Build benchmarks |
|
|
Build examples |
|
|
Build tests |
|
|
Enable deprecated code in the Kokkos 3.x series [Removed in 4.3] |
|
|
Enable deprecated code in the Kokkos 4.x series |
|
|
Whether to raise warnings at compile time when using deprecated Kokkos facilities |
|
|
Create bindings for tuning tools |
|
|
Aggressively vectorize loops |
|
Debugging#
Description/info |
Default |
|
---|---|---|
|
Activate extra debug features - may increase compile times |
|
|
Use bounds checking - will increase runtime |
|
|
Debug check on dual views |
|
Backend-specific options#
Description/info |
Default |
|
---|---|---|
|
Activate experimental relaxed constexpr functions |
|
|
Activate experimental lambda features |
(see below) |
|
Enable relocatable device code (RDC) for CUDA |
|
|
Use unified memory (UM) by default for CUDA |
|
|
Use |
(see below) |
|
Instantiate multiple kernels at compile time - improve performance but increase compile time |
|
|
Enable relocatable device code (RDC) for HIP |
|
|
Enable relocatable device code (RDC) for SYCL (since Kokkos 4.5) |
|
|
Disable atomics when no host parallel nor device backend is enabled for Serial only builds (since Kokkos 4.3) |
|
|
Enable asynchronous dispatch for the HPX backend |
|
Kokkos_ENABLE_CUDA_LAMBDA
default value is OFF
until 3.7 and ON
since 4.0
Kokkos_ENABLE_IMPL_CUDA_MALLOC_ASYNC
default value is OFF
except in 4.2, 4.3, and 4.4
Development#
These are intended for developers of Kokkos. If you are a user, you probably should not be setting these.
Description/info |
Default |
|
---|---|---|
|
Print all compiler warnings |
|
|
Check that headers are self-contained |
|
|
Perform extra large memory tests |
|
Third-party Libraries (TPLs)#
The following options control enabling TPLs:
Description/info |
Default |
Notes |
|
---|---|---|---|
|
Whether to enable the HWLOC library |
|
|
|
Whether to enable the LIBDL library |
|
|
|
Whether to enable the oneDPL library when using the SYCL backend |
|
|
|
Whether to enable the rocThrust library when using the HIP backend |
|
(since Kokkos 4.3) |
The following options control finding and configuring non-CMake TPLs:
Description/info |
Default |
|
---|---|---|
|
Location of CUDA install prefix for libraries |
PATH Default: |
|
Location of HWLOC install prefix |
PATH Default: |
|
Location of LIBDL install prefix |
PATH Default: |
The following options control find_package
paths for CMake-based TPLs:
Description/info |
Default |
|
---|---|---|
|
Location of HPX prefix (ROOT) or CMake config file (DIR) |
PATH Default: |
Architectures#
CPU architectures#
Kokkos does not automatically add or need compiler flags to optimize for a specific CPU architecture. Nevertheless, targeting a specific architecture allows the compiler to use SIMD instructions on the CPU. When compiling on the machine that the code also runs on, the easiest way to get the CPU code optimized is using the native option.
Description/info |
|
---|---|
|
Target the architecture of the compiling CPU ( |
If cross-compiling, or if you want to be specific, the CPU architecture can be passed to Kokkos manually. For the available architectures see the following list.
CMake keyword |
Architecture/Instruction set |
Examples |
Notes |
---|---|---|---|
|
Zen 4/amd64 |
Epyc Genoa @ LLNL El Capitan |
(since Kokkos 4.6) |
|
Zen 3/amd64 |
Epyc 7713 @ ORNL Frontier |
|
|
Zen 2/amd64 |
Epyc 7742 @ NOAA |
|
|
Zen/amd64 |
Epyc @ ANL Selene |
|
|
Bullozer/amd64 |
CMake keyword |
Architecture/Instruction set |
Examples |
Notes |
---|---|---|---|
|
ARMv9-A/A64/neoverse-v2 |
GH200 @ CSCS ALPS |
(since Kokkos 4.4.1) |
|
ARMv8.2/A64 |
A64FX @ Fugaku |
|
|
ARMv8/A64 |
ThunderX2 @ SNL Astra ThunderX2 @ CEA BullSequana |
|
|
ARMv8.1/A64,A32 |
||
|
ARMv8/A64 |
||
|
ARMv8.0/A64,A32 |
CMake keyword |
Architecture/Instruction set |
Examples |
---|---|---|
|
Power9/Power ISA |
POWER9 @ ORNL Summit POWER9 @ LLNL Sierra |
|
Power8/Power ISA |
CMake keyword |
Architecture/Instruction set |
Examples |
---|---|---|
|
Sapphire Rapids/x86-64 |
Xeon 9470C @ ANL Aurora Xeon @ LANL Crossroads |
|
Skylake/x86-64 |
6130 @ OSU Pete |
|
Haswell/x86-64 |
2680v3 @ NASA Pleiades |
|
Broadwell/x86-64 |
2680v4 @ NASA Pleiades |
|
Knights Landing/x86-64 |
31S1P @ Tianhe-2 |
|
Knights Corner/x86-64 |
|
|
Sandy Bridge/x86-64 |
CMake keyword |
Architecture/Instruction set |
Examples |
Notes |
---|---|---|---|
|
RVA22V/RISC-V ISA |
SpacemiT K1 |
(since Kokkos 4.5) |
|
SG2042/RISC-V ISA |
Milk-V Pioneer |
(since Kokkos 4.3) |
GPU Architectures#
NVIDIA GPUs#
The Kokkos naming convention is to aggregate the eponym of the Nvidia GPU microarchitecture and the associated CUDA Compute Capability.
Kokkos_ARCH_<MICROARCHITECTURE><COMPUTE_CAPABILITY>
If the CUDA backend is enabled and no NVIDIA GPU architecture is specified, Kokkos will attempt to autodetect the architecture flag at configuration time.
NVIDIA GPUs |
Architecture |
Compute Capability |
Models |
Notes |
---|---|---|---|---|
|
Hopper |
9.0 |
H100 |
(since Kokkos 4.0) |
|
Ada Lovelace |
8.9 |
L4, L40 |
(since Kokkos 4.1) |
|
Ampere |
8.6 |
A40, A10, A16, A2 |
|
|
Ampere |
8.0 |
A100, A30 |
|
|
Turing |
7.5 |
T4 |
|
|
Volta |
7.2 |
||
|
Volta |
7.0 |
V100 |
|
|
Pascal |
6.1 |
P40, P4 |
|
|
Pascal |
6.0 |
P100 |
|
|
Maxwell |
5.3 |
||
|
Maxwell |
5.2 |
M60, M40 |
|
|
Maxwell |
5.0 |
||
|
Kepler |
3.7 |
K80 |
|
|
Kepler |
3.5 |
K40, K20 |
|
|
Kepler |
3.2 |
||
|
Kepler |
3.0 |
K10 |
AMD GPUs#
The Kokkos naming convention is to aggregate AMD_ and the architecture flag.
Kokkos_ARCH_AMD_<ARCHITECTURE_FLAG>
If the HIP backend is enabled and no AMD GPU architecture is specified, Kokkos will attempt to autodetect the architecture flag at configuration time.
AMD GPUs |
Architecture flags |
Models |
Notes |
---|---|---|---|
|
GFX942 |
MI300A |
(since Kokkos 4.5) |
|
GFX942 |
MI300A, MI300X |
(since Kokkos 4.2, since Kokkos 4.5 this should only be used for MI300X) |
|
GFX940 |
MI300A (pre-production) |
(since Kokkos 4.2.1) |
|
GFX90A |
MI200 series |
(since Kokkos 4.2) |
|
GFX90A |
MI100 |
(since Kokkos 4.2) |
|
GFX906 |
MI50, MI60 |
(since Kokkos 4.2) |
|
GFX1103 |
Ryzen 8000G Phoenix series APU |
(since Kokkos 4.5) |
|
GFX1100 |
7900xt |
(since Kokkos 4.2) |
|
GFX1030 |
V620, W6800 |
(since Kokkos 4.2) |
|
GFX90A |
MI200 series |
Prefer |
|
GFX908 |
MI100 |
Prefer |
|
GFX906 |
MI50, MI60 |
Prefer |
|
GFX900 |
MI25 |
removed in 4.0 |
Intel GPUs#
CMake option |
Architecture |
Models |
---|---|---|
|
Xe-HPC (Ponte Vecchio) |
Intel Data Center GPU Max 1550 |
|
Xe-HP |
|
|
Iris Xe MAX (DG1) |
|
|
Gen12LP |
Intel UHD Graphics 770 |
|
Gen11 |
Intel UHD Graphics |
|
Gen9 |
Intel HD Graphics 510, Intel Iris Pro Graphics 580 |
|
Just-In-Time compilation* |
* Kokkos_ARCH_INTEL_GEN
enables Just-In-Time compilation for Intel GPUs
whereas all the other flags for Intel compilers request Ahead-Of-Time
compilation.
Just-In-Time (JIT) compilation means that the compiler is invoked again when the binaries created are actually executed and only at that point the architecture to compile for is determined.
On the other hand, Ahead-Of-Time (AOT) compilation describes the standard model where the compiler is only invoked once to create the binary and the architecture to compile for is determined before the program is run.