diff options
author | Raul Tambre <raul@tambre.ee> | 2020-03-27 18:52:39 (GMT) |
---|---|---|
committer | Raul Tambre <raul@tambre.ee> | 2020-04-15 14:55:41 (GMT) |
commit | f0931b07905a960c7dfbcc90e772219150c24951 (patch) | |
tree | defe47dc5d287e9db57bf33905b927547ec770bd /Tests/CudaOnly | |
parent | e98588aabad578a9b33aae05e77f6ec5b3ff2e46 (diff) | |
download | CMake-f0931b07905a960c7dfbcc90e772219150c24951.zip CMake-f0931b07905a960c7dfbcc90e772219150c24951.tar.gz CMake-f0931b07905a960c7dfbcc90e772219150c24951.tar.bz2 |
CUDA: Convert tests to use CUDA_ARCHITECTURES
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r-- | Tests/CudaOnly/CircularLinkLine/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/RuntimeControls/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/CudaOnly/SeparateCompilation/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/CudaOnly/Standard98/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/CudaOnly/WithDefs/CMakeLists.txt | 13 |
7 files changed, 7 insertions, 21 deletions
diff --git a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt index 5e6f7ab..e10a348 100644 --- a/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt +++ b/Tests/CudaOnly/CircularLinkLine/CMakeLists.txt @@ -5,9 +5,9 @@ project (CircularLinkLine CUDA) # Verify that we de-duplicate the device link line # Verify that a de-duplicated link line still works with circular static libraries -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_library(CUDACircularDeviceLinking1 STATIC file1.cu) add_library(CUDACircularDeviceLinking2 STATIC file2.cu) diff --git a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt index 6e3697f..1265660 100644 --- a/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/DontResolveDeviceSymbols/CMakeLists.txt @@ -24,9 +24,9 @@ endif() # Don't resolve the device symbols in the static library # Don't resolve the device symbols in the executable library # Verify that we can't use those device symbols from anything -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30] -gencode arch=compute_50,code=\\\"compute_50\\\"") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30 50) set(CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS OFF) add_library(CUDANoDeviceResolve SHARED file1.cu) diff --git a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt index 57aa0b9..bd94ec8 100644 --- a/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt +++ b/Tests/CudaOnly/ResolveDeviceSymbols/CMakeLists.txt @@ -21,7 +21,7 @@ endif() # confirming that the first static library is on the device link line # 3. Verify that we can't use those device symbols from anything that links # to the static library -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[sm_30] -gencode arch=compute_50,code=\\\"compute_50\\\"") +set(CMAKE_CUDA_ARCHITECTURES 30 50) add_library(CUDAResolveDeviceDepsA STATIC file1.cu) add_library(CUDAResolveDeviceDepsB STATIC file2.cu) diff --git a/Tests/CudaOnly/RuntimeControls/CMakeLists.txt b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt index 8b58fec..0da5739 100644 --- a/Tests/CudaOnly/RuntimeControls/CMakeLists.txt +++ b/Tests/CudaOnly/RuntimeControls/CMakeLists.txt @@ -15,9 +15,8 @@ else() endif() endif() -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=[compute_30]") - set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) set(CMAKE_CUDA_RUNTIME_LIBRARY static) if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC") diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt index c1bd64a..586be81 100644 --- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt +++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt @@ -9,9 +9,7 @@ project (SeparateCompilation CUDA) #and executables. #We complicate the matter by also testing that multiple static libraries #all containing cuda separable compilation code links properly -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=\\\"compute_30,sm_30,sm_35\\\"") -string(APPEND CMAKE_CUDA_FLAGS " --generate-code=arch=compute_50,code=[compute_50,sm_50,sm_52]") - +set(CMAKE_CUDA_ARCHITECTURES 30 35 50 52) set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) add_library(CUDASeparateLibA STATIC file1.cu file2.cu file3.cu) target_compile_features(CUDASeparateLibA PRIVATE cuda_std_11) diff --git a/Tests/CudaOnly/Standard98/CMakeLists.txt b/Tests/CudaOnly/Standard98/CMakeLists.txt index ef9a685..3ba0360 100644 --- a/Tests/CudaOnly/Standard98/CMakeLists.txt +++ b/Tests/CudaOnly/Standard98/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(CudaOnlyStandard98 CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) # Support setting CUDA Standard to 98 which internally gets transformed to # CUDA03 diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index ba9bf04..add8131 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -3,17 +3,7 @@ cmake_minimum_required(VERSION 3.7) project (WithDefs CUDA) #verify that we can pass explicit cuda arch flags -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") -if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9) - set(debug_compile_flags --generate-code arch=compute_32,code=sm_32) -else() - set(debug_compile_flags --generate-code arch=compute_20,code=sm_20) -endif() -if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") - list(APPEND debug_compile_flags -Xcompiler=-WX) -else() - list(APPEND debug_compile_flags -Xcompiler=-Werror) -endif() +set(CMAKE_CUDA_ARCHITECTURES 30) set(release_compile_defs DEFREL) #Goal for this example: @@ -29,7 +19,6 @@ target_compile_options(CudaOnlyWithDefs -DFLAG_COMPILE_LANG_$<COMPILE_LANGUAGE> -DFLAG_LANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA> --compiler-options=-DHOST_DEFINE - $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>> ) target_compile_definitions(CudaOnlyWithDefs |