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()
to establish the
CUDA architectures to be compiled for. Parses the ENV{CUDAARCHS}
, and
CMAKE_CUDA_ARCHITECTURES
for special values
RAPIDS, and NATIVE.
Note
Required to be called before the first project()
call.
Will automatically call rapids_cuda_set_architectures()
immediately
after project()
with the same project name establishing
the correct values for CMAKE_CUDA_ARCHITECTURES
.
project_name
Name of the project in the subsequent
project()
call.
NATIVE
or""
:When passed as the value for
CMAKE_CUDA_ARCHITECTURES
orENV{CUDAARCHS}
will compile for all GPU architectures present on the current machine.RAPIDS
,ALL
, or no value inCMAKE_CUDA_ARCHITECTURES
andENV{CUDAARCHS}
:When passed as the value for
CMAKE_CUDA_ARCHITECTURES
orENV{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/branch-<VERSION_MAJOR>.<VERSION_MINOR>/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(ExampleProject)
project(ExampleProject ...)