@@ -71,24 +71,71 @@ jobs:
7171 fail-fast : false
7272 matrix :
7373 include :
74+ # Linux x86_64 with CUDA support (uses GCC Toolset 13 for CUDA compatibility)
7475 - os : ubuntu-latest
7576 architecture : x86_64
76- - os : ubuntu-latest
77- architecture : aarch64
78- runner : ubuntu-latest
77+ cibw_archs : x86_64
78+ cuda_feature : " --features cuda"
79+ install_cuda : true
80+ # GCC Toolset 13 paths for CUDA compatibility
81+ gcc_path_prefix : " /opt/rh/gcc-toolset-13/root/usr/bin:"
82+ gcc_ld_path : " /opt/rh/gcc-toolset-13/root/usr/lib64:/opt/rh/gcc-toolset-13/root/usr/lib:"
83+ gcc_cc : " /opt/rh/gcc-toolset-13/root/usr/bin/gcc"
84+ gcc_cxx : " /opt/rh/gcc-toolset-13/root/usr/bin/g++"
85+ # Linux aarch64 - DISABLED: LLVM 14 not available in manylinux_2_28 (AlmaLinux 8)
86+ # The prebuilt LLVM 14 binary is incompatible with the container, and
87+ # the llvm-toolset module only provides LLVM 13. Re-enable when we have
88+ # a solution (custom Docker image, build from source, or inkwell LLVM 13 support)
89+ # - os: ubuntu-24.04-arm
90+ # architecture: aarch64
91+ # runner: ubuntu-24.04-arm
92+ # cibw_archs: aarch64
93+ # cuda_feature: ""
94+ # install_cuda: false
95+ # gcc_path_prefix: ""
96+ # gcc_ld_path: ""
97+ # gcc_cc: ""
98+ # gcc_cxx: ""
99+ # macOS without CUDA (NVIDIA dropped macOS CUDA support in 2019)
79100 - os : macos-14
80101 architecture : aarch64
102+ cuda_feature : " "
103+ install_cuda : false
81104 - os : macos-15-intel
82105 architecture : x86_64
106+ cuda_feature : " "
107+ install_cuda : false
108+ # Windows x86_64 with CUDA support
109+ # Note: Uses specific sub-packages to avoid VS integration bug (see Jimver/cuda-toolkit#382)
83110 - os : windows-2022
84111 architecture : x86_64
112+ cuda_feature : " --features cuda"
113+ install_cuda : true
85114
86115 steps :
87116 - uses : actions/checkout@v4
88117 with :
89118 ref : ${{ inputs.sha || github.sha }}
90119 submodules : recursive
91120
121+ # Set up Visual Studio environment on Windows (required for nvcc to find cl.exe)
122+ - name : Set up Visual Studio environment (Windows)
123+ if : runner.os == 'Windows' && matrix.install_cuda
124+ uses : ilammy/msvc-dev-cmd@v1
125+ with :
126+ arch : x64
127+
128+ # Install CUDA on Windows before cibuildwheel (cibuildwheel runs on host, not in containers)
129+ # Uses specific sub-packages to avoid VS 17.3.x bug that hangs on NSight/VS Integration
130+ # See: https://github.com/Jimver/cuda-toolkit/issues/382
131+ - name : Install CUDA Toolkit (Windows)
132+ if : runner.os == 'Windows' && matrix.install_cuda
133+ uses : Jimver/cuda-toolkit@v0.2.29
134+ with :
135+ cuda : ' 12.5.1'
136+ method : ' local'
137+ sub-packages : ' ["nvcc", "cudart", "cublas", "cublas_dev", "thrust"]'
138+
92139 - name : Build wheels
93140 uses : pypa/cibuildwheel@v3.2.1
94141 with :
@@ -98,17 +145,37 @@ jobs:
98145 # Build configuration
99146 CIBW_BUILD : " cp310-*"
100147 CIBW_SKIP : " *-win32 *-manylinux_i686 *-musllinux*"
148+ CIBW_ARCHS_LINUX : ${{ matrix.cibw_archs }}
101149 CIBW_MANYLINUX_X86_64_IMAGE : " manylinux_2_28"
102150 CIBW_MANYLINUX_AARCH64_IMAGE : " manylinux_2_28"
103- # Linux configuration
151+ # Linux configuration - GCC Toolset and CUDA paths are conditional via matrix variables
104152 CIBW_ENVIRONMENT_LINUX : >
105- PATH=$HOME/.cargo/bin:$HOME/.pecos/llvm/bin:$PATH
153+ PATH=${{ matrix.gcc_path_prefix }}$HOME/.cargo/bin:$HOME/.pecos/llvm/bin:/usr/local/cuda-12.6/bin:$PATH
154+ LD_LIBRARY_PATH=${{ matrix.gcc_ld_path }}$LD_LIBRARY_PATH
106155 LLVM_SYS_140_PREFIX=$HOME/.pecos/llvm
156+ CUDA_PATH=/usr/local/cuda-12.6
157+ MATURIN_PEP517_ARGS="${{ matrix.cuda_feature }}"
107158 CIBW_BEFORE_ALL_LINUX : |
108159 curl -sSf https://sh.rustup.rs | sh -s -- -y
109160 source $HOME/.cargo/env
110161 dnf install libffi-devel -y
111- cargo run --release -p pecos-llvm-utils --bin pecos-llvm -- install --force
162+ # Install CUDA Toolkit for GPU support on x86_64 (compile-time only, no GPU needed)
163+ if [ "${{ matrix.install_cuda }}" = "true" ]; then
164+ echo "Installing GCC 13 (required for CUDA 12.6 compatibility)..."
165+ dnf install -y gcc-toolset-13
166+ source /opt/rh/gcc-toolset-13/enable
167+ echo "Installing CUDA Toolkit from NVIDIA repos..."
168+ dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
169+ dnf install -y cuda-nvcc-12-6 cuda-cudart-devel-12-6 libcublas-devel-12-6
170+ export CUDA_PATH=/usr/local/cuda-12.6
171+ export PATH=$CUDA_PATH/bin:$PATH
172+ echo "CUDA installed at $CUDA_PATH"
173+ nvcc --version
174+ gcc --version
175+ else
176+ echo "Skipping CUDA installation (GPU support not enabled for this build)"
177+ fi
178+ cargo run --release -p pecos-dev -- llvm install --force
112179 CIBW_REPAIR_WHEEL_COMMAND_LINUX : >
113180 auditwheel repair -w {dest_dir} {wheel} &&
114181 pipx run abi3audit --strict --report {wheel}
@@ -121,7 +188,7 @@ jobs:
121188 curl -sSf https://sh.rustup.rs | sh -s -- -y
122189 source $HOME/.cargo/env
123190 rustup update
124- cargo run --release -p pecos-llvm-utils --bin pecos- llvm -- install --force
191+ cargo run --release -p pecos-dev -- llvm install --force
125192 # Create a codesign wrapper that strips DYLD_LIBRARY_PATH to prevent
126193 # crashes on macOS 15 when bundled libc++ conflicts with system libc++
127194 mkdir -p $HOME/.pecos/bin
@@ -130,22 +197,29 @@ jobs:
130197 CIBW_REPAIR_WHEEL_COMMAND_MACOS : >
131198 PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
132199 pipx run abi3audit --strict --report {wheel}
133- # Windows configuration
200+ # Windows configuration - CUDA via Jimver/cuda-toolkit (installed before cibuildwheel)
134201 CIBW_ENVIRONMENT_WINDOWS : >
135202 PATH="C:\\Users\\runneradmin\\.pecos\\llvm\\bin;$PATH"
136203 LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\llvm"
204+ MATURIN_PEP517_ARGS="${{ matrix.cuda_feature }}"
137205 CIBW_BEFORE_ALL_WINDOWS : >
138- echo "=== Installing LLVM using pecos-llvm-utils ===" &&
206+ echo "=== Installing LLVM using pecos-dev ===" &&
139207 rustup update &&
140208 echo "=== Running pecos-llvm install ===" &&
141- cargo run --release -p pecos-llvm-utils --bin pecos- llvm -- install --force &&
209+ cargo run --release -p pecos-dev -- llvm install --force &&
142210 echo "=== Checking LLVM installation ===" &&
143211 (test -d "C:\\Users\\runneradmin\\.pecos\\llvm" && echo "LLVM directory exists" && ls -la "C:\\Users\\runneradmin\\.pecos\\llvm" && (ls -la "C:\\Users\\runneradmin\\.pecos\\llvm\\bin" || echo "bin directory not found")) || (echo "ERROR: LLVM directory not found!" && exit 1) &&
144212 echo "=== Verifying LLVM_SYS_140_PREFIX ===" &&
145213 echo "LLVM_SYS_140_PREFIX will be set to: C:\\Users\\runneradmin\\.pecos\\llvm"
146- CIBW_BEFORE_BUILD_WINDOWS : " pip install delvewheel"
214+ # Install delvewheel and patch it to ignore ext-ms-win-* API sets
215+ # (delvewheel ignores api-ms-win-* but not ext-ms-win-* which are also Windows API sets)
216+ CIBW_BEFORE_BUILD_WINDOWS : >
217+ pip install delvewheel &&
218+ python -c "import delvewheel._dll_list as d,inspect,re as r;p=inspect.getfile(d);c=open(p).read();n=chr(10);open(p,'w').write(c.replace(r\"re.compile('api-.*'),\",r\"re.compile('api-.*'),\"+n+r\" re.compile('ext-.*'),\")) if 'ext-.*' not in c else None"
219+ # Note: --no-dll excludes Windows system DLLs that should not be bundled
220+ # combase.dll and rmclient.dll are core Windows components that fail when bundled
147221 CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : >
148- delvewheel repair -w {dest_dir} {wheel} &&
222+ delvewheel repair -v --add-path "C:\\Users\\runneradmin\\.pecos\\llvm\\bin" --no-dll "combase.dll;rmclient.dll" - w {dest_dir} {wheel} &&
149223 pipx run abi3audit --strict --report {wheel}
150224
151225 - name : Upload wheels
@@ -201,6 +275,38 @@ jobs:
201275 python -c 'import pecos_rslib; print(f"pecos_rslib version: {pecos_rslib.__version__}")'
202276 python -c 'import sys; print(f"Python version: {sys.version}")'
203277
278+ - name : Debug DLL loading (Windows)
279+ if : failure() && runner.os == 'Windows'
280+ shell : pwsh
281+ run : |
282+ Write-Host "=== Listing wheel contents ==="
283+ $wheelFile = Get-ChildItem -Path ./pecos-rslib-wheel/*.whl | Select-Object -First 1
284+ python -m zipfile -l $wheelFile
285+
286+ Write-Host "`n=== Finding pecos_rslib installation ==="
287+ $sitePackages = python -c "import site; print(site.getsitepackages()[0])"
288+ Write-Host "Site packages: $sitePackages"
289+
290+ Write-Host "`n=== Listing pecos_rslib directory ==="
291+ Get-ChildItem -Path "$sitePackages\pecos_rslib*" -Recurse | Select-Object FullName, Length
292+
293+ Write-Host "`n=== Checking DLL dependencies with dumpbin ==="
294+ $pydFile = Get-ChildItem -Path "$sitePackages\pecos_rslib\*.pyd" -ErrorAction SilentlyContinue | Select-Object -First 1
295+ if ($pydFile) {
296+ & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe" /dependents $pydFile.FullName 2>&1 | Select-Object -First 50
297+ }
298+
299+ Write-Host "`n=== Checking pecos_rslib.libs directory ==="
300+ $libsDir = "$sitePackages\pecos_rslib.libs"
301+ if (Test-Path $libsDir) {
302+ Get-ChildItem -Path $libsDir | ForEach-Object {
303+ Write-Host "DLL: $($_.Name)"
304+ & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe" /dependents $_.FullName 2>&1 | Select-Object -First 30
305+ }
306+ } else {
307+ Write-Host "No pecos_rslib.libs directory found"
308+ }
309+
204310 build_sdist_quantum_pecos :
205311 needs : build_wheelspecos_rslib
206312 if : |
0 commit comments