Sfoglia il codice sorgente

FindCUDAToolkit: Add dependency between cusparse and nvJitLink

Starting in CUDA 12.0 cusparse uses nvJitLink. As part of verifying this PR I also corrected the nvJitLink dependencies
Robert Maynard 2 anni fa
parent
commit
516d807423
1 ha cambiato i file con 9 aggiunte e 6 eliminazioni
  1. 9 6
      Modules/FindCUDAToolkit.cmake

+ 9 - 6
Modules/FindCUDAToolkit.cmake

@@ -1022,12 +1022,20 @@ if(CUDAToolkit_FOUND)
     endif()
   endif()
 
+  if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.0.0)
+    _CUDAToolkit_find_and_add_import_lib(nvJitLink)
+    _CUDAToolkit_find_and_add_import_lib(nvJitLink_static DEPS cudart_static_deps)
+  endif()
+
   _CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library
-  foreach (cuda_lib cublasLt cufft curand cusparse nppc nvjpeg)
+  foreach (cuda_lib cublasLt cufft curand nppc nvjpeg)
     _CUDAToolkit_find_and_add_import_lib(${cuda_lib})
     _CUDAToolkit_find_and_add_import_lib(${cuda_lib}_static DEPS culibos)
   endforeach()
 
+  _CUDAToolkit_find_and_add_import_lib(cusparse DEPS nvJitLink)
+  _CUDAToolkit_find_and_add_import_lib(cusparse_static DEPS nvJitLink_static culibos)
+
   if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.0.0)
     # cublas depends on cublasLt
     # https://docs.nvidia.com/cuda/archive/11.0/cublas/index.html#static-library
@@ -1114,11 +1122,6 @@ if(CUDAToolkit_FOUND)
     endif()
   endif()
 
-  if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.0.0)
-    _CUDAToolkit_find_and_add_import_lib(nvJitLink DEPS cuda_driver)
-    _CUDAToolkit_find_and_add_import_lib(nvJitLink_static DEPS cuda_driver)
-  endif()
-
   _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins DEPS cuda_driver)
   _CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink)
   if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0)