uniqc.backend_adapter.task.adapters.qiskit_adapter module¶
Qiskit backend adapter.
Translates OriginIR circuits to Qiskit QuantumCircuit objects and submits
via the qiskit / qiskit_ibm_runtime packages. No raw REST calls.
qiskit is a core dependency of unified-quantum — no extra install
step is required.
- class uniqc.backend_adapter.task.adapters.qiskit_adapter.QiskitAdapter(proxy=None)[source]¶
Bases:
QuantumAdapterAdapter for IBM Quantum backends via Qiskit.
- Proxy Configuration:
Proxies can be passed via the proxy parameter: - Dict with ‘http’ and/or ‘https’ keys - Or a single proxy URL string for both protocols
If no proxy is configured: - Automatically detects and uses system proxy settings - If no system proxy, uses direct connection
If proxy is configured: - Uses configured proxy in addition to any system proxy
- Raises:
MissingDependencyError – If qiskit or qiskit_ibm_runtime is not installed.
- Parameters:
Example
>>> adapter = QiskitAdapter(proxy={ ... "http": "http://proxy.example.com:8080", ... "https": "https://proxy.example.com:8080" ... })
- dry_run(originir, *, shots=1000, **kwargs)[source]¶
Dry-run validation for IBM Quantum backends.
Validates offline by: 1. Parsing OriginIR -> Qiskit QuantumCircuit. 2. Checking chip_id is in available backends (local config lookup). 3. Checking shots <= max_shots (local config lookup). 4. Checking qubit count against backend limits. 5. Attempting transpilation against the backend’s basis_gates
(purely local — catches unsupported gates).
This method makes NO network calls.
service.backend(chip_id)andbackend.configuration()are local config reads.Note
Any dry-run success followed by actual submission failure is a critical bug. Please report it at the UnifiedQuantum issue tracker.
- Parameters:
- Return type:
- get_chip_characterization(backend_name)[source]¶
Return per-qubit and per-pair calibration data for an IBM backend.
- Parameters:
backend_name (str) – IBM backend name, e.g.
"ibm_brisbane".- Return type:
ChipCharacterization or None
- is_available()[source]¶
Check if the Qiskit adapter is available (IBM service initialized).
- Return type:
- list_backends()[source]¶
List IBM backends through QiskitRuntimeService.
The returned entries include both average metrics and per-qubit/per-edge calibration details from
backend.targetso the Gateway can color chip topologies without flattening every edge to the global average.
- query_batch(taskids)[source]¶
Query multiple IBM Quantum jobs and merge results.
Each per-job
querymay return either a single countsdict(when one Sampler job covers exactly one PUB) or alist[dict](when one Sampler job covers many PUBs — IBM’s native batch execution). The mergedresultmust always be a flatlist[dict]so downstream code (query_sync, the task manager normalisers, integration tests likerun_test_result_shape_batch) can iterate per-circuit.
- query_sync(taskid, interval=2.0, timeout=60.0, retry=5)[source]¶
Poll task status until completion or timeout.
- submit_batch(circuits, *, shots=1000, native_batch=True, **kwargs)[source]¶
Submit multiple circuits as a batch.
IBM Quantum (qiskit-runtime
Sampler) natively supports running a list of circuits inside a single job, which spends only one position in the queue. Withnative_batch=True(default), this returns a single-element list containing that one job ID;query()/wait_for_result()will then surface the per-circuit count distributions as a list.With
native_batch=False, each circuit is submitted as its own job (one ID per circuit) — useful when downstream code wants individually addressable task IDs.