diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:10 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:20:10 +0900 |
commit | f58f7a233a9b66287e1a0fad0d149e3202a098b4 (patch) | |
tree | cc0cea82fae3f153df9299b27650e17c58da1125 /Tests/Cuda | |
parent | 46f8b5215bbbfcf4bc0caed1daf52b678fd2b976 (diff) | |
download | cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.gz cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.tar.bz2 cmake-f58f7a233a9b66287e1a0fad0d149e3202a098b4.zip |
Imported Upstream version 3.18.0upstream/3.18.0
Diffstat (limited to 'Tests/Cuda')
-rw-r--r-- | Tests/Cuda/CMakeLists.txt | 46 | ||||
-rw-r--r-- | Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Cuda/Complex/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels1/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels2/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels3/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels4/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Cuda/MixedStandardLevels5/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/Cuda/ProperLinkFlags/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/Cuda/Toolkit/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/Cuda/WithC/CMakeLists.txt | 2 |
12 files changed, 62 insertions, 37 deletions
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index 58b9b03c9..35ceb333c 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -1,25 +1,35 @@ +macro (add_cuda_test_macro name) + add_test_macro("${name}" ${ARGN}) + set_property(TEST "${name}" APPEND + PROPERTY LABELS "CUDA") +endmacro () -ADD_TEST_MACRO(Cuda.Complex CudaComplex) -ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) -ADD_TEST_MACRO(Cuda.CXXStandardSetTwice CXXStandardSetTwice) -ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary) -ADD_TEST_MACRO(Cuda.MixedStandardLevels1 MixedStandardLevels1) -ADD_TEST_MACRO(Cuda.MixedStandardLevels2 MixedStandardLevels2) -ADD_TEST_MACRO(Cuda.MixedStandardLevels3 MixedStandardLevels3) -ADD_TEST_MACRO(Cuda.MixedStandardLevels4 MixedStandardLevels4) -ADD_TEST_MACRO(Cuda.MixedStandardLevels5 MixedStandardLevels5) -ADD_TEST_MACRO(Cuda.NotEnabled CudaNotEnabled) -ADD_TEST_MACRO(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) -ADD_TEST_MACRO(Cuda.Toolkit Toolkit) -ADD_TEST_MACRO(Cuda.IncludePathNoToolkit IncludePathNoToolkit) -ADD_TEST_MACRO(Cuda.ProperDeviceLibraries ProperDeviceLibraries) -ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags) -ADD_TEST_MACRO(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit) +add_cuda_test_macro(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) +add_cuda_test_macro(Cuda.CXXStandardSetTwice CXXStandardSetTwice) +add_cuda_test_macro(Cuda.ObjectLibrary CudaObjectLibrary) +add_cuda_test_macro(Cuda.MixedStandardLevels1 MixedStandardLevels1) +add_cuda_test_macro(Cuda.MixedStandardLevels2 MixedStandardLevels2) +add_cuda_test_macro(Cuda.MixedStandardLevels3 MixedStandardLevels3) +add_cuda_test_macro(Cuda.MixedStandardLevels4 MixedStandardLevels4) +add_cuda_test_macro(Cuda.MixedStandardLevels5 MixedStandardLevels5) +add_cuda_test_macro(Cuda.NotEnabled CudaNotEnabled) +add_cuda_test_macro(Cuda.SeparableCompCXXOnly SeparableCompCXXOnly) +add_cuda_test_macro(Cuda.Toolkit Toolkit) +add_cuda_test_macro(Cuda.IncludePathNoToolkit IncludePathNoToolkit) +add_cuda_test_macro(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit) + +# Separable compilation is currently only supported on NVCC. Disable tests +# using it for other compilers. +if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") + add_cuda_test_macro(Cuda.Complex CudaComplex) + add_cuda_test_macro(Cuda.ProperDeviceLibraries ProperDeviceLibraries) + add_cuda_test_macro(Cuda.ProperLinkFlags ProperLinkFlags) +endif() # The CUDA only ships the shared version of the toolkit libraries # on windows if(NOT WIN32) - ADD_TEST_MACRO(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit) + add_cuda_test_macro(Cuda.StaticRuntimePlusToolkit StaticRuntimePlusToolkit) endif() -ADD_TEST_MACRO(Cuda.WithC CudaWithC) +add_cuda_test_macro(Cuda.WithC CudaWithC) diff --git a/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt b/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt index 1941c4952..f4ad83a30 100644 --- a/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt +++ b/Tests/Cuda/CXXStandardSetTwice/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(CXXStandardSetTwice CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(CXXStandardSetTwice main.cu) target_compile_features(CXXStandardSetTwice PUBLIC cxx_std_11) diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt index 08d1e16aa..265bd85c1 100644 --- a/Tests/Cuda/Complex/CMakeLists.txt +++ b/Tests/Cuda/Complex/CMakeLists.txt @@ -15,7 +15,7 @@ project (Complex CXX CUDA) #and also building cpp targets that need cuda implicit libraries #verify that we can pass explicit cuda arch flags -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) set(CMAKE_CUDA_STANDARD 11) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) diff --git a/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt index b03e51e3e..e40ffa6da 100644 --- a/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels1/CMakeLists.txt @@ -1,10 +1,9 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels1 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 14) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels1 main.cu lib.cpp) diff --git a/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt index 12dd3285f..7af8081fa 100644 --- a/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels2/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels2 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 17) #this can decay +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels2 main.cu lib.cpp) target_compile_features(MixedStandardLevels2 PUBLIC cuda_std_11) diff --git a/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt index 2b611be8e..2c420030a 100644 --- a/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels3/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels3 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels3 main.cu lib.cpp) target_compile_features(MixedStandardLevels3 PUBLIC cuda_std_03 cxx_std_14) diff --git a/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt index faf68692f..230230d0d 100644 --- a/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels4/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels4 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CUDA_STANDARD 03) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels4 main.cu lib.cpp) target_compile_features(MixedStandardLevels4 PUBLIC cxx_std_14) diff --git a/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt b/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt index 7209f6085..5f5ee0637 100644 --- a/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt +++ b/Tests/Cuda/MixedStandardLevels5/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.7) project(MixedStandardLevels5 CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") - set(CMAKE_CXX_STANDARD 98) +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(MixedStandardLevels5 main.cu lib.cpp) diff --git a/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt index cb47b09b4..fe28c3edc 100644 --- a/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt +++ b/Tests/Cuda/ProperDeviceLibraries/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.13) project(ProperDeviceLibraries CXX CUDA) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_35,code=compute_35 -gencode arch=compute_35,code=sm_35") set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 35) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt index b6e0e394b..d38da6d14 100644 --- a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt +++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt @@ -9,11 +9,17 @@ project (ProperLinkFlags CUDA CXX) #Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA ) #to make sure we don't use the CXX flags when linking CUDA executables -string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_35 --use_fast_math") +if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + string(APPEND CMAKE_CUDA_FLAGS "--use_fast_math") +elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang") + string(APPEND CMAKE_CUDA_FLAGS "-ffast-math") +endif() + set(CMAKE_CXX_FLAGS "-Wall") set(CMAKE_CXX_STANDARD 11) set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_ARCHITECTURES 35) add_executable(ProperLinkFlags file1.cu main.cxx) set_target_properties( ProperLinkFlags diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt index 86b465219..00125e3b9 100644 --- a/Tests/Cuda/Toolkit/CMakeLists.txt +++ b/Tests/Cuda/Toolkit/CMakeLists.txt @@ -14,15 +14,29 @@ message(STATUS "CUDAToolkit_INCLUDE_DIRS: ${CUDAToolkit_INCLUDE_DIRS}") message(STATUS "CUDAToolkit_LIBRARY_DIR: ${CUDAToolkit_LIBRARY_DIR}") message(STATUS "CUDAToolkit_NVCC_EXECUTABLE ${CUDAToolkit_NVCC_EXECUTABLE}") -# Verify that all the CUDA:: targets exist even when the CUDA language isn't enabled +set(cuda_libs cudart cuda_driver cublas cufft cufftw curand cusolver cusparse) +if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1) + list(APPEND cuda_libs cublasLt) +endif() +if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11) + list(APPEND cuda_libs nvgraph) +endif() -foreach (cuda_lib cudart cuda_driver cublas cufft cufftw curand cusolver cusparse nvgraph) +# Verify that all the CUDA:: targets exist even when the CUDA language isn't enabled +foreach (cuda_lib IN LISTS cuda_libs) + if(NOT CUDA_${cuda_lib}_LIBRARY) + message(FATAL_ERROR "expected CUDAToolkit variable CUDA_${cuda_lib}_LIBRARY not found") + endif() if(NOT TARGET CUDA::${cuda_lib}) - message(FATAL_ERROR "The CUDA::${cuda_lib} target was expected but couldn't be found") + message(FATAL_ERROR "expected CUDAToolkit target CUDA::${cuda_lib} not found") endif() endforeach() -foreach (cuda_lib nppc nppial nppicc nppidei nppif nppig nppim nppist nppitc npps nppicom nppisu) +set(npp_libs nppc nppial nppicc nppidei nppif nppig nppim nppist nppitc npps nppisu) +if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11) + list(APPEND npp_libs nppicom) +endif() +foreach (cuda_lib IN LISTS npp_libs) if(NOT TARGET CUDA::${cuda_lib}) message(FATAL_ERROR "The CUDA::${cuda_lib} target was expected but couldn't be found") endif() diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt index 69aa3f992..049cbce1f 100644 --- a/Tests/Cuda/WithC/CMakeLists.txt +++ b/Tests/Cuda/WithC/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7) project(WithC CUDA C) -string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") +set(CMAKE_CUDA_ARCHITECTURES 30) add_executable(CudaWithC main.c cuda.cu) |