diff options
author | Brad King <brad.king@kitware.com> | 2022-03-04 18:51:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-10 14:27:29 (GMT) |
commit | d1b48bfabd6157309b3056967e6e30cc0ce07983 (patch) | |
tree | 3ce109b078bf5da4d866f6e2994bbce8246e4df1 /Tests/RunCMake/CUDA_architectures | |
parent | 632752d62e8de2730796f509dbb10551351309c2 (diff) | |
download | CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.zip CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.tar.gz CMake-d1b48bfabd6157309b3056967e6e30cc0ce07983.tar.bz2 |
CUDA: Add support for CUDA_ARCHITECTURES=native
CUDA 11.6 added the `nvcc -arch=native` flag to automatically compile
for the host GPUs' architectures. Add support for specifying this
special `native` value in `CMAKE_CUDA_ARCHITECTURES` and
`CUDA_ARCHITECTURES`. During the compiler ABI detection step,
detect the native architectures so we can pass them explicitly
when using Clang or older versions of nvcc.
Fixes: #22375
Diffstat (limited to 'Tests/RunCMake/CUDA_architectures')
7 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/CUDA_architectures/RunCMakeTest.cmake b/Tests/RunCMake/CUDA_architectures/RunCMakeTest.cmake index 6fecae7..e37d025 100644 --- a/Tests/RunCMake/CUDA_architectures/RunCMakeTest.cmake +++ b/Tests/RunCMake/CUDA_architectures/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) run_cmake(architectures-all) run_cmake(architectures-all-major) +run_cmake(architectures-native) run_cmake(architectures-empty) run_cmake(architectures-invalid) diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt index c5cde8f..ee0a5f7 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-major-stdout.txt @@ -1,3 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all-major' -- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' -- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-major.cmake b/Tests/RunCMake/CUDA_architectures/architectures-all-major.cmake index 5112473..7203c98 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-major.cmake +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-major.cmake @@ -3,3 +3,4 @@ enable_language(CUDA) message(STATUS "CMAKE_CUDA_ARCHITECTURES='${CMAKE_CUDA_ARCHITECTURES}'") message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL='${CMAKE_CUDA_ARCHITECTURES_ALL}'") message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR}'") +message(STATUS "CMAKE_CUDA_ARCHITECTURES_NATIVE='${CMAKE_CUDA_ARCHITECTURES_NATIVE}'") diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt index aba26b9..fd738e4 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt +++ b/Tests/RunCMake/CUDA_architectures/architectures-all-stdout.txt @@ -1,3 +1,4 @@ -- CMAKE_CUDA_ARCHITECTURES='all' -- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' -- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-all.cmake b/Tests/RunCMake/CUDA_architectures/architectures-all.cmake index 32175f6..0c3a4e9 100644 --- a/Tests/RunCMake/CUDA_architectures/architectures-all.cmake +++ b/Tests/RunCMake/CUDA_architectures/architectures-all.cmake @@ -3,3 +3,4 @@ enable_language(CUDA) message(STATUS "CMAKE_CUDA_ARCHITECTURES='${CMAKE_CUDA_ARCHITECTURES}'") message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL='${CMAKE_CUDA_ARCHITECTURES_ALL}'") message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR}'") +message(STATUS "CMAKE_CUDA_ARCHITECTURES_NATIVE='${CMAKE_CUDA_ARCHITECTURES_NATIVE}'") diff --git a/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt new file mode 100644 index 0000000..af49e00 --- /dev/null +++ b/Tests/RunCMake/CUDA_architectures/architectures-native-stdout.txt @@ -0,0 +1,4 @@ +-- CMAKE_CUDA_ARCHITECTURES='native' +-- CMAKE_CUDA_ARCHITECTURES_ALL='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='[0-9;]+' +-- CMAKE_CUDA_ARCHITECTURES_NATIVE='[0-9;]+' diff --git a/Tests/RunCMake/CUDA_architectures/architectures-native.cmake b/Tests/RunCMake/CUDA_architectures/architectures-native.cmake new file mode 100644 index 0000000..64afe13 --- /dev/null +++ b/Tests/RunCMake/CUDA_architectures/architectures-native.cmake @@ -0,0 +1,6 @@ +set(CMAKE_CUDA_ARCHITECTURES "native") +enable_language(CUDA) +message(STATUS "CMAKE_CUDA_ARCHITECTURES='${CMAKE_CUDA_ARCHITECTURES}'") +message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL='${CMAKE_CUDA_ARCHITECTURES_ALL}'") +message(STATUS "CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR='${CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR}'") +message(STATUS "CMAKE_CUDA_ARCHITECTURES_NATIVE='${CMAKE_CUDA_ARCHITECTURES_NATIVE}'") |