Skip to content

Commit 0ffb286

Browse files
peterjc123iotamudelta
authored andcommitted
Sync FindCUDA.cmake with upstream cmake repo (pytorch#11880)
Summary: Upstream PR: https://gitlab.kitware.com/cmake/cmake/merge_requests/2391/diffs Pull Request resolved: pytorch#11880 Differential Revision: D9989119 Pulled By: soumith fbshipit-source-id: 66e87367127975a5f1619fe447f74e76f101b503
1 parent 16b9461 commit 0ffb286

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ REM The following two lines are needed for Python 2.7, but the support for it is
202202
set MSSdk=1
203203
set FORCE_PY27_BUILD=1
204204
REM As for CUDA 8, VS2015 Update 3 is also required to build PyTorch. Use the following line.
205-
set "CUDA_HOST_COMPILER=%VS140COMNTOOLS%\..\..\VC\bin\amd64\cl.exe"
205+
set "CUDAHOSTCXX=%VS140COMNTOOLS%\..\..\VC\bin\amd64\cl.exe"
206206
207207
call "%VS150COMNTOOLS%\vcvarsall.bat" x64 -vcvars_ver=14.11
208208
python setup.py install

cmake/Modules_CUDA_fix/upstream/FindCUDA.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105
# the host compiler is constructed with one or more visual studio macros
106106
# such as $(VCInstallDir), that expands out to the path when
107107
# the command is run from within VS.
108+
# If the CUDAHOSTCXX environment variable is set it will
109+
# be used as the default.
108110
#
109111
# CUDA_NVCC_FLAGS
110112
# CUDA_NVCC_FLAGS_<CONFIG>
@@ -531,8 +533,8 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
531533
# Extra user settable flags
532534
cmake_initialize_per_config_variable(CUDA_NVCC_FLAGS "Semi-colon delimit multiple arguments.")
533535

534-
if(DEFINED ENV{CUDA_HOST_COMPILER})
535-
set(CUDA_HOST_COMPILER "$ENV{CUDA_HOST_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
536+
if(DEFINED ENV{CUDAHOSTCXX})
537+
set(CUDA_HOST_COMPILER "$ENV{CUDAHOSTCXX}" CACHE FILEPATH "Host side compiler used by NVCC")
536538
elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
537539
set(_CUDA_MSVC_HOST_COMPILER "$(VCInstallDir)Tools/MSVC/$(VCToolsVersion)/bin/Host$(Platform)/$(PlatformTarget)")
538540
if(MSVC_VERSION LESS 1910)

0 commit comments

Comments
 (0)