rapids_cuda_init_architectures

Added in version v21.06.00.

Extends CMAKE_CUDA_ARCHITECTURES to include support for RAPIDS and NATIVE to make CUDA architecture compilation easier.

rapids_cuda_init_architectures([project_name])

Used before enabling the CUDA language either via project() or enable_language() to establish the CUDA architectures to be compiled for. Parses the ENV{CUDAARCHS}, and CMAKE_CUDA_ARCHITECTURES for special values RAPIDS, and NATIVE.

Added in version v26.08.00.

If project_name is not specified this will automatically call rapids_cuda_set_architectures() immediately for any subsequent project() establishing the correct values for CMAKE_CUDA_ARCHITECTURES.

project_name

Note

If an explicit project name is specified, this must be called before the associated project() call.

Will restrict the call rapids_cuda_set_architectures() to only occur for the subsequent project() with the same project name.

NATIVE or "":

When passed as the value for CMAKE_CUDA_ARCHITECTURES or ENV{CUDAARCHS} will compile for all GPU architectures present on the current machine.

RAPIDS, ALL, or no value in CMAKE_CUDA_ARCHITECTURES and ENV{CUDAARCHS}:

When passed as the value for CMAKE_CUDA_ARCHITECTURES or ENV{CUDAARCHS} will compile for all supported RAPIDS GPU architectures.

Example on how to properly use rapids_cuda_init_architectures():

cmake_minimum_required(...)

if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/EXAMPLE_RAPIDS.cmake)
  file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/main/RAPIDS.cmake
    ${CMAKE_CURRENT_BINARY_DIR}/EXAMPLE_RAPIDS.cmake)
endif()
include(${CMAKE_CURRENT_BINARY_DIR}/EXAMPLE_RAPIDS.cmake)
include(rapids-cuda)

rapids_cuda_init_architectures()
project(ExampleProject ...)