Macros#
Function Markup Macros#
Version Macros#
Version integer macros |
Example value assuming Kokkos version 4.2.1 |
---|---|
|
|
|
|
|
|
|
|
Kokkos version macros are defined as integers.
KOKKOS_VERSION
is equal to <MAJOR>*10000 + <MINOR>*100 + <PATCH>
.
40201
corresponds to the Kokkos 4.2.1 release version.
A 99
patch number denotes a development version. That is, 40199
corresponds to the Kokkos development version post release 4.1
#include <Kokkos_Core.hpp>
#include <iostream>
static_assert(KOKKOS_VERSION_MAJOR == KOKKOS_VERSION / 10000);
static_assert(KOKKOS_VERSION_MINOR == KOKKOS_VERSION / 100 % 100);
static_assert(KOKKOS_VERSION_PATCH == KOKKOS_VERSION % 100);
#if KOKKOS_VERSION >= 30700
// Kokkos version is at least 3.7
#endif
int main() {
if (KOKKOS_VERSION_PATCH == 99)
std::cout << "using development version of Kokkos"
// ...
}
Warning
Until Kokkos 4.1, KOKKOS_VERSION_MINOR
and KOKKOS_VERSION_PATCH
were not defined when they were meant to be 0
Function-like version helper macros (since Kokkos 4.1) |
---|
|
|
|
|
|
KOKKOS_VERSION_<COMPARE>
function-like macros return the result of
comparing the version of Kokkos currently used against the version specified by
the three arguments major.minor.patch
. These are available since Kokkos
4.1
#include <Kokkos_Core.hpp>
// sanity check for illustration
static_assert(KOKKOS_VERSION_EQUAL(KOKKOS_VERSION_MAJOR,
KOKKOS_VERSION_MINOR,
KOKKOS_VERSION_PATCH));
// set the minimum required version of Kokkos for a project or a file
static_assert(KOKKOS_VERSION_GREATER_EQUAL(4, 5, 0));
void do_work() {
#if KOKKOS_VERSION_GREATER_EQUAL(4, 3, 0)
// using the new rad functionality
#else
// falling back to the old boring stuff
#endif
}
General Settings#
Macro |
Description |
---|---|
|
Defined if extra debug features are activated. |
|
Defined if extra bounds checks are enabled. |
|
Defined if debug checks for |
|
Defined if features deprecated in major release 3 are still available. |
|
Defined if deprecated features generate deprecation warnings. |
|
Whether bindings for tunings are available (see #2422). |
|
Whether complex types are aligned. |
|
Whether certain dependency assumptions are ignored for aggressive vectorization of internal Kokkos loops. |
Execution Spaces#
The following macros can be used to test whether or not a specified execution space
is enabled. They can be tested for existence (e.g. #ifdef KOKKOS_ENABLE_SERIAL
).
Macro |
Description |
---|---|
|
Defined if the |
|
Defined if the |
|
Defined if the experimental |
|
Defined if the |
|
Defined if the |
|
Defined if the experimental |
|
Defined if the |
|
Defined if the experimental |
Backend options#
Macro |
Description |
---|---|
|
Defined if the CUDA backend supports constexpr functions. |
|
Defined if the CUDA backend supports lambdas. |
|
Defined if the CUDA backend supports LDG intrinsic. |
|
Defined if the CUDA backend supports relocatable device code. |
|
If defined, the default CUDA memory space is CudaUVMSpace, otherwise it is CudaSpace. |
|
If defined, multiple kernel versions are instantiated potentially improving run time. |
|
Defined if the HIP backend supports relocatable device code. |
C++ Standard Settings#
Kokkos supports the latest C++ language standards. Certain features may use different code paths or have different compiler support depending on the language standard that is enabled. The following macros are exposed to determine what language standard Kokkos was compiled with.
Macro |
Description |
---|---|
|
The C++14 language standard is enabled. |
|
The C++17 language standard is enabled. |
|
The C++20 language standard is enabled. |
Third-Party Library Settings#
These defines give information about what third-party libraries Kokkos was compiled with.
Macro |
Description |
---|---|
|
Defined if libhwloc is enabled for NUMA and architecture information. |
|
Defined if Kokkos links to the dynamic linker (libdl). |
|
Defined if Kokkos links to the GCC Quad-Precision Math Library API. |
|
Defined if Kokkos links to the oneDPL library when using the SYCL backend. Enabling this TPL might affect performance for Kokkos algorithms that use it, e.g., sort. |
Architectures#
Macro |
Description |
---|---|
|
Optimize for ARMv8.0 Compatible CPU (HOST) |
|
Optimize for ARMv8 Cavium ThunderX CPU (HOST) |
|
Optimize for ARMv8.1 Compatible CPU (HOST) |
|
Optimize for ARMv8 Cavium ThunderX2 CPU (HOST) |
|
Optimize for AVX2 (enabled for Zen) |
|
Optimize for AMD GPU MI50, MI60 (GPU) |
|
Optimize for AMD GPU MI100 (GPU) |
|
Optimize for AMD GPU MI200 series (GPU) |
|
Optimize for AMD GPU MI300A pre-production (GPU) |
|
Optimize for AMD GPU MI300X (GPU) |
|
Optimize for AMD GPU MI300A (GPU) |
|
Optimize for AMD GPU V620, W6800 (GPU) |
|
Optimize for AMD GPU 7900xt (GPU) |
|
Optimize for AMD Phoenix APU (GPU) |
|
String of the architecture flag for AMD GPU (e.g. “gfx90A” when targeting a MI250X accelerator) |
|
Optimize for AVX |
|
Optimize for AVX2 |
|
Optimize for Skylake(AVX512) |
|
Optimize for Intel Knights Corner Xeon Phi (HOST) |
|
Optimize for Many Integrated Core (MIC; AVX512) |
|
Optimize for IBM POWER8 CPUs (HOST) |
|
Optimize for IBM POWER9 CPUs (HOST) |
|
Optimize for Intel GPUs, Just-In-Time compilation (GPU) |
|
Optimize for Intel Iris XeMAX GPU (GPU) |
|
Optimize for Intel GPU Gen9 (GPU) |
|
Optimize for Intel GPU Gen11 (GPU) |
|
Optimize for Intel GPU Gen12LP (GPU) |
|
Optimize for Intel GPU Xe-HP (GPU) |
|
Optimize for Intel GPU Ponte Vecchio/GPU Max (GPU) |
|
Set if any Intel GPU architecture has been enabled |
|
Set if any NVIDIA Kepler architecture has been enabled |
|
Optimize for NVIDIA Kepler generation CC 3.0 (GPU) |
|
Optimize for NVIDIA Kepler generation CC 3.2 (GPU) |
|
Optimize for NVIDIA Kepler generation CC 3.5 (GPU) |
|
Optimize for NVIDIA Kepler generation CC 3.7 (GPU) |
|
Set if any NVIDIA Maxwell architecture has been enabled |
|
Optimize for NVIDIA Maxwell generation CC 5.0 (GPU) |
|
Optimize for NVIDIA Maxwell generation CC 5.2 (GPU) |
|
Optimize for NVIDIA Maxwell generation CC 5.3 (GPU) |
|
Set if any AMD Navi GPU architecture as been enabled Since Kokkos 4.0 |
|
Optimize for AMD GPU V620/W6800 GFX1030 (GPU) Since Kokkos 4.0 |
|
Set if any NVIDIA Pascal architecture has been enabled |
|
Optimize for NVIDIA Pascal generation CC 6.0 (GPU) |
|
Optimize for NVIDIA Pascal generation CC 6.1 (GPU) |
|
Set if any NVIDIA Volta architecture has been enabled |
|
Optimize for NVIDIA Volta generation CC 7.0 (GPU) |
|
Optimize for NVIDIA Volta generation CC 7.2 (GPU) |
|
Optimize for NVIDIA Turing generation CC 7.5 (GPU) |
|
Set if any NVIDIA Ampere architecture has been enabled |
|
Optimize for NVIDIA Ampere generation CC 8.0 (GPU) |
|
Optimize for NVIDIA Ampere generation CC 8.6 (GPU) |
|
Optimize for NVIDIA Ada generation CC 8.9 (GPU) since Kokkos 4.1 |
|
Set if any NVIDIA Hopper architecture has been enabled since Kokkos 4.0 |
|
Optimize for NVIDIA Hopper generation CC 9.0 (GPU) since Kokkos 4.0 |
|
Optimize for AMD Zen architecture (HOST) |
|
Optimize for AMD Zen2 architecture (HOST) |
|
Optimize for AMD Zen3 architecture (HOST) |
|
Set if any AMD Vega GPU architecture as been enabled |
|
Optimize for AMD GPU MI25 GFX900 (GPU) Removed in Kokkos 4.0 |
|
Optimize for AMD GPU MI50/MI60 GFX906 (GPU) |
|
Optimize for AMD GPU MI100 GFX908 (GPU) |
|
Optimize for AMD GPU MI200 series GFX90A (GPU) |