Using Qiskit to Run Quantum Workloads on IQM Hardware via QDMI-on-IQM

The iqm-qdmi Python package includes a wrapper for the IQM QDMI Device library that integrates it with Qiskit. This wrapper is implemented in the iqm.qdmi.qiskit submodule and is based on the open-source, MIT-licensed MQT Core library. To use the wrapper, make sure to install the iqm-qdmi package with the qiskit extra:

uv pip install "iqm-qdmi[qiskit]"

Then, the IQMBackend class can be imported from iqm.qdmi.qiskit and used with Qiskit’s transpilation and execution interfaces.

1from iqm.qdmi.qiskit import IQMBackend
2from qiskit.circuit import QuantumCircuit
3
4backend = IQMBackend(device_id="iqm.emerald.mock")
1qc = QuantumCircuit(2)
2qc.h(0)
3qc.cx(0, 1)
4qc.measure_all()
5
6result = backend.run(backend.compile(qc), shots=128).result()
7print(result.get_counts())

Follow MQT Core’s compile-and-run guide for native compilation and result handling. Qiskit’s transpile(qc, backend) supports devices with direct qubit connectivity. Devices with computational resonators use MQT Core compilation. MQT Core places qubits only on sites with calibrated single-qubit gates and measurement, using the device’s site indices.

Select any stable ID from the installed catalogue. Pass device_id alongside any session overrides, such as IQMBackend(device_id="iqm.emerald.mock", token="…"). Every backend opens an independent device session. Pass an already-open handle with IQMBackend(device=...) to reuse a device opened through MQT Core’s driver; see IQM on Slurm.

IQMBackend() uses the configurable iqm.default connection. Explicit arguments override environment defaults: IQM_SERVER_URL, IQM_TOKEN, IQM_TOKENS_FILE, IQM_QC_ID, and IQM_QUANTUM_COMPUTER. IQM_BASE_URL and IQM_QC_ALIAS are aliases, with canonical variables taking precedence. An explicit quantum computer ID or alias suppresses both environment selectors.

Named presets use their configured endpoint and quantum computer; routing environment variables cannot redirect them. Authentication uses the token or token-file defaults. Explicit arguments and driver configuration can override manifest values.

IQM JSON represents PRX rotation and phase angles in radians, using the angle and phase fields, as specified by IQM Client. Applications submitting IQM JSON directly must use floating-point JSON numbers for PRX angles and phases, including integral values such as 0.0.

Devices with computational resonators

MQT Core inserts MOVE operations to route two-qubit gates through computational resonators:

from qiskit import QuantumCircuit
from iqm.qdmi.qiskit import IQMBackend

backend = IQMBackend(device_id="iqm.sirius.mock")
circuit = QuantumCircuit(2, 2)
circuit.h(0)
circuit.cx(0, 1)
circuit.measure([0, 1], [0, 1])
result = backend.run(backend.compile(circuit), shots=128).result()

Qiskit’s transpile and primitives do not route two-qubit gates through resonators. Use backend.compile, MQT Core’s compile_program with submit_program, or the PennyLane device. See the MQT Core compiler guide for compilation options and resonator routing.

Measurement results

Ordered samples are included by default (memory=True). Use result.get_memory() to access them, or pass memory=False to return counts only.

Each measured qubit’s last gate must precede its measurement. MQT Core reconstructs the circuit’s classical-bit order from the measurement results; see the compile-and-run guide linked above.

Hand-written MOVE circuits use Gate("move", 2, []) from qiskit.circuit.Gate and serialize_program, preserving ordered qubit/resonator loci.

Circuit Metadata

Circuit names and QuantumCircuit.metadata remain in the local Qiskit result header. Arbitrary metadata is not sent to the IQM service. The shared compiler’s IQM payload uses its entry-point name, main, independently of the circuit name.

Sampler and Estimator Primitives

IQMBackend provides small helpers (see sampler() and estimator()) for constructing BackendSamplerV2 and BackendEstimatorV2 primitives bound to the backend instance.

1from qiskit import transpile
2
3native_qc = transpile(qc, backend)
4sampler_job = backend.sampler().run([(native_qc,)], shots=128)
5counts = sampler_job.result()[0].data["meas"].get_counts()
6print(f"Counts: {counts}")
1from qiskit.quantum_info import SparsePauliOp
2
3native_qc.remove_final_measurements(inplace=True)
4observable = SparsePauliOp("Z" * backend.num_qubits)
5
6estimator_job = backend.estimator().run([(native_qc, observable)])
7data = estimator_job.result()[0].data
8print(f"Expectation values: {data['evs']}")
9print(f"Standard deviations: {data['stds']}")

IQM run-request options

Configure execution with IQM CircuitJobDefinition fields in run_request_options:

backend.set_options(run_request_options={"dd_mode": "enabled"})
job = backend.run(
    backend.compile(qc),
    shots=128,
    run_request_options={"dd_mode": "enabled", "active_reset_cycles": 2},
)

The mapping on run replaces the backend default for that run and applies to every circuit in the job. Use None or {} to use server defaults. Set shots on run and select calibration_set_id when constructing the backend; circuits, shots, and calibration_set_id are reserved request fields.

Values must be JSON-compatible and numbers must be finite. The IQM service defines the supported fields and values; consult your server’s IQM PostJobsRequest model. For sampling, pass the mapping as backend.sampler(run_options={"run_request_options": options}). For estimation, configure it with backend.set_options(...) before creating the estimator. This interface is available through IQMBackend and its bound primitives.

Execution requires the requested number of shots. Omit heralding_mode or use "none". The shot-discarding "zeros" mode raises CircuitValidationError in IQMBackend.run before submission.

CLI Scripts

The package also exposes the iqm-sampler and iqm-estimator CLI scripts for executing serialized circuits directly from the shell. For more details on these utilities and their usage, see the Python Package Guide.

Pinning a calibration

Select the calibration before constructing the backend so that the Qiskit target and submitted jobs use the same calibrated architecture and metrics:

backend = IQMBackend(
    qc_alias="your-device",
    calibration_set_id="f0fb4be5-e913-4a04-8c94-18d1bd842def",
)

backend.calibration_set_id gives the effective UUID, including a resolved server default. Share this UUID and the quantum computer identity with a separate execution client, and pass the UUID to its IQMBackend constructor. An externally compiled circuit does not carry its calibration UUID automatically.

Every backend keeps its calibration for its lifetime, including one resolved from the server default. A calibration job returns a new UUID without changing the existing backend. Construct a new backend with that UUID to compile and run circuits against the new calibration.