mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Fix CUDA check for gcc > 5.
Summary: In response to https://github.com/caffe2/caffe2/pull/504 , this PR modifies the gcc compiler check for CUDA slightly. All ABI since [gcc-3](https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html) are compatible with eachother. The check from https://github.com/caffe2/caffe2/pull/504 forced the 'regular' CXX / CC compiler to be set to gcc < 6 but this is not required. According to the documentation for [FindCUDA](https://cmake.org/cmake/help/v3.0/module/FindCUDA.html), `CUDA_HOST_COMPILER` is set to `CMAKE_C_COMPILER` by default. This PR checks if `CMAKE_C_COMPILER` is too new for CUDA 8 and whether `CUDA_HOST_COMPILER` is set to `CMAKE_C_COMPILER`. It also modifies the message slightly. Closes https://github.com/caffe2/caffe2/pull/525 Differential Revision: D5590749 Pulled By: Yangqing fbshipit-source-id: 89f9ea7aecc787d6b74bf794da8aea82fc547ec1
This commit is contained in:
committed by
Facebook Github Bot
parent
1c0d20d58c
commit
218f4506fd
@ -285,14 +285,13 @@ if(USE_CUDA)
|
||||
include(cmake/Cuda.cmake)
|
||||
# CUDA 8.0 requires GCC 5
|
||||
if(HAVE_CUDA)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
|
||||
NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
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 8.0 is not compatible with GCC version >= 6. "
|
||||
"Use the following options to use another version (for example): \n"
|
||||
" -DCMAKE_CXX_COMPILER=/usr/bin/g++-5\n"
|
||||
" -DCMAKE_C_COMPILER=/usr/bin/gcc-5\n"
|
||||
" -DCUDA_HOST_COMPILER:FILEPATH=/usr/bin/gcc-5\n")
|
||||
"Use the following option to use another version (for example): \n"
|
||||
" -DCUDA_HOST_COMPILER=/usr/bin/gcc-5\n")
|
||||
endif()
|
||||
endif()
|
||||
# ---[ CUDNN
|
||||
|
Reference in New Issue
Block a user