summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-08-15 15:53:51 (GMT)
committerBrad King <brad.king@kitware.com>2018-08-23 18:43:31 (GMT)
commit122c79748c30fb80d911591472cba8d6efdb75ae (patch)
treebbcadf918c0ff404ef3fa22058d305303baf55e7
parentc4ab098097f4fe1bc85ee29c6de390dff435f63f (diff)
downloadCMake-122c79748c30fb80d911591472cba8d6efdb75ae.zip
CMake-122c79748c30fb80d911591472cba8d6efdb75ae.tar.gz
CMake-122c79748c30fb80d911591472cba8d6efdb75ae.tar.bz2
CUDA: Avoid using deprecated cublas_device to identify device lib dirs
Use `curand_static` to identify directories containing device libraries because `cublas_device` is deprecated and will be removed in the future. Issue: #18290
-rw-r--r--Modules/CMakeCUDAInformation.cmake2
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake2
-rw-r--r--Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu6
3 files changed, 8 insertions, 2 deletions
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 8e62941..43ae989 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -185,7 +185,7 @@ if(__IMPLICT_DLINK_DIRS)
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
- if(EXISTS "${dir}/libcublas_device.a")
+ if(EXISTS "${dir}/libcurand_static.a")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index f1c1f2d..ba1638f 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -44,7 +44,7 @@ if(__IMPLICT_DLINK_DIRS)
endif()
set(__IMPLICT_DLINK_FLAGS )
foreach(dir ${__IMPLICT_DLINK_DIRS})
- if(EXISTS "${dir}/cublas_device.lib")
+ if(EXISTS "${dir}/curand_static.lib")
string(APPEND __IMPLICT_DLINK_FLAGS " -L\"${dir}\"")
endif()
endforeach()
diff --git a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
index 7eecec1..2c7c388 100644
--- a/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
+++ b/Tests/CudaOnly/LinkSystemDeviceLibraries/main.cu
@@ -3,6 +3,9 @@
#include <cuda_runtime.h>
#include <iostream>
+// this test only makes sense for versions of CUDA that ships
+// static libraries that have separable compilation device symbols
+#if __CUDACC_VER_MAJOR__ <= 9
__global__ void deviceCublasSgemm(int n, float alpha, float beta,
const float* d_A, const float* d_B,
float* d_C)
@@ -22,6 +25,7 @@ __global__ void deviceCublasSgemm(int n, float alpha, float beta,
cublasDestroy(cnpHandle);
}
+#endif
int choose_cuda_device()
{
@@ -63,6 +67,7 @@ int main(int argc, char** argv)
return 0;
}
+#if __CUDACC_VER_MAJOR__ <= 9
// initial values that will make sure that the cublasSgemm won't actually
// do any work
int n = 0;
@@ -72,6 +77,7 @@ int main(int argc, char** argv)
float* d_B = nullptr;
float* d_C = nullptr;
deviceCublasSgemm<<<1, 1>>>(n, alpha, beta, d_A, d_B, d_C);
+#endif
return 0;
}