Skip to content

Commit ee6bfd3

Browse files
authored
Cleanup (#281)
* Trim verbose doc comments, redundant test docstrings, and decorative dividers * Remove useless assertions, dead helpers, section dividers, and redundant docstrings * Move large doc comments to docs/, add tested doc examples Move tutorial-length comments from source to proper doc pages: - noise/prelude.rs -> docs/experimental/composable-noise.md - engine_type.rs -> docs/user-guide/engine-selection.md - fault_tolerance.rs trimmed (content already in docs/user-guide/fault-tolerance.md) - classical.rs trait methods trimmed All doc examples are tested via the unified Rust test crate (13 new tests). * Fix all doctests: 778 passing, 0 ignored, 0 failing - Convert 26 ignored doctests to runnable with proper imports and setup - Fix 1 pre-existing failure (Python example missing language tag) - Change Python examples from ignore to python language tag - Change pseudocode examples from ignore to text - cuQuantum examples: ignore -> no_run (compile-checked, needs GPU .so at runtime) * Replace cuQuantum static linking with runtime dlopen Load cuQuantum/CUDA shared libraries at runtime via libloading instead of linking at build time. This means doctests run everywhere: on GPU machines they exercise real hardware, without GPU they get a graceful NotAvailable error via the ? operator. Removes the cuquantum_stub cfg and all function stubs from build.rs. Stub path now emits only type definitions. The loader searches CUQUANTUM_ROOT, ~/.pecos/deps, CUDA_PATH, and system paths. * Clean remaining doc boilerplate, fix no_run doctests - Trim "This module/crate/struct/trait provides" from 40 doc comments - Make 5 no_run doctests fully runnable (qasm, simulator test utils) - Change 6 pseudocode doctests from no_run to text * Remove section dividers, trim comprehensive/generic boilerplate - Replace 211 ASCII art section dividers with clean headers in 8 files - Remove "Comprehensive" from 9 test file doc comments - Remove 16 "This generic implementation" boilerplate lines from math.rs * Remove section dividers from 15 more files (-544 lines) * Remove section dividers from 10 more files (-276 lines) * Remove todo!() panic in verify_matrix, dead trait method, empty placeholder files * Replace dangerous unwrap() calls with proper error handling QASM parser no longer panics on malformed input -- returns parse errors instead. Engine code uses expect() with clear invariant messages or restructured to avoid unwraps entirely. * Replace unwraps with expect/error handling in pecos-phir, pecos-num, pecos-build - pecos-num: as_slice().unwrap() now documents contiguity requirement - pecos-build: download thread panics return errors instead of crashing - pecos-phir: regex captures and lock acquisitions use expect with reasons * Replace unwraps in op.rs and cppsparsestab with expect/helpers * Replace unwraps in GPU sims, circuit passes, HUGR compiler, LDPC decoders * Replace unwraps in examples and Python bindings Examples now use ? operator instead of unwrap(), teaching users good error handling. Python bindings use expect() with clear invariant messages instead of bare unwrap() that would crash the interpreter. * Replace unwraps in LLVM bindings, QuEST engine, PyMatching, coordinator * Replace remaining production unwraps across Python bindings and Rust code Python bindings: 130 unwraps eliminated -- prevents interpreter crashes on conversion failures, lock poisoning, and array operations. Rust: 28 unwraps replaced across 22 files in GPU sims, decoders, circuit display, PHIR engine, and simulators. * Fix dangling benchmark module reference, suppress bindgen warnings * Fix PauliSet::insert doc examples to pass by reference * lint * Add missing # Errors and # Panics doc sections for clippy * Fix GPU resource cleanup races and add concurrent stress tests - map_async callbacks no longer panic from GPU worker threads when receiver is dropped (expect -> silent drop on send) - All 6 GPU simulator types now have explicit Drop that polls the device to completion before resources are freed - New concurrent stress test: 8 threads creating/destroying simulators in parallel, plus rapid sequential create/destroy cycles * Fix gpu_stab_multi callback panics and receiver diagnostics * Guard cuquantum doctests with is_cuquantum_available() check Doctests now pass on systems without cuQuantum by early-returning Ok(()) when the libraries aren't available. On systems with cuQuantum, they still exercise the real GPU code. * Revert cuquantum doctest guards -- test runner handles hardware detection Doctests should test real GPU code without availability guards. The test runner (pecos rust test) already excludes pecos-cuquantum from workspace tests and only includes it when cuQuantum SDK is detected. * Standardize GPU availability pattern: always import, check at construction Python simulators/__init__.py no longer gates CudaStateVec/CudaStabilizer imports behind is_cuquantum_available(). Classes are always importable when the package is installed -- GPU availability is checked at construction time with a clear RuntimeError, not silently set to None. * Remove cuda feature gate from pecos-quest, use runtime detection only pecos-quest now always compiles CUDA engine code. GPU availability is detected at runtime via libloading (cuda_loader.rs), matching the pecos-cuquantum pattern. No more --features cuda needed. Removes cuda feature from pecos-quest, pecos, pecos-rslib, and benchmarks Cargo.toml files. Simplifies CLI check/clippy/test commands. * lint * Fix cast_sign_loss warning in concurrent GPU test * Fix PR review findings: cuTensor handle lifetime, norm panic, versioned sonames * Fix concurrent GPU test: reborrow AtomicUsize before move closure * lint * Remove cuda feature flag from CI workflows (now runtime-detected) * Remove dead cuda_feature matrix variable from python-release workflow * Deduplicate GPU Drop impls, fix CuQuantumBackend drop order, use cudaMemset * Exclude pecos-cuquantum from CI workspace tests (needs cuQuantum SDK) * Use pecos rust test in CI for runtime hardware detection * lint * Bump wasmtime from 42 to 43 * update lock * Use pecos rust test on all platforms for runtime hardware detection * Bump wgpu from 28 to 29 * Add cuda_check probe binary, use it in pecos rust test for runtime GPU detection * Bump sha2 from 0.10 to 0.11 * Bump Qulacs from 0.6.12 to 0.6.13 * Bump QuEST from v4.1.0 to v4.2.0 * Remove workspace pecos.toml, use per-crate manifests as source of truth * Use versioned paths for LLVM and CUDA deps (llvm-14, cuda-12.6.3) * Remove silent auto-install of cuQuantum/cuTensor from build.rs * Improve pecos setup: show status summary, versioned paths, point build.rs to setup * Remove silent auto-migration, let pecos setup prompt for legacy path renames * Show existing install path in pecos install, prompt before replacing system version * Update build error messages to point to pecos setup, show install paths * Use cargo run instead of installed binary in Justfile, remove check-cli * update locks * Suppress all warnings from third-party Qulacs C++ code * Request adapter's actual GPU limits instead of wgpu defaults * Fix clippy warning in install_cmd * lint * Use debug mode for CLI in Justfile (faster build, CLI does no heavy computation) * Update CI and docs to use versioned LLVM path (llvm-14) * Fix Windows CI: configure MSVC linker before LLVM install to avoid Git link.exe conflict * Fix Windows CI: write complete .cargo/config.toml to avoid duplicate [env] sections * Fix Windows link error: add missing arg_parse.cc to pymatching stim build * Move SUMMARY-AST.md to docs/development/ast-infrastructure.md * Fix QuEST v4.2.0 GPU stub: add 4th template param (ApplyTransp) to anyCtrlAnyTargDenseMatr * Fix QuEST v4.2.0 GPU stub: densmatr_allTargDiagMatr now has 4 bool params * Mark GPU batching stress tests as #[ignore] (need large VRAM, fail on CI GPUs) * Make GPU batching tests adaptive: work on any GPU, no ignore markers * Make GPU batching tests handle OOM gracefully via catch_unwind * lint * Reject software renderers in GPU probe (only accept DiscreteGpu/IntegratedGpu)
1 parent bdf1021 commit ee6bfd3

311 files changed

Lines changed: 5614 additions & 7114 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cuda-build-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
echo "To run GPU tests locally:"
111111
echo " 1. Install CUDA Toolkit: https://developer.nvidia.com/cuda-downloads"
112112
echo " 2. Install cuQuantum SDK: https://developer.nvidia.com/cuquantum-sdk"
113-
echo " 3. Run: cargo test -p pecos-cuquantum --features cuda"
113+
echo " 3. Run: cargo test -p pecos-cuquantum"
114114
echo " 4. Build Python package: maturin develop -m python/pecos-rslib-cuda/Cargo.toml"
115115
echo ""
116116
echo "For self-hosted CI runners with GPU support:"

.github/workflows/python-release.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ jobs:
7575
- os: ubuntu-latest
7676
architecture: x86_64
7777
cibw_archs: x86_64
78-
cuda_feature: "--features cuda"
7978
install_cuda: true
8079
# GCC Toolset 13 paths for CUDA compatibility
8180
gcc_path_prefix: "/opt/rh/gcc-toolset-13/root/usr/bin:"
@@ -90,7 +89,6 @@ jobs:
9089
# architecture: aarch64
9190
# runner: ubuntu-24.04-arm
9291
# cibw_archs: aarch64
93-
# cuda_feature: ""
9492
# install_cuda: false
9593
# gcc_path_prefix: ""
9694
# gcc_ld_path: ""
@@ -101,17 +99,14 @@ jobs:
10199
# pointer_traits bug with CXX crate's contiguous iterators in C++20.
102100
- os: macos-15
103101
architecture: aarch64
104-
cuda_feature: ""
105102
install_cuda: false
106103
- os: macos-15-intel
107104
architecture: x86_64
108-
cuda_feature: ""
109105
install_cuda: false
110106
# Windows x86_64 with CUDA support
111107
# Note: Uses specific sub-packages to avoid VS integration bug (see Jimver/cuda-toolkit#382)
112108
- os: windows-2022
113109
architecture: x86_64
114-
cuda_feature: "--features cuda"
115110
install_cuda: true
116111

117112
steps:
@@ -192,11 +187,10 @@ jobs:
192187
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
193188
# Linux configuration - GCC Toolset and CUDA paths are conditional via matrix variables
194189
CIBW_ENVIRONMENT_LINUX: >
195-
PATH=${{ matrix.gcc_path_prefix }}$HOME/.cargo/bin:$HOME/.pecos/deps/llvm/bin:/usr/local/cuda-12.6/bin:$PATH
190+
PATH=${{ matrix.gcc_path_prefix }}$HOME/.cargo/bin:$HOME/.pecos/deps/llvm-14/bin:/usr/local/cuda-12.6/bin:$PATH
196191
LD_LIBRARY_PATH=${{ matrix.gcc_ld_path }}$LD_LIBRARY_PATH
197-
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm
192+
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm-14
198193
CUDA_PATH=/usr/local/cuda-12.6
199-
MATURIN_PEP517_ARGS="${{ matrix.cuda_feature }}"
200194
CIBW_BEFORE_ALL_LINUX: |
201195
curl -sSf https://sh.rustup.rs | sh -s -- -y
202196
source $HOME/.cargo/env
@@ -223,8 +217,8 @@ jobs:
223217
pipx run abi3audit --strict --report {wheel}
224218
# macOS configuration
225219
CIBW_ENVIRONMENT_MACOS: >
226-
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm/bin:$PATH
227-
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm
220+
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm-14/bin:$PATH
221+
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm-14
228222
MACOSX_DEPLOYMENT_TARGET=13.2
229223
CIBW_BEFORE_ALL_MACOS: |
230224
curl -sSf https://sh.rustup.rs | sh -s -- -y
@@ -237,22 +231,18 @@ jobs:
237231
printf '#!/bin/bash\nunset DYLD_LIBRARY_PATH\nexec /usr/bin/codesign "$@"\n' > $HOME/.pecos/bin/codesign
238232
chmod +x $HOME/.pecos/bin/codesign
239233
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
240-
PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/deps/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
234+
PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/deps/llvm-14/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
241235
pipx run abi3audit --strict --report {wheel}
242236
# Windows configuration - CUDA via Jimver/cuda-toolkit (installed before cibuildwheel)
243237
CIBW_ENVIRONMENT_WINDOWS: >
244-
PATH="C:\\Users\\runneradmin\\.pecos\\deps\\llvm\\bin;$PATH"
245-
LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\deps\\llvm"
246-
MATURIN_PEP517_ARGS="${{ matrix.cuda_feature }}"
238+
PATH="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14\\bin;$PATH"
239+
LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14"
247240
CIBW_BEFORE_ALL_WINDOWS: >
248241
echo "=== Installing LLVM using pecos ===" &&
249242
rustup update &&
250-
echo "=== Running pecos install llvm ===" &&
251243
cargo run --release -p pecos-cli -- install llvm --force &&
252244
echo "=== Checking LLVM installation ===" &&
253-
(test -d "C:\\Users\\runneradmin\\.pecos\\deps\\llvm" && echo "LLVM directory exists" && ls -la "C:\\Users\\runneradmin\\.pecos\\deps\\llvm" && (ls -la "C:\\Users\\runneradmin\\.pecos\\deps\\llvm\\bin" || echo "bin directory not found")) || (echo "ERROR: LLVM directory not found!" && exit 1) &&
254-
echo "=== Verifying LLVM_SYS_140_PREFIX ===" &&
255-
echo "LLVM_SYS_140_PREFIX will be set to: C:\\Users\\runneradmin\\.pecos\\deps\\llvm"
245+
(test -d "C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14" && echo "LLVM directory exists") || (echo "ERROR: LLVM directory not found!" && exit 1)
256246
# Install delvewheel and patch it to ignore ext-ms-win-* API sets
257247
# (delvewheel ignores api-ms-win-* but not ext-ms-win-* which are also Windows API sets)
258248
CIBW_BEFORE_BUILD_WINDOWS: >
@@ -283,8 +273,8 @@ jobs:
283273
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
284274
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
285275
CIBW_ENVIRONMENT_LINUX: >
286-
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm/bin:$PATH
287-
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm
276+
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm-14/bin:$PATH
277+
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm-14
288278
CIBW_BEFORE_ALL_LINUX: |
289279
curl -sSf https://sh.rustup.rs | sh -s -- -y
290280
source $HOME/.cargo/env
@@ -294,12 +284,12 @@ jobs:
294284
auditwheel repair -w {dest_dir} {wheel} &&
295285
pipx run abi3audit --strict --report {wheel}
296286
CIBW_ENVIRONMENT_MACOS: >
297-
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm/bin:$PATH
298-
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm
287+
PATH=$HOME/.cargo/bin:$HOME/.pecos/deps/llvm-14/bin:$PATH
288+
LLVM_SYS_140_PREFIX=$HOME/.pecos/deps/llvm-14
299289
MACOSX_DEPLOYMENT_TARGET=13.2
300290
CIBW_BEFORE_ALL_MACOS: |
301291
source $HOME/.cargo/env 2>/dev/null || { curl -sSf https://sh.rustup.rs | sh -s -- -y && source $HOME/.cargo/env; }
302-
if [ ! -d "$HOME/.pecos/deps/llvm/bin" ]; then
292+
if [ ! -d "$HOME/.pecos/deps/llvm-14/bin" ]; then
303293
rustup update
304294
cargo run --release -p pecos-cli -- install llvm --force
305295
else
@@ -309,19 +299,19 @@ jobs:
309299
printf '#!/bin/bash\nunset DYLD_LIBRARY_PATH\nexec /usr/bin/codesign "$@"\n' > $HOME/.pecos/bin/codesign
310300
chmod +x $HOME/.pecos/bin/codesign
311301
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
312-
PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/deps/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
302+
PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/deps/llvm-14/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
313303
pipx run abi3audit --strict --report {wheel}
314304
CIBW_ENVIRONMENT_WINDOWS: >
315-
PATH="C:\\Users\\runneradmin\\.pecos\\deps\\llvm\\bin;$PATH"
316-
LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\deps\\llvm"
305+
PATH="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14\\bin;$PATH"
306+
LLVM_SYS_140_PREFIX="C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14"
317307
CIBW_BEFORE_ALL_WINDOWS: >
318308
rustup update &&
319-
if not exist "C:\Users\runneradmin\.pecos\deps\llvm\bin" (cargo run --release -p pecos-cli -- install llvm --force) else (echo LLVM already installed from pecos-rslib build)
309+
if not exist "C:\Users\runneradmin\.pecos\deps\llvm-14\bin" (cargo run --release -p pecos-cli -- install llvm --force) else (echo LLVM already installed from pecos-rslib build)
320310
CIBW_BEFORE_BUILD_WINDOWS: >
321311
pip install delvewheel &&
322312
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"
323313
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
324-
delvewheel repair -v --add-path "C:\\Users\\runneradmin\\.pecos\\deps\\llvm\\bin" --no-dll "combase.dll;rmclient.dll" -w {dest_dir} {wheel} &&
314+
delvewheel repair -v --add-path "C:\\Users\\runneradmin\\.pecos\\deps\\llvm-14\\bin" --no-dll "combase.dll;rmclient.dll" -w {dest_dir} {wheel} &&
325315
pipx run abi3audit --strict --report {wheel}
326316
327317
- name: Upload pecos-rslib-llvm wheels

.github/workflows/python-test.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
id: cache-llvm
102102
uses: actions/cache@v4
103103
with:
104-
path: ~/.pecos/deps/llvm
104+
path: ~/.pecos/deps/llvm-14
105105
key: llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ runner.arch }}
106106

107107
# Install LLVM first (needed before CLI install since inkwell requires LLVM_SYS_140_PREFIX)
@@ -110,11 +110,30 @@ jobs:
110110
if: steps.cache-llvm.outputs.cache-hit != 'true' && runner.os != 'Windows'
111111
run: cargo run -p pecos-cli --release -- install llvm
112112

113+
# Configure MSVC linker BEFORE any cargo build (Git's link.exe conflicts with MSVC's)
114+
- name: Configure MSVC linker (Windows)
115+
if: runner.os == 'Windows'
116+
shell: pwsh
117+
run: |
118+
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
119+
$vsPath = & $vsWhere -latest -property installationPath
120+
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
121+
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
122+
Select-Object -First 1 -ExpandProperty FullName
123+
if ($linkPath) {
124+
New-Item -ItemType Directory -Force -Path .cargo | Out-Null
125+
$escapedPath = $linkPath.Replace('\', '/')
126+
"[target.x86_64-pc-windows-msvc]`nlinker = `"$escapedPath`"" | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8
127+
} else {
128+
Write-Error "Could not find MSVC link.exe"
129+
exit 1
130+
}
131+
113132
- name: Install LLVM ${{ env.LLVM_VERSION }} (Windows)
114133
if: steps.cache-llvm.outputs.cache-hit != 'true' && runner.os == 'Windows'
115134
run: cargo run -p pecos-cli --release -- install llvm
116135

117-
# Configure LLVM environment (must happen before CLI install)
136+
# Configure LLVM environment
118137
- name: Configure LLVM environment (Unix)
119138
if: runner.os != 'Windows'
120139
run: |
@@ -134,27 +153,25 @@ jobs:
134153
# Add LLVM bin to PATH
135154
$llvmBinDir = Join-Path -Path $env:PECOS_LLVM -ChildPath "bin"
136155
if (Test-Path $llvmBinDir) {
137-
$env:PATH = "$llvmBinDir;$env:PATH"
138156
"$llvmBinDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
139157
}
140158
141-
# Configure MSVC linker
159+
# Rewrite .cargo/config.toml with both linker and LLVM config
160+
# (pecos install llvm may have already written this, so overwrite cleanly)
142161
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
143162
$vsPath = & $vsWhere -latest -property installationPath
144163
$linkPath = Get-ChildItem -Path "$vsPath\VC\Tools\MSVC" -Recurse -Filter "link.exe" |
145164
Where-Object { $_.FullName -like "*\bin\Hostx64\x64\*" } |
146165
Select-Object -First 1 -ExpandProperty FullName
147-
148-
if ($linkPath) {
149-
New-Item -ItemType Directory -Force -Path .cargo | Out-Null
150-
$escapedPath = $linkPath.Replace('\', '/')
151-
$escapedLLVMPath = $env:LLVM_SYS_140_PREFIX.Replace('\', '/')
152-
$configContent = "[target.x86_64-pc-windows-msvc]`nlinker = `"$escapedPath`"`n`n[env]`nLLVM_SYS_140_PREFIX = `"$escapedLLVMPath`""
153-
$configContent | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8
154-
} else {
155-
Write-Error "Could not find MSVC link.exe"
156-
exit 1
157-
}
166+
$escapedLinker = $linkPath.Replace('\', '/')
167+
$escapedLLVM = $env:LLVM_SYS_140_PREFIX.Replace('\', '/')
168+
@"
169+
[target.x86_64-pc-windows-msvc]
170+
linker = "$escapedLinker"
171+
172+
[env]
173+
LLVM_SYS_140_PREFIX = { value = "$escapedLLVM", force = true }
174+
"@ | Out-File -FilePath ".cargo\config.toml" -Encoding UTF8
158175
159176
# Now install CLI (LLVM env is set, inkwell can find it)
160177
- name: Install PECOS CLI

.github/workflows/rust-test.yml

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
id: cache-llvm
7575
uses: actions/cache@v4
7676
with:
77-
path: ~/.pecos/deps/llvm
77+
path: ~/.pecos/deps/llvm-14
7878
key: llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ runner.arch }}
7979

8080
- name: Install LLVM ${{ env.LLVM_VERSION }}
@@ -181,7 +181,7 @@ jobs:
181181
id: cache-llvm
182182
uses: actions/cache@v4
183183
with:
184-
path: ~/.pecos/deps/llvm
184+
path: ~/.pecos/deps/llvm-14
185185
key: llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ runner.arch }}
186186

187187
- name: Install LLVM ${{ env.LLVM_VERSION }} (Unix)
@@ -226,48 +226,33 @@ jobs:
226226

227227
- name: Compile tests (macOS)
228228
if: matrix.os == 'macos-latest'
229-
run: |
230-
unset LIBRARY_PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH PKG_CONFIG_PATH
231-
export LIBRARY_PATH=/usr/lib
232-
cargo test --no-run --workspace --exclude pecos-quest --exclude pecos-decoders --features llvm
233-
cargo test --no-run -p pecos-quest --features cpu
234-
cargo test --no-run -p pecos-decoders --all-features
229+
run: cargo build -p pecos-cli --release
235230

236231
- name: Compile tests (Linux)
237232
if: matrix.os == 'ubuntu-latest'
238233
run: |
239-
cargo test --no-run --workspace --exclude pecos-decoders --exclude pecos-gpu-sims --features llvm,cuda
240-
cargo test --no-run -p pecos-decoders --all-features
234+
# Use `pecos rust test` for runtime hardware detection (cuQuantum, GPU)
235+
# Dry-run: just compile, the run step below does the actual test
236+
cargo build -p pecos-cli --release
241237
242238
- name: Compile tests (Windows)
243239
if: matrix.os == 'windows-latest'
244-
run: |
245-
cargo test --no-run --workspace --exclude pecos-quest --exclude pecos-decoders --features llvm
246-
cargo test --no-run -p pecos-quest --features cpu
247-
cargo test --no-run -p pecos-decoders --all-features
240+
run: cargo build -p pecos-cli --release
248241

249242
- name: Run tests (macOS)
250243
if: matrix.os == 'macos-latest'
244+
env:
245+
# Prevent Homebrew/system library paths from interfering with linking
246+
LIBRARY_PATH: /usr/lib
251247
run: |
252-
unset LIBRARY_PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH PKG_CONFIG_PATH
253-
export LIBRARY_PATH=/usr/lib
254-
cargo test --workspace --exclude pecos-quest --exclude pecos-decoders --features llvm
255-
cargo test -p pecos-quest --features cpu
256-
cargo test -p pecos-decoders --all-features
248+
unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH PKG_CONFIG_PATH
249+
cargo run -p pecos-cli --release -- rust test
257250
258251
- name: Run tests (Linux)
259252
if: matrix.os == 'ubuntu-latest'
260253
run: |
261-
cargo test --workspace --exclude pecos-decoders --exclude pecos-gpu-sims --features llvm,cuda
262-
cargo test -p pecos-decoders --all-features
254+
cargo run -p pecos-cli --release -- rust test
263255
264256
- name: Run tests (Windows)
265257
if: matrix.os == 'windows-latest'
266-
run: |
267-
cargo test --workspace --exclude pecos-quest --exclude pecos-decoders --exclude pecos-rslib --features llvm --lib --bins --tests --examples
268-
cargo test -p pecos-quest --features cpu --lib --bins --tests --examples
269-
cargo test -p pecos-decoders --all-features --lib --bins --tests --examples
270-
cd crates/pecos && cargo test --doc --features llvm && cd ../..
271-
cargo test --workspace --exclude pecos-quest --exclude pecos-decoders --exclude pecos-rslib --exclude pecos --features llvm --doc
272-
cargo test -p pecos-quest --doc
273-
cargo test -p pecos-decoders --all-features --doc
258+
run: cargo run -p pecos-cli --release -- rust test

.github/workflows/test-docs-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
id: cache-llvm
5252
uses: actions/cache@v4
5353
with:
54-
path: ~/.pecos/deps/llvm
54+
path: ~/.pecos/deps/llvm-14
5555
key: llvm-${{ env.LLVM_VERSION }}-${{ runner.os }}-${{ runner.arch }}
5656

5757
- name: Install LLVM ${{ env.LLVM_VERSION }}

0 commit comments

Comments
 (0)