CCCL_HOST_ARCH#
-
CCCL_HOST_ARCH(ARCH)#
Detect the current host architecture.
For supported host architectures, the macro expands to an implementation-defined true value if the current host architecture matches, or false otherwise. These values may be used in boolean expressions (preprocessor or otherwise), but no other guarantees are made.
Available values for
ARCHinclude:ARM64: ARM 64-bit, including MSVC ARM64EC emulation.X86_64: X86 64-bit. This is false when compiling in MSVC ARM64EC emulation mode.
Passing any other value will result in an undefined expansion, which may or may not be diagnosed by the compiler.
- Example
#define MY_OTHER_MACRO 1 // Expansion value can be used in ordinary macro conditionals #if CCCL_HOST_ARCH(X86_64) && MY_OTHER_MACRO // ... #endif // Can be negated as usual #if !CCCL_HOST_ARCH(ARM64) // ... #endif
Note
This macro is made available when including any libcu++ header. Users that wish to include the smallest possible header for this macro should include
<cuda/std/version>.- Parameters:
ARCH – The name of the host architecture to test.
- Returns:
true if the specified host architecture is being compiled for, false otherwise.