@@ -12,6 +12,7 @@ name: Windows CUDA x64
1212on :
1313 workflow_dispatch :
1414 inputs :
15+ # TODO: Add cuda_version input to allow running only CUDA 12 or 13 builds for debugging
1516 # TODO: Right now we don't correctly determine when things have changed and we require a
1617 # rebuild, so for now we just manually trigger rebuilds between runs.
1718 restore_build_cache :
3334
3435jobs :
3536 Build :
36- runs-on : windows-2025
37+ runs-on : ${{ matrix.runs-on }}
3738 strategy :
3839 fail-fast : false
3940 matrix :
4041 python-version : ['3.13']
4142 platform : [x64]
43+ cuda-version : ['12', '13']
44+ include :
45+ # CUDA 12: Supports Maxwell (5.0) through Blackwell (10.0)
46+ - cuda-version : ' 12'
47+ runs-on : ' windows-2025'
48+ cuda-installer : ' cuda_12.9.1_windows_network.exe'
49+ cuda-path-version : ' v12.9'
50+ cudnn-archive : ' cudnn-windows-x86_64-9.18.1.3_cuda12-archive.zip'
51+ cudnn-folder : ' cudnn-windows-x86_64-9.18.1.3_cuda12-archive'
52+ cuda-arch-bin : ' 5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0;10.0'
53+ cuda-arch-ptx : ' 10.0'
54+ cache-key : ' nvidia-deps-cuda-12.9.1-cudnn-9.18.1.3'
55+ # CUDA 13: Supports Turing (7.5) through Blackwell (12.0)
56+ - cuda-version : ' 13'
57+ runs-on : ' windows-2025'
58+ cuda-installer : ' cuda_13.1.1_windows_network.exe'
59+ cuda-path-version : ' v13.1'
60+ cudnn-archive : ' cudnn-windows-x86_64-9.18.1.3_cuda13-archive.zip'
61+ cudnn-folder : ' cudnn-windows-x86_64-9.18.1.3_cuda13-archive'
62+ cuda-arch-bin : ' 7.5;8.0;8.6;8.9;9.0;10.0;12.0'
63+ cuda-arch-ptx : ' 12.0'
64+ cache-key : ' nvidia-deps-cuda-13.1.1-cudnn-9.18.1.3'
4265 env :
4366 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
4467 SDIST : 0
4568 ENABLE_HEADLESS : 0
4669 ENABLE_CONTRIB : 1
4770 ENABLE_ROLLING : ${{ inputs.rolling_build && 1 || 0 }}
4871 OPENCV_TEST_DATA_PATH : ${{ github.workspace }}\opencv_extra\testdata
72+ CUDA_ARCH_BIN : ${{ matrix.cuda-arch-bin }}
73+ CUDA_ARCH_PTX : ${{ matrix.cuda-arch-ptx }}
4974 steps :
5075 - name : Cleanup
5176 shell : bash
7297 uses : actions/cache@v3
7398 with :
7499 path : .deps/Nvidia
75- key : nvidia-deps-cuda-12.4.0-cudnn-8.9.7.29
100+ key : ${{ matrix.cache-key }}
76101 - name : Clone NVIDIA dependencies
77102 if : steps.cache-nvidia-deps.outputs.cache-hit != 'true'
78103 env :
@@ -85,27 +110,26 @@ jobs:
85110 shell : bash
86111 - name : 🔧 Install NVIDIA CUDA Toolkit
87112 run : |
88- $installer_path = ".deps/Nvidia/cuda_12.4.0_windows_network.exe "
113+ $installer_path = ".deps/Nvidia/${{ matrix.cuda-installer }} "
89114 if (-not (Test-Path $installer_path)) {
90115 throw "CUDA Toolkit installer not found at $installer_path"
91116 }
92- echo "Installing CUDA Toolkit silently..."
93- $arguments = "-s nvcc_12.4 cudart_12.4 cublas_12.4 cublas_dev_12.4 cufft_12.4 cufft_dev_12.4 npp_12.4 npp_dev_12.4"
94- Start-Process -FilePath $installer_path -ArgumentList $arguments -Wait -NoNewWindow
117+ echo "Installing CUDA ${{ matrix.cuda-version }} Toolkit silently..."
118+ Start-Process -FilePath $installer_path -ArgumentList "-s" -Wait -NoNewWindow
95119 echo "Adding CUDA to PATH..."
96- $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4 "
120+ $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\${{ matrix.cuda-path-version }} "
97121 echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
98122 Copy-Item -Path "$CUDA_PATH/bin/*" -Destination . -Include "*.dll"
99123 shell : pwsh
100124 - name : 🔧 Install NVIDIA CuDNN
101125 run : |
102- $cudnn_path = ".deps/Nvidia/cudnn-windows-x86_64-8.9.7.29_cuda12- archive.zip "
126+ $cudnn_path = ".deps/Nvidia/${{ matrix. cudnn-archive }} "
103127 if (-not (Test-Path $cudnn_path)) {
104128 throw "CuDNN archive not found at $cudnn_path"
105129 }
106- echo "Installing CuDNN..."
130+ echo "Installing CuDNN for CUDA ${{ matrix.cuda-version }} ..."
107131 7z x $cudnn_path
108- $CUDNN_PATH = "D:/a/opencv-python-cuda/opencv-python-cuda/cudnn-windows-x86_64-8.9.7.29_cuda12-archive "
132+ $CUDNN_PATH = "D:/a/opencv-python-cuda/opencv-python-cuda/${{ matrix. cudnn-folder }} "
109133 echo "CUDNN_LIBRARY=$CUDNN_PATH/lib/x64/cudnn.lib" | Out-File -FilePath $env:GITHUB_ENV -Append
110134 echo "CUDNN_INCLUDE_DIR=$CUDNN_PATH/include" | Out-File -FilePath $env:GITHUB_ENV -Append
111135 Copy-Item -Path "$CUDNN_PATH/bin/*" -Destination . -Include "*.dll"
@@ -116,9 +140,9 @@ jobs:
116140 if : ${{ inputs.restore_build_cache && !inputs.rolling_build }}
117141 with :
118142 path : _skbuild
119- key : ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
143+ key : ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}- ${{ hashFiles('**/CMakeLists.txt') }}
120144 restore-keys : |
121- ${{ runner.os }}-${{ matrix.python-version }}-
145+ ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}-
122146
123147 - name : Build a package
124148 # CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
@@ -140,11 +164,11 @@ jobs:
140164 if : ${{ inputs.save_build_cache && !inputs.rolling_build }}
141165 with :
142166 path : _skbuild
143- key : ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
167+ key : ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}- ${{ hashFiles('**/CMakeLists.txt') }}
144168 - name : Saving all wheels
145169 uses : actions/upload-artifact@v4
146170 with :
147- name : wheel-cuda-${{ matrix.platform }}
171+ name : wheel-cuda${{ matrix.cuda-version }} -${{ matrix.platform }}
148172 path : wheelhouse/opencv*
149173
150174 Test :
@@ -158,6 +182,7 @@ jobs:
158182 matrix :
159183 python-version : ['3.12']
160184 platform : [x64]
185+ cuda-version : ['12', '13']
161186 env :
162187 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
163188 OPENCV_TEST_DATA_PATH : ${{ github.workspace }}\opencv_extra\testdata
@@ -182,7 +207,7 @@ jobs:
182207 - name : Download a wheel accordingly to matrix
183208 uses : actions/download-artifact@v4
184209 with :
185- name : wheel-cuda-${{ matrix.platform }}
210+ name : wheel-cuda${{ matrix.cuda-version }} -${{ matrix.platform }}
186211 path : wheelhouse/
187212 - name : Package installation
188213 run : |
0 commit comments