feat: Add GPU support to QuEST on linux devices - #214
Open
jake-arkinstall wants to merge 2 commits into
Open
jake-arkinstall wants to merge 2 commits into
jake-arkinstall wants to merge 2 commits into
Conversation
jake-arkinstall
marked this pull request as ready for review
September 4, 2026 16:28
jake-arkinstall
requested review from
erinaldiq
and
a lite review from Copilot
September 4, 2026 16:28
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The build changes introduce significant Linux build-time dependency/behavior shifts and at least one build-hook error-handling gap that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds Linux GPU backend support for the QuEST simulator plugin, allowing users to select backend="cuda" (QuEST CUDA implementation) or backend="cuquantum" (NVIDIA cuStateVec), with packaging/build updates and tests to validate backend selection and (optionally) backend parity.
Changes:
- Extend
QuestPluginto supportcpu/cuda/cuquantumbackends, including cuQuantum runtime library discovery via installed Python distributions. - Add a
quest-cuquantumoptional dependency group and update wheel build/repair configuration to support shipping GPU plugin variants on Linux. - Add tests for backend selection plus a CUDA-marked parity test with recorded snapshots and precompiled LLVM IR fixtures.
File summaries
| File | Description |
|---|---|
| uv.lock | Adds locked packages and metadata for the quest-cuquantum optional dependency set. |
| selene-ext/simulators/quest/python/tests/test_plugin.py | New unit tests validating backend selection and platform restrictions. |
| selene-ext/simulators/quest/python/tests/test_backend_parity.py | New CUDA-marked parity test comparing CPU/CUDA/cuQuantum outputs when a GPU is available. |
| selene-ext/simulators/quest/python/tests/snapshots/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measurements.yaml | Snapshot data for parity test expected measurement strings. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all.sha256 | Hash for the generated/recorded Guppy build artifact set. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-x86_64-windows-gnu.ll | Precompiled LLVM IR fixture for Windows x86_64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-x86_64-unknown-linux-gnu.ll | Precompiled LLVM IR fixture for Linux x86_64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-sol-x86_64-windows-gnu.ll | Precompiled LLVM IR fixture (sol) for Windows x86_64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-sol-x86_64-unknown-linux-gnu.ll | Precompiled LLVM IR fixture (sol) for Linux x86_64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-sol-x86_64-apple-darwin.ll | Precompiled LLVM IR fixture (sol) for macOS x86_64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-sol-aarch64-unknown-linux-gnu.ll | Precompiled LLVM IR fixture (sol) for Linux aarch64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-sol-aarch64-apple-darwin.ll | Precompiled LLVM IR fixture (sol) for macOS aarch64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-helios-aarch64-apple-darwin.ll | Precompiled LLVM IR fixture (helios) for macOS aarch64. |
| selene-ext/simulators/quest/python/tests/resources/from_guppy/test_backend_parity/test_backends_agree_for_seeded_hadamard_measurements/hadamard_measure_all-aarch64-apple-darwin.ll | Precompiled LLVM IR fixture for macOS aarch64. |
| selene-ext/simulators/quest/python/selene_quest_plugin/plugin.py | Adds backend selection + Linux-only GPU constraints and cuQuantum library path discovery. |
| selene-ext/simulators/quest/Cargo.toml | Introduces Cargo features to build cuda and cuquantum plugin variants. |
| pyproject.toml | Adds quest-cuquantum optional deps, CUDA pytest marker, and Linux wheel build/repair adjustments. |
| hatch_build.py | Adds Hatch build hook logic to compile/copy QuEST GPU variant shared objects during builds. |
| devenv.nix | Updates library path to include WSL library dir for local development. |
| .github/workflows/nitpick.yml | Adjusts clippy/doc steps to avoid --all-features on the QuEST simulator crate. |
| .github/workflows/ci_rust.yml | Adjusts Rust tests to avoid --all-features on the QuEST simulator crate. |
Review details
- Files reviewed: 26/27 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+123
to
+129
| @staticmethod | ||
| def _distribution_file(package: str, filename: str) -> Path: | ||
| installed = distribution(package) | ||
| for file in installed.files or []: | ||
| if file.as_posix().endswith(filename): | ||
| return Path(file.locate()) | ||
| raise FileNotFoundError(f"Could not find {filename!r} in {package!r}") |
Comment on lines
1
to
+9
| [build-system] | ||
| requires = ["hatchling", "packaging"] | ||
| requires = [ | ||
| "hatchling", | ||
| "packaging", | ||
| "custatevec-cu12>=1.8.0; sys_platform == 'linux'", | ||
| "nvidia-cuda-cccl-cu12>=12.9.27; sys_platform == 'linux'", | ||
| "nvidia-cuda-runtime-cu12>=12.9.37; sys_platform == 'linux'", | ||
| "nvidia-cublas-cu12>=12.9.0.13; sys_platform == 'linux'", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for two GPU backends in QuEST - 'cuda' (quest implementation) and 'cuquantum' (nvidia's implementation). These can be selected on Linux by choosing
Quest(backend='cuda')andQuest(backend='cuquantum')When using the cuquantum backend, one must have the nvidia packages available in the provided quest-cuquantum dependency group, e.g.
pip install selene-sim[quest-cuquantum].