Skip to content

feat: Add GPU support to QuEST on linux devices - #214

Open
jake-arkinstall wants to merge 2 commits into
0.3-seriesfrom
feat/quest-gpu-support
Open

jake-arkinstall wants to merge 2 commits into
0.3-seriesfrom
feat/quest-gpu-support

Conversation

@jake-arkinstall

Copy link
Copy Markdown
Collaborator

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') and Quest(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].

@jake-arkinstall
jake-arkinstall marked this pull request as ready for review September 4, 2026 16:28
@jake-arkinstall
jake-arkinstall requested review from erinaldiq and a lite review from Copilot September 4, 2026 16:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 QuestPlugin to support cpu/cuda/cuquantum backends, including cuQuantum runtime library discovery via installed Python distributions.
  • Add a quest-cuquantum optional 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 thread hatch_build.py
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 thread pyproject.toml
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'",
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants