Skip to content

Commit

Permalink
Refactor: use version instead of major version in windows build (pyto…
Browse files Browse the repository at this point in the history
…rch#49156)

Summary:
Fixes pytorch#49219

1. update version instead of major version for env var of CUDA_VERSION
2. update related scripts

Pull Request resolved: pytorch#49156

Reviewed By: glaringlee

Differential Revision: D25535530

Pulled By: ezyang

fbshipit-source-id: 0712227f2b06b45ee68efc42717c4308fea1abdc
  • Loading branch information
mszhanyi authored and facebook-github-bot committed Dec 14, 2020
1 parent 6cfd7c3 commit 4188c37
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 80 deletions.
3 changes: 3 additions & 0 deletions .circleci/cimodel/data/simple/util/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ def __init__(self, major, minor):
self.minor = minor

super().__init__([self.major, self.minor], "cuda")

def __str__(self):
return f"{self.major}.{self.minor}"
3 changes: 2 additions & 1 deletion .circleci/cimodel/data/windows_build_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def gen_tree(self):
props_dict["executor"] = "windows-with-nvidia-gpu"

props_dict["cuda_version"] = (
miniutils.quote(str(self.cuda_version.major))
miniutils.quote(str(self.cuda_version))
if self.cuda_version
else "cpu"
)

props_dict["name"] = "_".join(name_parts)

return [{key_name: props_dict}]
Expand Down
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ pytorch_windows_params: &pytorch_windows_params
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down Expand Up @@ -675,7 +675,7 @@ jobs:
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down Expand Up @@ -737,7 +737,7 @@ jobs:
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down Expand Up @@ -8077,7 +8077,7 @@ workflows:
- postnightly
- pytorch_windows_build:
build_environment: pytorch-win-vs2019-cuda10-cudnn7-py3
cuda_version: "10"
cuda_version: "10.1"
name: pytorch_windows_vs2019_py36_cuda10.1_build
python_version: "3.6"
use_cuda: "1"
Expand All @@ -8086,7 +8086,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_test:
build_environment: pytorch-win-vs2019-cuda10-cudnn7-py3
cuda_version: "10"
cuda_version: "10.1"
executor: windows-with-nvidia-gpu
name: pytorch_windows_vs2019_py36_cuda10.1_test1
python_version: "3.6"
Expand All @@ -8099,7 +8099,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_test:
build_environment: pytorch-win-vs2019-cuda10-cudnn7-py3
cuda_version: "10"
cuda_version: "10.1"
executor: windows-with-nvidia-gpu
name: pytorch_windows_vs2019_py36_cuda10.1_test2
python_version: "3.6"
Expand All @@ -8112,7 +8112,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_build:
build_environment: pytorch-win-vs2019-cuda11-cudnn8-py3
cuda_version: "11"
cuda_version: "11.1"
name: pytorch_windows_vs2019_py36_cuda11.1_build
python_version: "3.6"
use_cuda: "1"
Expand All @@ -8121,7 +8121,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_test:
build_environment: pytorch-win-vs2019-cuda11-cudnn8-py3
cuda_version: "11"
cuda_version: "11.1"
executor: windows-with-nvidia-gpu
filters:
branches:
Expand All @@ -8140,7 +8140,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_test:
build_environment: pytorch-win-vs2019-cuda11-cudnn8-py3
cuda_version: "11"
cuda_version: "11.1"
executor: windows-with-nvidia-gpu
filters:
branches:
Expand Down Expand Up @@ -8204,7 +8204,7 @@ workflows:
vc_year: "2019"
- pytorch_windows_test:
build_environment: pytorch-win-vs2019-cuda10-cudnn7-py3
cuda_version: "10"
cuda_version: "10.1"
filters:
branches:
only:
Expand Down
10 changes: 4 additions & 6 deletions .circleci/scripts/windows_cuda_install.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#!/bin/bash
set -eux -o pipefail

if [[ "$CUDA_VERSION" == "10" ]]; then
cuda_complete_version="10.1"
if [[ "$CUDA_VERSION" =~ ^10.* ]]; then
cuda_installer_name="cuda_10.1.243_426.00_win10"
msbuild_project_dir="CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions"
cuda_install_packages="nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 cublas_10.1 cublas_dev_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1"
elif [[ "$CUDA_VERSION" == "11" ]]; then
cuda_complete_version="11.1"
elif [[ "$CUDA_VERSION" =~ ^11.* ]]; then
cuda_installer_name="cuda_11.1.0_456.43_win10"
msbuild_project_dir="visual_studio_integration/CUDAVisualStudioIntegration/extras/visual_studio_integration/MSBuildExtensions"
cuda_install_packages="nvcc_11.1 cuobjdump_11.1 nvprune_11.1 nvprof_11.1 cupti_11.1 cublas_11.1 cublas_dev_11.1 cudart_11.1 cufft_11.1 cufft_dev_11.1 curand_11.1 curand_dev_11.1 cusolver_11.1 cusolver_dev_11.1 cusparse_11.1 cusparse_dev_11.1 npp_11.1 npp_dev_11.1 nvrtc_11.1 nvrtc_dev_11.1 nvml_dev_11.1"
Expand All @@ -16,7 +14,7 @@ else
exit 1
fi

if [[ "${CUDA_VERSION}" != "10" && "${JOB_EXECUTOR}" == "windows-with-nvidia-gpu" ]]; then
if [[ "$CUDA_VERSION" =~ ^10.* && "${JOB_EXECUTOR}" == "windows-with-nvidia-gpu" ]]; then
cuda_install_packages="${cuda_install_packages} Display.Driver"
fi

Expand Down Expand Up @@ -48,7 +46,7 @@ then
export NVTOOLSEXT_PATH="C:\\Program Files\\NVIDIA Corporation\\NvToolsExt\\"
fi

if ! ls "/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${cuda_complete_version}/bin/nvcc.exe"
if ! ls "/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${CUDA_VERSION}/bin/nvcc.exe"
then
echo "CUDA installation failed"
mkdir -p /c/w/build-results
Expand Down
12 changes: 5 additions & 7 deletions .circleci/scripts/windows_cudnn_install.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/bash
set -eux -o pipefail

if [[ "$CUDA_VERSION" == "10" ]]; then
cuda_complete_version="10.1"
cudnn_installer_name="cudnn-10.1-windows10-x64-v7.6.4.38"
elif [[ "$CUDA_VERSION" == "11" ]]; then
cuda_complete_version="11.1"
cudnn_installer_name="cudnn-11.1-windows-x64-v8.0.5.39"
if [[ "$CUDA_VERSION" =~ ^10.* ]]; then
cudnn_installer_name="cudnn-${CUDA_VERSION}-windows10-x64-v7.6.4.38"
elif [[ "$CUDA_VERSION" =~ ^11.* ]]; then
cudnn_installer_name="cudnn-${CUDA_VERSION}-windows-x64-v8.0.5.39"
else
echo "CUDNN for CUDA_VERSION $CUDA_VERSION is not supported yet"
exit 1
Expand All @@ -16,6 +14,6 @@ cudnn_installer_link="https://ossci-windows.s3.amazonaws.com/${cudnn_installer_n

curl --retry 3 -O $cudnn_installer_link
7z x ${cudnn_installer_name}.zip -ocudnn
cp -r cudnn/cuda/* "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${cuda_complete_version}/"
cp -r cudnn/cuda/* "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${CUDA_VERSION}/"
rm -rf cudnn
rm -f ${cudnn_installer_name}.zip
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pytorch_windows_params: &pytorch_windows_params
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down
4 changes: 2 additions & 2 deletions .circleci/verbatim-sources/job-specs/pytorch-job-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ jobs:
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down Expand Up @@ -299,7 +299,7 @@ jobs:
default: ""
cuda_version:
type: string
default: "10"
default: "10.1"
python_version:
type: string
default: "3.6"
Expand Down
34 changes: 10 additions & 24 deletions .jenkins/pytorch/win-test-helpers/build_pytorch.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,19 @@ if "%VC_VERSION%" == "" (
@echo on
popd

if "%CUDA_VERSION%" == "9" goto cuda_build_9
if "%CUDA_VERSION%" == "10" goto cuda_build_10
if "%CUDA_VERSION%" == "11" goto cuda_build_11
goto cuda_build_end
if not "%USE_CUDA%"=="1" goto cuda_build_end

:cuda_build_9
set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION%

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2
set CUDA_PATH_V9_2=%CUDA_PATH%
rem version transformer, for example 10.1 to 10_1.
set VERSION_SUFFIX=%CUDA_VERSION:.=_%
set CUDA_PATH_V%VERSION_SUFFIX%=%CUDA_PATH%

goto cuda_build_common

:cuda_build_10

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
set CUDA_PATH_V10_1=%CUDA_PATH%

goto cuda_build_common

:cuda_build_11

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
set CUDA_PATH_V11_1=%CUDA_PATH%

goto cuda_build_common

:cuda_build_common
set CUDNN_LIB_DIR=%CUDA_PATH%\lib\x64
set CUDA_TOOLKIT_ROOT_DIR=%CUDA_PATH%
set CUDNN_ROOT_DIR=%CUDA_PATH%
set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt
set PATH=%CUDA_PATH%\bin;%CUDA_PATH%\libnvvp;%PATH%

set CUDNN_LIB_DIR=%CUDA_PATH%\lib\x64
set CUDA_TOOLKIT_ROOT_DIR=%CUDA_PATH%
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
if "%CUDA_VERSION%" == "9" set CUDA_SUFFIX=cuda92
if "%CUDA_VERSION%" == "10" set CUDA_SUFFIX=cuda101
if "%CUDA_VERSION%" == "11" set CUDA_SUFFIX=cuda110
rem remove dot in cuda_version, fox example 11.1 to 111
set VERSION_SUFFIX=%CUDA_VERSION:.=%
set CUDA_SUFFIX=cuda%VERSION_SUFFIX%

if "%CUDA_SUFFIX%" == "" (
echo unknown CUDA version, please set `CUDA_VERSION` to 9, 10 or 11.
echo unknown CUDA version, please set `CUDA_VERSION` higher than 9.2
exit /b 1
)

Expand Down
30 changes: 5 additions & 25 deletions .jenkins/pytorch/win-test-helpers/setup_pytorch_env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,13 @@ if %errorlevel% neq 0 ( exit /b %errorlevel% )

set DISTUTILS_USE_SDK=1

if "%CUDA_VERSION%" == "9" goto cuda_build_9
if "%CUDA_VERSION%" == "10" goto cuda_build_10
if "%CUDA_VERSION%" == "11" goto cuda_build_11
goto cuda_build_end
if not "%USE_CUDA%"=="1" goto cuda_build_end

:cuda_build_9
set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION%

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2
set CUDA_PATH_V9_2=%CUDA_PATH%

goto cuda_build_common

:cuda_build_10

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
set CUDA_PATH_V10_1=%CUDA_PATH%

goto cuda_build_common

:cuda_build_11

set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1
set CUDA_PATH_V11_1=%CUDA_PATH%

goto cuda_build_common

:cuda_build_common
rem version transformer, for example 10.1 to 10_1.
set VERSION_SUFFIX=%CUDA_VERSION:.=_%
set CUDA_PATH_V%VERSION_SUFFIX%=%CUDA_PATH%

set CUDNN_LIB_DIR=%CUDA_PATH%\lib\x64
set CUDA_TOOLKIT_ROOT_DIR=%CUDA_PATH%
Expand Down

0 comments on commit 4188c37

Please sign in to comment.