2024-01-02 11:29:13 +00:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2024-02-29 20:09:43 +00:00
|
|
|
index 9194e520bb0..d05fdcfb6cb 100644
|
2024-01-02 11:29:13 +00:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2024-02-29 20:09:43 +00:00
|
|
|
@@ -1160,10 +1160,6 @@ if(BUILD_SHARED_LIBS)
|
2024-01-02 11:29:13 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/cmake/Modules_CUDA_fix
|
|
|
|
DESTINATION share/cmake/Caffe2/
|
|
|
|
COMPONENT dev)
|
|
|
|
- install(FILES
|
|
|
|
- ${PROJECT_SOURCE_DIR}/cmake/Modules/FindCUDAToolkit.cmake
|
|
|
|
- DESTINATION share/cmake/Caffe2/
|
|
|
|
- COMPONENT dev)
|
|
|
|
install(FILES
|
|
|
|
${PROJECT_SOURCE_DIR}/cmake/Modules/FindCUSPARSELT.cmake
|
|
|
|
DESTINATION share/cmake/Caffe2/
|
|
|
|
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake
|
2024-02-29 20:09:43 +00:00
|
|
|
index c7595774d81..4fc43771810 100644
|
2024-01-02 11:29:13 +00:00
|
|
|
--- a/cmake/public/cuda.cmake
|
|
|
|
+++ b/cmake/public/cuda.cmake
|
2024-02-29 20:09:43 +00:00
|
|
|
@@ -61,9 +61,15 @@ find_package(CUDAToolkit REQUIRED)
|
|
|
|
cmake_policy(POP)
|
2024-01-02 11:29:13 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
if(NOT CMAKE_CUDA_COMPILER_VERSION VERSION_EQUAL CUDAToolkit_VERSION)
|
|
|
|
- message(FATAL_ERROR "Found two conflicting CUDA versions:\n"
|
2024-01-02 11:29:13 +00:00
|
|
|
- "V${CMAKE_CUDA_COMPILER_VERSION} in '${CUDA_INCLUDE_DIRS}' and\n"
|
2024-02-29 20:09:43 +00:00
|
|
|
- "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIRS}'")
|
2024-01-02 11:29:13 +00:00
|
|
|
+ if(CUDA_INCLUDE_DIRS IN_LIST CUDAToolkit_INCLUDE_DIR)
|
|
|
|
+ message(STATUS "CUDA_INCLUDE_DIRS is a substring of CUDAToolkit_INCLUDE_DIR. "
|
|
|
|
+ "Setting CUDA_INCLUDE_DIRS to CUDAToolkit_INCLUDE_DIR.")
|
|
|
|
+ set(CUDA_INCLUDE_DIRS "${CUDAToolkit_INCLUDE_DIR}")
|
|
|
|
+ else()
|
|
|
|
+ message(FATAL_ERROR "Found two conflicting CUDA installs:\n"
|
|
|
|
+ "V${CMAKE_CUDA_COMPILER_VERSION} in '${CUDA_INCLUDE_DIRS}' and\n"
|
|
|
|
+ "V${CUDAToolkit_VERSION} in '${CUDAToolkit_INCLUDE_DIR}'")
|
|
|
|
+ endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT TARGET CUDA::nvToolsExt)
|
|
|
|
diff --git a/tools/setup_helpers/cmake.py b/tools/setup_helpers/cmake.py
|
|
|
|
index fb19b66dfba..3f83bef32fe 100644
|
|
|
|
--- a/tools/setup_helpers/cmake.py
|
|
|
|
+++ b/tools/setup_helpers/cmake.py
|
|
|
|
@@ -207,6 +207,8 @@ class CMake:
|
|
|
|
"BUILDING_WITH_TORCH_LIBS",
|
|
|
|
"CUDA_HOST_COMPILER",
|
|
|
|
"CUDA_NVCC_EXECUTABLE",
|
|
|
|
+ "CUDAToolkit_ROOT",
|
|
|
|
+ "CUDAToolkit_INCLUDE_DIR",
|
|
|
|
"CUDA_SEPARABLE_COMPILATION",
|
|
|
|
"CUDNN_LIBRARY",
|
|
|
|
"CUDNN_INCLUDE_DIR",
|