IQMBackend#

IQMBackend(api_token: str, device_instance: str | None = None, server_url: str | None = None, compilation_options=None, transpiler=None, calibration_set_id: str | UUID | None = None, use_metrics: bool = False, use_timeslot: bool = False)[source]#

A Backend for executing circuits on IQM hardware.

Warning

Temporary implementation. This class exists only until the IQM QCCSW release ships the new Qrisp-compatible IQMBackend. At that point, this file will be deleted and IQMBackend will be imported from that package instead. Do not depend on implementation details here.

Deprecated since version 0.8: IQMBackend will be removed from qrisp in a future release once the IQM QCCSW package is publicly available.

Circuits are transpiled from Qrisp’s internal representation to Qiskit QuantumCircuit objects, serialized via the IQM provider backend, and submitted through the IQM client. An IQMJob handle is returned immediately. Call Job.result() to block and retrieve the JobResult.

Parameters:
api_tokenstr

An API token retrieved from the IQM Resonance website or IQM backend.

device_instancestr, optional

The device instance of the IQM backend such as garnet. For an up-to-date list, see the IQM Resonance website. Required if server_url is not provided.

server_urlstr, optional

The server URL of the IQM backend. If not provided, it defaults to IQM Resonance using the device_instance. If a server URL is provided, a device instance should not be provided.

compilation_optionsCircuitCompilationOptions, optional

An object to specify several options regarding pulse-level compilation.

transpilercallable, optional

A function receiving and returning a QuantumCircuit, mapping the given circuit to a hardware friendly circuit. By default the transpile_to_IQM function will be used.

calibration_set_idstr or UUID or None, optional

ID of the calibration set the backend will use. None means the IQM Server will be queried for the current default calibration set.

use_metricsbool, optional

If True, the backend will query the server for calibration data and related quality metrics. Defaults to False.

use_timeslotbool, optional

Passed to IQMClient.submit_circuits. Defaults to False.

Examples

We evaluate a QuantumFloat multiplication on the 20-qubit IQM Garnet.

>>> from qrisp.interface import IQMBackend
>>> qrisp_garnet = IQMBackend(
...     api_token="YOUR_IQM_RESONANCE_TOKEN", device_instance="garnet"
... )
>>> from qrisp import QuantumFloat
>>> a = QuantumFloat(2)
>>> a[:] = 2
>>> b = a*a
>>> b.get_measurement(backend = qrisp_garnet, shots = 1000)
{4: 0.548, ...}

Manual qubit selection and routing

from qrisp import QuantumCircuit

def custom_transpiler(qc: QuantumCircuit) -> QuantumCircuit:
    return qc.transpile(basis_gates = ["cz", "r", "measure", "reset"])

custom_transpiled_garnet = IQMBackend("YOUR_IQM_RESONANCE_TOKEN",
                           device_instance = "garnet",
                           transpiler = custom_transpiler)

qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure(0)

meas_res = qc.run(shots = 10000, backend = custom_transpiled_garnet)