diff options
author | Raul Tambre <raul@tambre.ee> | 2020-11-27 15:18:29 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-11-30 15:57:27 (GMT) |
commit | c57541d874ce2a22555e1aae302d27190d74a5a4 (patch) | |
tree | c764012711bf3b70856ae78b643e86016a95fee4 /Tests/CudaOnly | |
parent | c4ae9384ff4d355f51c06180984dd4d053f074cc (diff) | |
download | CMake-c57541d874ce2a22555e1aae302d27190d74a5a4.zip CMake-c57541d874ce2a22555e1aae302d27190d74a5a4.tar.gz CMake-c57541d874ce2a22555e1aae302d27190d74a5a4.tar.bz2 |
CUDA: Fix tests with CUDAARCHS set
With CUDAARCHS there's the possibility of tests being run with multiple
architectures or having CMAKE_CUDA_ARCHITECTURES set with NVCC despite CMP0104
being OLD.
Fix a few tests to work properly in such cases.
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r-- | Tests/CudaOnly/CompileFlags/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CudaOnly/ExportPTX/CMakeLists.txt | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Tests/CudaOnly/CompileFlags/CMakeLists.txt b/Tests/CudaOnly/CompileFlags/CMakeLists.txt index 5e8a8e4..38765ec 100644 --- a/Tests/CudaOnly/CompileFlags/CMakeLists.txt +++ b/Tests/CudaOnly/CompileFlags/CMakeLists.txt @@ -8,6 +8,7 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") target_compile_options(CudaOnlyCompileFlags PRIVATE -gencode arch=compute_50,code=compute_50 ) + set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES) else() set_property(TARGET CudaOnlyCompileFlags PROPERTY CUDA_ARCHITECTURES 50-real) endif() diff --git a/Tests/CudaOnly/ExportPTX/CMakeLists.txt b/Tests/CudaOnly/ExportPTX/CMakeLists.txt index ee5f54d..e7e7bc4 100644 --- a/Tests/CudaOnly/ExportPTX/CMakeLists.txt +++ b/Tests/CudaOnly/ExportPTX/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.19) project (ExportPTX CUDA) #Goal for this example: @@ -6,6 +6,10 @@ project (ExportPTX CUDA) # How to reference PTX files for custom commands # How to install PTX files +# PTX can be compiled only for a single virtual architecture at a time +list(SUBLIST CMAKE_CUDA_ARCHITECTURES 0 1 CMAKE_CUDA_ARCHITECTURES) +string(APPEND CMAKE_CUDA_ARCHITECTURES "-virtual") + add_library(CudaPTX OBJECT kernelA.cu kernelB.cu) set_property(TARGET CudaPTX PROPERTY CUDA_PTX_COMPILATION ON) |