diff options
author | Brad King <brad.king@kitware.com> | 2023-03-16 14:52:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-03-16 14:55:36 (GMT) |
commit | 81237523b7041eec8f36c18521227fde2b4d8939 (patch) | |
tree | 78431d43591b9b57f79b4775f64c79af20909c11 /Tests/CudaOnly | |
parent | 35a3de7ab07c7a4d4b5d1b1b9306132d8b806acf (diff) | |
download | CMake-81237523b7041eec8f36c18521227fde2b4d8939.zip CMake-81237523b7041eec8f36c18521227fde2b4d8939.tar.gz CMake-81237523b7041eec8f36c18521227fde2b4d8939.tar.bz2 |
Tests: Teach CudaOnly.CUBIN to tolerate toolkit not supporting native arch
Since commit 2def6a874b (CUDA: Add support for CUBIN, FATBIN, and
OPTIXIR compilation, 2023-01-27) added this test, it has failed when
executed with a CUDA toolkit that does not support the true native
architecture of the GPU. Detect this case and skip the test.
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r-- | Tests/CudaOnly/CUBIN/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/CudaOnly/CUBIN/main_no_native_archs.cu | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/Tests/CudaOnly/CUBIN/CMakeLists.txt b/Tests/CudaOnly/CUBIN/CMakeLists.txt index 464714b..81787e4 100644 --- a/Tests/CudaOnly/CUBIN/CMakeLists.txt +++ b/Tests/CudaOnly/CUBIN/CMakeLists.txt @@ -1,9 +1,17 @@ cmake_minimum_required(VERSION 3.18) +unset(ENV{CMAKE_CUDA_ARCHITECTURES_NATIVE_CLAMP}) # CUBIN needs true native arch project(CudaCUBIN LANGUAGES CUDA) - set(CMAKE_CUDA_ARCHITECTURES all-major) +# CUBIN needs the true native arch to be supported by the CUDA toolkit. +set(unavailable_native_archs "${CMAKE_CUDA_ARCHITECTURES_NATIVE}") +list(REMOVE_ITEM unavailable_native_archs ${CMAKE_CUDA_ARCHITECTURES_ALL}) +if(unavailable_native_archs) + add_executable(CudaOnlyCUBIN main_no_native_archs.cu) + return() +endif() + add_library(CudaCUBIN OBJECT kernelA.cu kernelB.cu kernelC.cu) set_property(TARGET CudaCUBIN PROPERTY CUDA_CUBIN_COMPILATION ON) set_property(TARGET CudaCUBIN PROPERTY CUDA_ARCHITECTURES native) diff --git a/Tests/CudaOnly/CUBIN/main_no_native_archs.cu b/Tests/CudaOnly/CUBIN/main_no_native_archs.cu new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/CudaOnly/CUBIN/main_no_native_archs.cu @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |