|
24 | 24 | description: "Save build cache." |
25 | 25 | required: false |
26 | 26 | type: boolean |
27 | | - default: true |
| 27 | + default: false |
28 | 28 | rolling_build: |
29 | 29 | description: "Use latest commit from upstream OpenCV repo. Cache settings will be ignored." |
30 | 30 | required: false |
@@ -124,7 +124,7 @@ jobs: |
124 | 124 | echo "Adding CUDA to PATH..." |
125 | 125 | $CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\${{ matrix.cuda-path-version }}" |
126 | 126 | echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append |
127 | | - Copy-Item -Path "$CUDA_PATH/bin/*" -Destination . -Include "*.dll" |
| 127 | + Copy-Item -Path "$CUDA_PATH\bin\*.dll" -Destination . |
128 | 128 | shell: pwsh |
129 | 129 | - name: 🔧 Install NVIDIA CuDNN |
130 | 130 | run: | |
@@ -162,6 +162,35 @@ jobs: |
162 | 162 | restore-keys: | |
163 | 163 | ${{ runner.os }}-${{ matrix.python-version }}-cuda${{ matrix.cuda-version }}- |
164 | 164 |
|
| 165 | + - name: Remove unused CUDA DLLs |
| 166 | + # Only bundle CUDA DLLs that cv2.pyd actually needs (determined via PE import analysis). |
| 167 | + # This removes ~1.3 GB of unused libraries (cusparse, cusolver, curand, nvrtc, etc.) |
| 168 | + run: | |
| 169 | + $keep = @( |
| 170 | + "cublas64_*", "cublasLt64_*", "cudart64_*", "cudnn*", "cufft64_*", |
| 171 | + "nppc64_*", "nppial64_*", "nppicc64_*", "nppidei64_*", "nppif64_*", |
| 172 | + "nppig64_*", "nppim64_*", "nppist64_*", "nppitc64_*" |
| 173 | + ) |
| 174 | + # Remove from project root (where setup.py picks up *.dll) |
| 175 | + # and recursively from _skbuild (cmake-install and setuptools staging dirs) |
| 176 | + foreach ($dir in @(".", "_skbuild")) { |
| 177 | + Get-ChildItem -Path $dir -Filter "*.dll" -Recurse -ErrorAction SilentlyContinue | Where-Object { |
| 178 | + $name = $_.Name |
| 179 | + $is_cuda = $name -match '^\w+64_\d' |
| 180 | + $is_kept = $false |
| 181 | + foreach ($pattern in $keep) { |
| 182 | + if ($name -like $pattern) { $is_kept = $true; break } |
| 183 | + } |
| 184 | + $is_cuda -and -not $is_kept |
| 185 | + } | ForEach-Object { |
| 186 | + $size = [math]::Round($_.Length / 1MB) |
| 187 | + $rel = Resolve-Path -Relative $_.FullName |
| 188 | + echo "Removing $rel (${size} MB)" |
| 189 | + Remove-Item $_.FullName |
| 190 | + } |
| 191 | + } |
| 192 | + shell: pwsh |
| 193 | + |
165 | 194 | - name: Build a package |
166 | 195 | # CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version |
167 | 196 | run: | |
|
0 commit comments