Skip to content

Commit 0f4e159

Browse files
authored
Windows CUDA 12.4 changes (#1725)
* Windows CUDA 12.4 changes Refrence: #1376 * Update cudnn to 8.9.7.29 to align with pytorch/pytorch#120642
1 parent 7276365 commit 0f4e159

File tree

6 files changed

+98
-4
lines changed

6 files changed

+98
-4
lines changed

.github/workflows/build-magma-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: windows-2019
1818
strategy:
1919
matrix:
20-
cuda_version: ["121", "118"]
20+
cuda_version: ["124", "121", "118"]
2121
config: ["Release", "Debug"]
2222
env:
2323
CUDA_VERSION: ${{ matrix.cuda_version }}

conda/pytorch-nightly/bld.bat

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ if "%build_with_cuda%" == "" goto cuda_flags_end
2020
set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%desired_cuda%
2121
set CUDA_BIN_PATH=%CUDA_PATH%\bin
2222
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all
23-
set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6
23+
set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0
2424
if "%desired_cuda%" == "11.8" (
25-
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;3.7+PTX;9.0
25+
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;3.7+PTX
2626
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
2727
)
2828
if "%desired_cuda%" == "12.1" (
29-
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;9.0
29+
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
30+
)
31+
if "%desired_cuda%" == "12.4" (
3032
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
3133
)
3234

windows/cuda124.bat

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@echo off
2+
3+
set MODULE_NAME=pytorch
4+
5+
IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" (
6+
call internal\clone.bat
7+
cd ..
8+
) ELSE (
9+
call internal\clean.bat
10+
)
11+
IF ERRORLEVEL 1 goto :eof
12+
13+
call internal\check_deps.bat
14+
IF ERRORLEVEL 1 goto :eof
15+
16+
REM Check for optional components
17+
18+
set USE_CUDA=
19+
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
20+
21+
IF "%NVTOOLSEXT_PATH%"=="" (
22+
IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" (
23+
set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt
24+
) ELSE (
25+
echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing
26+
exit /b 1
27+
)
28+
)
29+
30+
IF "%CUDA_PATH_V124%"=="" (
31+
IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin\nvcc.exe" (
32+
set "CUDA_PATH_V124=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
33+
) ELSE (
34+
echo CUDA 12.4 not found, failing
35+
exit /b 1
36+
)
37+
)
38+
39+
IF "%BUILD_VISION%" == "" (
40+
set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0
41+
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all
42+
) ELSE (
43+
set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90
44+
)
45+
46+
set "CUDA_PATH=%CUDA_PATH_V124%"
47+
set "PATH=%CUDA_PATH_V124%\bin;%PATH%"
48+
49+
:optcheck
50+
51+
call internal\check_opts.bat
52+
IF ERRORLEVEL 1 goto :eof
53+
54+
call internal\copy.bat
55+
IF ERRORLEVEL 1 goto :eof
56+
57+
call internal\setup.bat
58+
IF ERRORLEVEL 1 goto :eof

windows/internal/build_magma.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ cd magma
3535
mkdir build && cd build
3636

3737
set GPU_TARGET=All
38+
if "%CUVER_NODOT%" == "124" (
39+
set CUDA_ARCH_LIST=-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90
40+
)
3841
if "%CUVER_NODOT%" == "121" (
3942
set CUDA_ARCH_LIST=-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90
4043
)

windows/internal/cuda_install.bat

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ if exist "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%
2121

2222
if %CUDA_VER% EQU 118 goto cuda118
2323
if %CUDA_VER% EQU 121 goto cuda121
24+
if %CUDA_VER% EQU 124 goto cuda124
2425

2526
echo CUDA %CUDA_VERSION_STR% is not supported
2627
exit /b 1
@@ -79,6 +80,33 @@ xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32"
7980

8081
goto cuda_common
8182

83+
:cuda124
84+
85+
set CUDA_INSTALL_EXE=cuda_12.4.0_551.61_windows.exe
86+
if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" (
87+
curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%"
88+
if errorlevel 1 exit /b 1
89+
set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%"
90+
set "ARGS=cuda_profiler_api_12.4 thrust_12.4 nvcc_12.4 cuobjdump_12.4 nvprune_12.4 nvprof_12.4 cupti_12.4 cublas_12.4 cublas_dev_12.4 cudart_12.4 cufft_12.4 cufft_dev_12.4 curand_12.4 curand_dev_12.4 cusolver_12.4 cusolver_dev_12.4 cusparse_12.4 cusparse_dev_12.4 npp_12.4 npp_dev_12.4 nvrtc_12.4 nvrtc_dev_12.4 nvml_dev_12.4 nvjitlink_12.4 nvtx_12.4"
91+
)
92+
93+
set CUDNN_FOLDER=cudnn-windows-x86_64-8.9.7.29_cuda12-archive
94+
set CUDNN_LIB_FOLDER="lib"
95+
set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip"
96+
if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" (
97+
curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
98+
if errorlevel 1 exit /b 1
99+
set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
100+
)
101+
102+
@REM cuDNN 8.3+ required zlib to be installed on the path
103+
echo Installing ZLIB dlls
104+
curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip"
105+
7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib"
106+
xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32"
107+
108+
goto cuda_common
109+
82110
:cuda_common
83111
:: NOTE: We only install CUDA if we don't have it installed already.
84112
:: With GHA runners these should be pre-installed as part of our AMI process

windows/internal/smoke_test.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ if "%CUDA_VERSION%" == "118" (
8080
if "%CUDA_VERSION%" == "121" (
8181
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.1 -c nvidia -c pytorch-nightly"
8282
)
83+
if "%CUDA_VERSION%" == "124" (
84+
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.4 -c nvidia -c pytorch-nightly"
85+
)
8386

8487
rmdir /s /q conda
8588
del miniconda.exe

0 commit comments

Comments
 (0)