Add Quantinuum Nexus backend - #81
Closed
jf-kong wants to merge 17 commits into
Closed
Conversation
…checker
Batch-aware Helios execution: pass per-program max_cost as a list directly
to qnx.start_execute_job rather than threading it through HeliosConfig.
This removes the attempt_batching/max_batch_cost injection (unsupported
on Helios emulators) and lets the emulator state size with the widest
circuit's nqubits. Cost estimation now always targets Helios-1SC, since
qnx.hugr.cost_confidence builds its costing job from
QuantinuumConfig(device_name=f"{system_name}SC") and only Helios-1SC
exists as a syntax checker — emulator targets must still use this name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… platform
Previously passed platform=None when caller omitted it, which broke
parse_platform. Now only forwards platform when set, letting
NexusClientBackend's own default ("hseries:H2-1LE") take effect.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NumpyBackend.__init__ assigns self.name = "numpy", which silently shadowed the class-level name attribute. Set it explicitly after super().__init__() to match the pattern used by the other client backends. Also drop the unused parse_platform import (now that all call sites moved into config) and drop the dead self.platform/self.project state — both are read from self.config. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both modules used print() for diagnostic messages, bypassing log-level configuration. Use module-level loggers instead, matching the LOGGER pattern already established in nexus_client. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The three nexus meta-backend tests in tests/test_backends.py could not be collected unless the optional braket extra was installed (the file eagerly imports BraketClientBackend at module scope). Move them into tests/test_nexus_meta_backend.py so they run in any env that has the nexus extra. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous ^0.39 / ^0.21 caret constraints pinned qnexus < 0.40 and guppylang < 0.22, which blocked installation against current upstream releases (qnexus is now on 0.43.x). Loosen to >=lower,<1 so users can pick up the latest 0.x APIs. Also add the same nexus extras to the tests dependency group and regenerate poetry.lock. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Member
|
Closing this in favour of qiboteam/nexus-backend#1 (review) |
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.
Summary
NexusClientBackend(nexus-client) that submits Qibo circuits through Quantinuum Nexus using the latestqnexusAPIs.platformargument:hseries:H2-1LE,hseries:H2-1, …): qibo → OpenQASM → pytket → Nexus compile+execute, with H2 syntax-checker HQC estimation.helios:Helios-1,helios:Helios-1E): qibo → pytket → guppylang HUGR package →qnx.start_execute_job, withqnx.hugr.cost_confidencefor HQC estimation.execute_circuits/estimate_circuits) on both paths.Helios-1SC, sinceqnx.hugr.cost_confidencebuilds its costing job fromQuantinuumConfig(device_name=f"{system_name}SC")and onlyHelios-1SCexists as a syntax checker.pip install qibo-cloud-backends[nexus](pullsqnexus,pytket,guppylang).qibo_cloud_backendsdoes not require the nexus extras; auth and project resolution are deferred until the first execute / estimate call.What changed
src/qibo_cloud_backends/nexus_client.py—NexusClientBackend(QiboNumpyBackendsubclass) implementingexecute_circuit,execute_circuits,estimate_circuit,estimate_circuits.src/qibo_cloud_backends/nexus_config.py—NexusBackendConfigdataclass,parse_platform,build_nexus_backend_config(handleshseries,helios,aer; splits options betweenHeliosConfigandHeliosEmulatorConfig).src/qibo_cloud_backends/nexus_helios.py— Helios HUGR package builder (pytket → AutoRebase to{CX, H, Rz}→ guppyload_pytket→ generated entrypoint withresult(...)/discard(...)) andmap_helios_result_to_qibofor converting Helios shot results into a QiboMeasurementOutcomes.src/qibo_cloud_backends/nexus_translation.py— qibo → pytket via OpenQASM 2.0, with normalization for measurement-register names, multi-control decomposition, and Y-basis rotation rebuildsrc/qibo_cloud_backends/nexus_results.py— generic count → Qibo bitstring /MeasurementOutcomesmapping (shared by H-Series and Helios result paths).src/qibo_cloud_backends/nexus_auth.py,nexus_errors.py— auth / project plumbing and the typed exception hierarchy (NexusBackendError,NexusAuthError,NexusResultMappingError,UnsupportedExecutionError).src/qibo_cloud_backends/__init__.py— registernexus-clientinMetaBackend.load/CLIENTS/_client_available; lazy class export via__getattr__.pyproject.toml— addsqnexus,pytket,guppylang.README.md,doc/source/index.rst,doc/source/backends.rst— install instructions and quickstart for the Nexus backend.Test plan
50 nexus-specific tests, all passing locally:
tests/test_translator.py(8) — qibo → pytket round-trip, multicontrol decomposition, Helios measurement stripping.tests/test_config.py(13) — platform parsing,HeliosConfig/HeliosEmulatorConfigresolution, options split (n_qubitssizing on emulator).tests/test_results.py(7) — count normalization, endianness,MeasurementOutcomesmapping.tests/test_helios.py(3) — HUGR entrypoint generation (measurement order,discardfor unmeasured qubits), pytket pre-Guppy rebase.tests/test_backend_contract.py(16) — backend contract: H-Series and Helios paths forexecute_circuit/estimate_circuit/execute_circuits, including the regression test that locks in (a) per-programmax_costflowing throughqnx.start_execute_job, (b) emulator state sized to the widest circuit'snqubits, (c) noattempt_batchinginjection, (d) cost estimation targetingHelios-1SCeven when the user platform isHelios-1E.tests/test_nexus_meta_backend.py(3) —MetaBackend.load(client="nexus-client", ...), default-platform fallthrough,set_backend("qibo-cloud-backends", client="nexus-client", ...). Split out fromtests/test_backends.pyso they collect without the optional braket / qiskit extras installed.Notes
_ensure_connected); just importing the package never triggers a Nexus login or network call.>=0.39,<1.