@@ -39,13 +39,35 @@ jobs:
3939 matrix :
4040 python-version : ['3.13']
4141 platform : [x64]
42+ cuda-version : ['12', '13']
43+ include :
44+ # CUDA 12: Supports Maxwell (5.0) through Hopper (9.0)
45+ - cuda-version : ' 12'
46+ cuda-installer : ' cuda_12.4.0_windows_network.exe'
47+ cuda-path-version : ' v12.4'
48+ cudnn-archive : ' cudnn-windows-x86_64-8.9.7.29_cuda12-archive.zip'
49+ cudnn-folder : ' cudnn-windows-x86_64-8.9.7.29_cuda12-archive'
50+ cuda-arch-bin : ' 5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0'
51+ cuda-arch-ptx : ' 9.0'
52+ cache-key : ' nvidia-deps-cuda-12.4.0-cudnn-8.9.7.29'
53+ # CUDA 13: Supports Turing (7.5) through Blackwell (12.0)
54+ - cuda-version : ' 13'
55+ cuda-installer : ' cuda_13.1.1_windows_network.exe'
56+ cuda-path-version : ' v13.1'
57+ cudnn-archive : ' cudnn-windows-x86_64-9.18.1.3_cuda13-archive.zip'
58+ cudnn-folder : ' cudnn-windows-x86_64-9.18.1.3_cuda13-archive'
59+ cuda-arch-bin : ' 7.5;8.0;8.6;8.9;9.0;10.0;12.0'
60+ cuda-arch-ptx : ' 12.0'
61+ cache-key : ' nvidia-deps-cuda-13.1.1-cudnn-9.18.1.3'
4262 env :
4363 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
4464 SDIST : 0
4565 ENABLE_HEADLESS : 0
4666 ENABLE_CONTRIB : 1
4767 ENABLE_ROLLING : ${{ inputs.rolling_build && 1 || 0 }}
4868 OPENCV_TEST_DATA_PATH : ${{ github.workspace }}\opencv_extra\testdata
69+ CUDA_ARCH_BIN : ${{ matrix.cuda-arch-bin }}
70+ CUDA_ARCH_PTX : ${{ matrix.cuda-arch-ptx }}
4971 steps :
5072 - name : Cleanup
5173 shell : bash
7294 uses : actions/cache@v3
7395 with :
7496 path : .deps/Nvidia
75- key : nvidia-deps-cuda-13.1.1-cudnn-9.18.1.3
97+ key : ${{ matrix.cache-key }}
7698 - name : Clone NVIDIA dependencies
7799 if : steps.cache-nvidia-deps.outputs.cache-hit != 'true'
78100 env :
@@ -85,26 +107,26 @@ jobs:
85107 shell : bash
86108 - name : 🔧 Install NVIDIA CUDA Toolkit
87109 run : |
88- $installer_path = ".deps/Nvidia/cuda_13.1.1_windows_network.exe "
110+ $installer_path = ".deps/Nvidia/${{ matrix.cuda-installer }} "
89111 if (-not (Test-Path $installer_path)) {
90112 throw "CUDA Toolkit installer not found at $installer_path"
91113 }
92- echo "Installing CUDA Toolkit silently..."
114+ echo "Installing CUDA ${{ matrix.cuda-version }} Toolkit silently..."
93115 Start-Process -FilePath $installer_path -ArgumentList "-s" -Wait -NoNewWindow
94116 echo "Adding CUDA to PATH..."
95- $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.1 "
117+ $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\${{ matrix.cuda-path-version }} "
96118 echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
97119 Copy-Item -Path "$CUDA_PATH/bin/*" -Destination . -Include "*.dll"
98120 shell : pwsh
99121 - name : 🔧 Install NVIDIA CuDNN
100122 run : |
101- $cudnn_path = ".deps/Nvidia/cudnn-windows-x86_64-9.18.1.3_cuda13- archive.zip "
123+ $cudnn_path = ".deps/Nvidia/${{ matrix. cudnn-archive }} "
102124 if (-not (Test-Path $cudnn_path)) {
103125 throw "CuDNN archive not found at $cudnn_path"
104126 }
105- echo "Installing CuDNN..."
127+ echo "Installing CuDNN for CUDA ${{ matrix.cuda-version }} ..."
106128 7z x $cudnn_path
107- $CUDNN_PATH = "D:/a/opencv-python-cuda/opencv-python-cuda/cudnn-windows-x86_64-9.18.1.3_cuda13-archive "
129+ $CUDNN_PATH = "D:/a/opencv-python-cuda/opencv-python-cuda/${{ matrix. cudnn-folder }} "
108130 echo "CUDNN_LIBRARY=$CUDNN_PATH/lib/x64/cudnn.lib" | Out-File -FilePath $env:GITHUB_ENV -Append
109131 echo "CUDNN_INCLUDE_DIR=$CUDNN_PATH/include" | Out-File -FilePath $env:GITHUB_ENV -Append
110132 Copy-Item -Path "$CUDNN_PATH/bin/*" -Destination . -Include "*.dll"
@@ -115,9 +137,9 @@ jobs:
115137 if : ${{ inputs.restore_build_cache && !inputs.rolling_build }}
116138 with :
117139 path : _skbuild
118- key : ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
140+ key : ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}- ${{ hashFiles('**/CMakeLists.txt') }}
119141 restore-keys : |
120- ${{ runner.os }}-${{ matrix.python-version }}-
142+ ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}-
121143
122144 - name : Build a package
123145 # CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
@@ -139,11 +161,11 @@ jobs:
139161 if : ${{ inputs.save_build_cache && !inputs.rolling_build }}
140162 with :
141163 path : _skbuild
142- key : ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
164+ key : ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}- ${{ hashFiles('**/CMakeLists.txt') }}
143165 - name : Saving all wheels
144166 uses : actions/upload-artifact@v4
145167 with :
146- name : wheel-cuda-${{ matrix.platform }}
168+ name : wheel-cuda${{ matrix.cuda-version }} -${{ matrix.platform }}
147169 path : wheelhouse/opencv*
148170
149171 Test :
@@ -157,6 +179,7 @@ jobs:
157179 matrix :
158180 python-version : ['3.12']
159181 platform : [x64]
182+ cuda-version : ['12', '13']
160183 env :
161184 ACTIONS_ALLOW_UNSECURE_COMMANDS : true
162185 OPENCV_TEST_DATA_PATH : ${{ github.workspace }}\opencv_extra\testdata
@@ -181,7 +204,7 @@ jobs:
181204 - name : Download a wheel accordingly to matrix
182205 uses : actions/download-artifact@v4
183206 with :
184- name : wheel-cuda-${{ matrix.platform }}
207+ name : wheel-cuda${{ matrix.cuda-version }} -${{ matrix.platform }}
185208 path : wheelhouse/
186209 - name : Package installation
187210 run : |
0 commit comments