summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-17 12:04:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-03-17 12:05:01 (GMT)
commitb5e259a6d4fb09ad275032217170822388c77bde (patch)
treefabebbcd079f6a30d478f6f78c0a3a8c8036864c
parent0377ed1df15bf9f6270ce9c4cede93a7f23d830a (diff)
parent81237523b7041eec8f36c18521227fde2b4d8939 (diff)
downloadCMake-b5e259a6d4fb09ad275032217170822388c77bde.zip
CMake-b5e259a6d4fb09ad275032217170822388c77bde.tar.gz
CMake-b5e259a6d4fb09ad275032217170822388c77bde.tar.bz2
Merge topic 'test-cuda-cubin'
81237523b7 Tests: Teach CudaOnly.CUBIN to tolerate toolkit not supporting native arch 35a3de7ab0 Tests: Add missing exit code to CudaOnly.{CUBIN,Fatbin} Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robertjmaynard@gmail.com> Merge-request: !8335
-rw-r--r--Tests/CudaOnly/CUBIN/CMakeLists.txt10
-rw-r--r--Tests/CudaOnly/CUBIN/main.cu2
-rw-r--r--Tests/CudaOnly/CUBIN/main_no_native_archs.cu4
-rw-r--r--Tests/CudaOnly/Fatbin/main.cu2
4 files changed, 17 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.cu b/Tests/CudaOnly/CUBIN/main.cu
index da5249c..581970a 100644
--- a/Tests/CudaOnly/CUBIN/main.cu
+++ b/Tests/CudaOnly/CUBIN/main.cu
@@ -53,4 +53,6 @@ int main()
return 1;
}
}
+
+ return 0;
}
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;
+}
diff --git a/Tests/CudaOnly/Fatbin/main.cu b/Tests/CudaOnly/Fatbin/main.cu
index 903feee..89af0e3 100644
--- a/Tests/CudaOnly/Fatbin/main.cu
+++ b/Tests/CudaOnly/Fatbin/main.cu
@@ -53,4 +53,6 @@ int main()
return 1;
}
}
+
+ return 0;
}