From 191b23db356f04b7501cfc818c45a1a4db66d7db Mon Sep 17 00:00:00 2001 From: peterjc123 Date: Sat, 30 May 2020 01:37:47 +0800 Subject: [PATCH] Add randomtemp to build scripts (#448) --- conda/pytorch-nightly/bld.bat | 14 ++++++++++++++ windows/build_pytorch.bat | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/conda/pytorch-nightly/bld.bat b/conda/pytorch-nightly/bld.bat index 78cef768e..2d11a3eff 100644 --- a/conda/pytorch-nightly/bld.bat +++ b/conda/pytorch-nightly/bld.bat @@ -65,6 +65,20 @@ if "%CUDA_VERSION%" == "80" ( set "CUDAHOSTCXX=%VS140COMNTOOLS%\..\..\VC\bin\amd64\cl.exe" ) +:: randomtemp is used to resolve the intermittent build error related to CUDA. +:: code: https://github.com/peterjc123/randomtemp +:: issue: https://github.com/pytorch/pytorch/issues/25393 +:: +:: Previously, CMake uses CUDA_NVCC_EXECUTABLE for finding nvcc and then +:: the calls are redirected to sccache. sccache looks for the actual nvcc +:: in PATH, and then pass the arguments to it. +:: Currently, randomtemp is placed before sccache (%TMP_DIR_WIN%\bin\nvcc) +:: so we are actually pretending sccache instead of nvcc itself. +curl -kL https://github.com/peterjc123/randomtemp/releases/download/v0.3/randomtemp.exe --output %SRC_DIR%\tmp_bin\randomtemp.exe +set RANDOMTEMP_EXECUTABLE=%SRC_DIR%\tmp_bin\nvcc.exe +set CUDA_NVCC_EXECUTABLE=%SRC_DIR%\tmp_bin\randomtemp.exe +set RANDOMTEMP_BASEDIR=%SRC_DIR%\tmp_bin + :cuda_end set CMAKE_GENERATOR=Ninja diff --git a/windows/build_pytorch.bat b/windows/build_pytorch.bat index 45399233f..e753014b8 100644 --- a/windows/build_pytorch.bat +++ b/windows/build_pytorch.bat @@ -101,6 +101,20 @@ if "%USE_SCCACHE%" == "1" ( set CUDA_NVCC_EXECUTABLE=%CD%\tmp_bin\nvcc set ADDITIONAL_PATH=%CD%\tmp_bin set SCCACHE_IDLE_TIMEOUT=1500 + + :: randomtemp is used to resolve the intermittent build error related to CUDA. + :: code: https://github.com/peterjc123/randomtemp + :: issue: https://github.com/pytorch/pytorch/issues/25393 + :: + :: Previously, CMake uses CUDA_NVCC_EXECUTABLE for finding nvcc and then + :: the calls are redirected to sccache. sccache looks for the actual nvcc + :: in PATH, and then pass the arguments to it. + :: Currently, randomtemp is placed before sccache (%TMP_DIR_WIN%\bin\nvcc) + :: so we are actually pretending sccache instead of nvcc itself. + curl -kL https://github.com/peterjc123/randomtemp/releases/download/v0.3/randomtemp.exe --output %CD%\tmp_bin\randomtemp.exe + set RANDOMTEMP_EXECUTABLE=%CD%\tmp_bin\nvcc.exe + set CUDA_NVCC_EXECUTABLE=%CD%\tmp_bin\randomtemp.exe + set RANDOMTEMP_BASEDIR=%CD%\tmp_bin ) )