mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Remove CUDA 9.2 and older references from our cmake (#65065)
Summary: Removes old CUDA references in our cuda.cmake Pull Request resolved: https://github.com/pytorch/pytorch/pull/65065 Reviewed By: malfet Differential Revision: D30992673 Pulled By: janeyx99 fbshipit-source-id: 85b524089ed57e5acbc71720267cf05e24a8c20a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
67570a60ba
commit
9af6fe991c
@ -38,8 +38,8 @@ endif()
|
||||
message(STATUS "Caffe2: CUDA detected: " ${CUDA_VERSION})
|
||||
message(STATUS "Caffe2: CUDA nvcc is: " ${CUDA_NVCC_EXECUTABLE})
|
||||
message(STATUS "Caffe2: CUDA toolkit directory: " ${CUDA_TOOLKIT_ROOT_DIR})
|
||||
if(CUDA_VERSION VERSION_LESS 9.2)
|
||||
message(FATAL_ERROR "PyTorch requires CUDA 9.2 or above.")
|
||||
if(CUDA_VERSION VERSION_LESS 10.2)
|
||||
message(FATAL_ERROR "PyTorch requires CUDA 10.2 or above.")
|
||||
endif()
|
||||
|
||||
if(CUDA_FOUND)
|
||||
@ -281,17 +281,15 @@ if(CAFFE2_STATIC_LINK_CUDA AND NOT WIN32)
|
||||
set_property(
|
||||
TARGET caffe2::cublas PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcublas_static.a")
|
||||
if(CUDA_VERSION VERSION_GREATER_EQUAL 10.1)
|
||||
set_property(
|
||||
TARGET caffe2::cublas APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcublasLt_static.a")
|
||||
# Add explicit dependency to cudart_static to fix
|
||||
# libcublasLt_static.a.o): undefined reference to symbol 'cudaStreamWaitEvent'
|
||||
# error adding symbols: DSO missing from command line
|
||||
set_property(
|
||||
TARGET caffe2::cublas APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${CUDA_cudart_static_LIBRARY}" rt dl)
|
||||
endif()
|
||||
set_property(
|
||||
TARGET caffe2::cublas APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcublasLt_static.a")
|
||||
# Add explicit dependency to cudart_static to fix
|
||||
# libcublasLt_static.a.o): undefined reference to symbol 'cudaStreamWaitEvent'
|
||||
# error adding symbols: DSO missing from command line
|
||||
set_property(
|
||||
TARGET caffe2::cublas APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"${CUDA_cudart_static_LIBRARY}" rt dl)
|
||||
else()
|
||||
set_property(
|
||||
TARGET caffe2::cublas PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
@ -429,84 +427,10 @@ else()
|
||||
list(APPEND CUDA_NVCC_FLAGS "-DONNX_NAMESPACE=onnx_c2")
|
||||
endif()
|
||||
|
||||
# CUDA 9.0 & 9.1 require GCC version <= 5
|
||||
# Although they support GCC 6, but a bug that wasn't fixed until 9.2 prevents
|
||||
# them from compiling the std::tuple header of GCC 6.
|
||||
# See Sec. 2.2.1 of
|
||||
# https://developer.download.nvidia.com/compute/cuda/9.2/Prod/docs/sidebar/CUDA_Toolkit_Release_Notes.pdf
|
||||
if((CUDA_VERSION VERSION_EQUAL 9.0) OR
|
||||
(CUDA_VERSION VERSION_GREATER 9.0 AND CUDA_VERSION VERSION_LESS 9.2))
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
|
||||
NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0 AND
|
||||
CUDA_HOST_COMPILER STREQUAL CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR
|
||||
"CUDA ${CUDA_VERSION} is not compatible with std::tuple from GCC version "
|
||||
">= 6. Please upgrade to CUDA 9.2 or set the following environment "
|
||||
"variable to use another version (for example): \n"
|
||||
" export CUDAHOSTCXX='/usr/bin/gcc-5'\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# CUDA 9.0 / 9.1 require MSVC version < 19.12
|
||||
# CUDA 9.2 require MSVC version < 19.13
|
||||
# CUDA 10.0 require MSVC version < 19.20
|
||||
if((CUDA_VERSION VERSION_EQUAL 9.0) OR
|
||||
(CUDA_VERSION VERSION_GREATER 9.0 AND CUDA_VERSION VERSION_LESS 9.2))
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
|
||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.12 AND
|
||||
NOT DEFINED ENV{CUDAHOSTCXX})
|
||||
message(FATAL_ERROR
|
||||
"CUDA ${CUDA_VERSION} is not compatible with MSVC toolchain version "
|
||||
">= 19.12. (a.k.a Visual Studio 2017 Update 5, VS 15.5) "
|
||||
"Please upgrade to CUDA >= 9.2 or set the following environment "
|
||||
"variable to use another version (for example): \n"
|
||||
" set \"CUDAHOSTCXX=C:\\Program Files (x86)\\Microsoft Visual Studio"
|
||||
"\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.11.25503\\bin\\HostX64\\x64\\cl.exe\"\n")
|
||||
endif()
|
||||
elseif(CUDA_VERSION VERSION_EQUAL 9.2)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
|
||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.14 AND
|
||||
NOT DEFINED ENV{CUDAHOSTCXX})
|
||||
message(FATAL_ERROR
|
||||
"CUDA ${CUDA_VERSION} is not compatible with MSVC toolchain version "
|
||||
">= 19.14. (a.k.a Visual Studio 2017 Update 7, VS 15.7) "
|
||||
"Please upgrade to CUDA >= 10.0 or set the following environment "
|
||||
"variable to use another version (for example): \n"
|
||||
" set \"CUDAHOSTCXX=C:\\Program Files (x86)\\Microsoft Visual Studio"
|
||||
"\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.13.26132\\bin\\HostX64\\x64\\cl.exe\"\n")
|
||||
endif()
|
||||
elseif(CUDA_VERSION VERSION_EQUAL 10.0)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND
|
||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20 AND
|
||||
NOT DEFINED ENV{CUDAHOSTCXX})
|
||||
message(FATAL_ERROR
|
||||
"CUDA ${CUDA_VERSION} is not compatible with MSVC toolchain version "
|
||||
">= 19.20. (a.k.a Visual Studio 2019, VS 16.0) "
|
||||
"Please upgrade to CUDA >= 10.1 or set the following environment "
|
||||
"variable to use another version (for example): \n"
|
||||
" set \"CUDAHOSTCXX=C:\\Program Files (x86)\\Microsoft Visual Studio"
|
||||
"\\2017\\Enterprise\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX64\\x64\\cl.exe\"\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Don't activate VC env again for Ninja generators with MSVC on Windows if CUDAHOSTCXX is not defined
|
||||
# by adding --use-local-env.
|
||||
if(MSVC AND CMAKE_GENERATOR STREQUAL "Ninja" AND NOT DEFINED ENV{CUDAHOSTCXX})
|
||||
list(APPEND CUDA_NVCC_FLAGS "--use-local-env")
|
||||
# For CUDA < 9.2, --cl-version xxx is also required.
|
||||
# We could detect cl version according to the following variable
|
||||
# https://cmake.org/cmake/help/latest/variable/MSVC_TOOLSET_VERSION.html#variable:MSVC_TOOLSET_VERSION.
|
||||
# 140 = VS 2015 (14.0)
|
||||
# 141 = VS 2017 (15.0)
|
||||
if(CUDA_VERSION VERSION_LESS 9.2)
|
||||
if(MSVC_TOOLSET_VERSION EQUAL 140)
|
||||
list(APPEND CUDA_NVCC_FLAGS "--cl-version" "2015")
|
||||
elseif(MSVC_TOOLSET_VERSION EQUAL 141)
|
||||
list(APPEND CUDA_NVCC_FLAGS "--cl-version" "2017")
|
||||
else()
|
||||
message(STATUS "We could not auto-detect the cl-version for MSVC_TOOLSET_VERSION=${MSVC_TOOLSET_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# setting nvcc arch flags
|
||||
|
Reference in New Issue
Block a user