summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/configure_cuda10.2_clang.cmake1
-rw-r--r--.gitlab/ci/configure_cuda10.2_nvidia.cmake1
-rw-r--r--.gitlab/ci/configure_cuda11.6_nvidia.cmake1
-rw-r--r--.gitlab/ci/configure_nvhpc_ninja.cmake1
-rw-r--r--Modules/FindCUDAToolkit.cmake6
-rw-r--r--Tests/Cuda/CMakeLists.txt1
-rw-r--r--Tests/Cuda/Toolkit/CMakeLists.txt17
-rw-r--r--Tests/CudaOnly/CMakeLists.txt1
-rw-r--r--Tests/CudaOnly/Toolkit/CMakeLists.txt20
9 files changed, 45 insertions, 4 deletions
diff --git a/.gitlab/ci/configure_cuda10.2_clang.cmake b/.gitlab/ci/configure_cuda10.2_clang.cmake
index e13ca88..e2d5a9c 100644
--- a/.gitlab/ci/configure_cuda10.2_clang.cmake
+++ b/.gitlab/ci/configure_cuda10.2_clang.cmake
@@ -1,3 +1,4 @@
set(CMake_TEST_CUDA "Clang" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_cuda10.2_nvidia.cmake b/.gitlab/ci/configure_cuda10.2_nvidia.cmake
index 519699b..2cb2950 100644
--- a/.gitlab/ci/configure_cuda10.2_nvidia.cmake
+++ b/.gitlab/ci/configure_cuda10.2_nvidia.cmake
@@ -1,3 +1,4 @@
set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_cuda11.6_nvidia.cmake b/.gitlab/ci/configure_cuda11.6_nvidia.cmake
index 519699b..2cb2950 100644
--- a/.gitlab/ci/configure_cuda11.6_nvidia.cmake
+++ b/.gitlab/ci/configure_cuda11.6_nvidia.cmake
@@ -1,3 +1,4 @@
set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_nvhpc_ninja.cmake b/.gitlab/ci/configure_nvhpc_ninja.cmake
index ca8ba93..07e47c4 100644
--- a/.gitlab/ci/configure_nvhpc_ninja.cmake
+++ b/.gitlab/ci/configure_nvhpc_ninja.cmake
@@ -1,4 +1,5 @@
set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
set(configure_no_sccache 1)
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index b4c596c..469a7ad 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -960,7 +960,7 @@ endif()
# the version of the CUDA toolchain
# Create a separate variable so this directory can be selectively added to math targets.
find_path(CUDAToolkit_CUBLAS_INCLUDE_DIR cublas_v2.h PATHS
- "${CUDAToolkit_INCLUDE_DIRECTORIES}"
+ ${CUDAToolkit_INCLUDE_DIRECTORIES}
NO_DEFAULT_PATH)
if(NOT CUDAToolkit_CUBLAS_INCLUDE_DIR)
@@ -973,7 +973,7 @@ if(NOT CUDAToolkit_CUBLAS_INCLUDE_DIR)
cmake_path(NORMAL_PATH CUDAToolkit_MATH_INCLUDE_DIR)
find_path(CUDAToolkit_CUBLAS_INCLUDE_DIR cublas_v2.h PATHS
- "${CUDAToolkit_INCLUDE_DIRECTORIES}"
+ ${CUDAToolkit_INCLUDE_DIRECTORIES}
)
if(CUDAToolkit_CUBLAS_INCLUDE_DIR)
list(APPEND CUDAToolkit_INCLUDE_DIRECTORIES "${CUDAToolkit_CUBLAS_INCLUDE_DIR}")
@@ -1246,7 +1246,7 @@ if(CUDAToolkit_FOUND)
find_path(CUDAToolkit_CUPTI_INCLUDE_DIR cupti.h PATHS
"${CUDAToolkit_ROOT_DIR}/extras/CUPTI/include"
- "${CUDAToolkit_INCLUDE_DIRS}"
+ ${CUDAToolkit_INCLUDE_DIRS}
PATH_SUFFIXES "../extras/CUPTI/include"
"../../../extras/CUPTI/include"
NO_DEFAULT_PATH)
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index c737bcc..efe0358 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -14,6 +14,7 @@ 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.StubRPATH StubRPATH)
+set(Cuda.Toolkit_BUILD_OPTIONS -DHAS_CUPTI:BOOL=${CMake_TEST_CUDA_CUPTI})
add_cuda_test_macro(Cuda.Toolkit Toolkit)
add_cuda_test_macro(Cuda.IncludePathNoToolkit IncludePathNoToolkit)
add_cuda_test_macro(Cuda.SharedRuntimePlusToolkit SharedRuntimePlusToolkit)
diff --git a/Tests/Cuda/Toolkit/CMakeLists.txt b/Tests/Cuda/Toolkit/CMakeLists.txt
index c2989f0..4255b82 100644
--- a/Tests/Cuda/Toolkit/CMakeLists.txt
+++ b/Tests/Cuda/Toolkit/CMakeLists.txt
@@ -79,6 +79,23 @@ endforeach()
add_executable(Toolkit main.cpp)
target_link_libraries(Toolkit PRIVATE CUDA::toolkit)
+if(HAS_CUPTI)
+ set(cupti_libs )
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.2)
+ list(APPEND cupti_libs cupti nvperf_target)
+ endif()
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.3)
+ list(APPEND cupti_libs pcsamplingutil)
+ endif()
+ foreach (cuda_lib IN LISTS cupti_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 "expected CUDAToolkit target CUDA::${cuda_lib} not found")
+ endif()
+ endforeach()
+endif()
# cupti is an optional component of the CUDA toolkit
if(TARGET CUDA::cupti)
add_executable(cupti cupti.cpp)
diff --git a/Tests/CudaOnly/CMakeLists.txt b/Tests/CudaOnly/CMakeLists.txt
index 32940eb..9f49498 100644
--- a/Tests/CudaOnly/CMakeLists.txt
+++ b/Tests/CudaOnly/CMakeLists.txt
@@ -12,6 +12,7 @@ add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98)
+set(CudaOnly.Toolkit_BUILD_OPTIONS -DHAS_CUPTI:BOOL=${CMake_TEST_CUDA_CUPTI})
add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit)
add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
add_cuda_test_macro(CudaOnly.ToolkitMultipleDirs CudaOnlyToolkitMultipleDirs)
diff --git a/Tests/CudaOnly/Toolkit/CMakeLists.txt b/Tests/CudaOnly/Toolkit/CMakeLists.txt
index 506fc9f..b2694bf 100644
--- a/Tests/CudaOnly/Toolkit/CMakeLists.txt
+++ b/Tests/CudaOnly/Toolkit/CMakeLists.txt
@@ -41,7 +41,6 @@ if(CUDAToolkit_VERSION_MAJOR VERSION_LESS 11)
list(APPEND cuda_libs nvgraph)
endif()
-
# Verify that all the CUDA:: targets and variables exist
foreach (cuda_lib IN LISTS cuda_libs)
if(NOT CUDA_${cuda_lib}_LIBRARY)
@@ -81,5 +80,24 @@ foreach (cuda_lib nvrtc nvToolsExt OpenCL)
endif()
endforeach()
+if(HAS_CUPTI)
+ set(cupti_libs )
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.2)
+ list(APPEND cupti_libs cupti nvperf_target)
+ endif()
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.3)
+ list(APPEND cupti_libs pcsamplingutil)
+ endif()
+
+ foreach (cuda_lib IN LISTS cupti_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 "expected CUDAToolkit target CUDA::${cuda_lib} not found")
+ endif()
+ endforeach()
+endif()
+
add_executable(CudaOnlyToolkit main.cu)
target_link_libraries(CudaOnlyToolkit PRIVATE CUDA::toolkit)