Skip to content

Commit 0b0d091

Browse files
authored
Windows CUDA 12.1 changes (#1376)
* Windows CUDA 12.1 changes * add CUDA version checks for Windows MAGMA builds * use magma branch without fermi arch
1 parent e0fd49f commit 0b0d091

File tree

6 files changed

+108
-7
lines changed

6 files changed

+108
-7
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: ["118", "117", "116"]
20+
cuda_version: ["121", "118", "117"]
2121
config: ["Release", "Debug"]
2222
env:
2323
CUDA_VERSION: ${{ matrix.cuda_version }}

conda/pytorch-nightly/bld.bat

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,16 @@ 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=3.7+PTX;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
2424
if "%desired_cuda%" == "11.7" (
25+
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;3.7+PTX
2526
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
2627
)
2728
if "%desired_cuda%" == "11.8" (
29+
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;3.7+PTX;9.0
30+
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
31+
)
32+
if "%desired_cuda%" == "12.1" (
2833
set TORCH_CUDA_ARCH_LIST=%TORCH_CUDA_ARCH_LIST%;9.0
2934
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all --threads 2
3035
)

windows/cuda121.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_V121%"=="" (
31+
IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\bin\nvcc.exe" (
32+
set "CUDA_PATH_V121=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1"
33+
) ELSE (
34+
echo CUDA 12.1 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_V121%"
47+
set "PATH=%CUDA_PATH_V121%\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: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ cd magma_cuda%CUVER_NODOT%
2424

2525
if not exist magma (
2626
:: MAGMA 2.5.4 from http://icl.utk.edu/projectsfiles/magma/downloads/ with applied patches from our magma folder
27-
git clone https://github.com/peterjc123/magma.git magma
27+
git clone https://github.com/ptrblck/magma_win.git magma
2828
if errorlevel 1 exit /b 1
2929
) else (
3030
rmdir /S /Q magma\build
@@ -35,8 +35,15 @@ cd magma
3535
mkdir build && cd build
3636

3737
set GPU_TARGET=All
38-
set CUDA_ARCH_LIST= -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70
39-
set "CUDA_ARCH_LIST=%CUDA_ARCH_LIST% -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86"
38+
if "%CUVER_NODOT%" == "121" (
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+
)
41+
if "%CUVER_NODOT%" == "118" (
42+
set CUDA_ARCH_LIST= -gencode arch=compute_37,code=sm_37 -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
43+
)
44+
if "%CUVER_NODOT%" == "117" (
45+
set CUDA_ARCH_LIST= -gencode arch=compute_37,code=sm_37 -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
46+
)
4047

4148
set CC=cl.exe
4249
set CXX=cl.exe

windows/internal/cuda_install.bat

Lines changed: 30 additions & 2 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 117 goto cuda117
2323
if %CUDA_VER% EQU 118 goto cuda118
24+
if %CUDA_VER% EQU 121 goto cuda121
2425

2526
echo CUDA %CUDA_VERSION_STR% is not supported
2627
exit /b 1
@@ -44,7 +45,7 @@ if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" (
4445
set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
4546
)
4647

47-
@REM Cuda 8.3+ required zlib to be installed on the path
48+
@REM cuDNN 8.3+ required zlib to be installed on the path
4849
echo Installing ZLIB dlls
4950
curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip"
5051
7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib"
@@ -71,7 +72,34 @@ if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" (
7172
set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
7273
)
7374

74-
@REM Cuda 8.3+ required zlib to be installed on the path
75+
@REM cuDNN 8.3+ required zlib to be installed on the path
76+
echo Installing ZLIB dlls
77+
curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip"
78+
7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib"
79+
xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32"
80+
81+
goto cuda_common
82+
83+
:cuda121
84+
85+
set CUDA_INSTALL_EXE=cuda_12.1.0_531.14_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.1 thrust_12.1 nvcc_12.1 cuobjdump_12.1 nvprune_12.1 nvprof_12.1 cupti_12.1 cublas_12.1 cublas_dev_12.1 cudart_12.1 cufft_12.1 cufft_dev_12.1 curand_12.1 curand_dev_12.1 cusolver_12.1 cusolver_dev_12.1 cusparse_12.1 cusparse_dev_12.1 npp_12.1 npp_dev_12.1 nvrtc_12.1 nvrtc_dev_12.1 nvml_dev_12.1"
91+
)
92+
93+
set CUDNN_FOLDER=cudnn-windows-x86_64-8.8.1.3_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
75103
echo Installing ZLIB dlls
76104
curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip"
77105
7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib"

windows/internal/smoke_test.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ if "%CUDA_VERSION%" == "117" (
7171
if "%CUDA_VERSION%" == "118" (
7272
set "CONDA_EXTRA_ARGS=pytorch-cuda=11.8 -c nvidia -c pytorch-nightly"
7373
)
74+
if "%CUDA_VERSION%" == "121" (
75+
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.1 -c nvidia -c pytorch-nightly"
76+
)
7477

7578
rmdir /s /q conda
7679
del miniconda.exe

0 commit comments

Comments
 (0)