qrunch.quantum.backends.iqm_resonance.iqm_resonance_backend

Module with implementation of IQM’s backend for running quantum circuits.

Classes

IqmJob

Job class for handling job on IQM.

IqmResonanceBackend

Class for handling IQM's quantum devices.

IqmResonanceDevices

Available IQM devices.

class IqmJob

Bases: BackendJob

Job class for handling job on IQM.

Requirements:
  • Qrunch install requirements: qrunch[iqm] (or qrunch[all]).

__init__(backend: IqmResonanceBackend, job_id: UUID, transpiled_circuits: list[TranspiledCircuit[Circuit]], shots: int, callback: BackendCallback | None = None) None

Initialize an IQM job.

Parameters:
  • backend (IqmResonanceBackend) – Backend used for the job.

  • job_id (UUID) – id of the job.

  • transpiled_circuits (list[TranspiledCircuit[Circuit]]) – list of the transpiled circuits.

  • shots (int) – number of shots.

  • callback (BackendCallback | None) – Callback to record backend events.

Return type:

None

property backend: IqmResonanceBackend

Backend used for the job.

cancel() None

Cancel the job.

Return type:

None

property job_id: str

ID of the job.

result() BackendResult

Get the results of the job.

Return type:

BackendResult

status() BackendJobStatus

Return the collective status of all tasks in the job.

Return type:

BackendJobStatus

wait_for_final_state(timeout: float | None = None) None

Wait until the job status is in a final state, i.e., DONE, CANCELLED, or FAILED.

Parameters:

timeout (float | None) – Seconds to wait for the job. If None, wait forever.

Raises:

TimeoutError – If the job does not reach a final state before the specified timeout.

Return type:

None

class IqmResonanceBackend

Bases: HardwareBackend

Class for handling IQM’s quantum devices.

Requirements:
  • Qrunch install requirements: qrunch[iqm] (or qrunch[all]).

__init__(token: str, device: IqmResonanceDevices = IqmResonanceDevices.GARNET, transpiler: Transpiler[Circuit] | None = None, *, is_timeslot: bool = False, iqm_options: CircuitCompilationOptions | None = None, callback: BackendCallback | None = None) None

Initialize an IQM backend.

The backend can be used to launch quantum circuits to quantum devices on IQM’s cloud.

Parameters:
  • token (str) – Token used to access IQM’s cloud.

  • device (IqmResonanceDevices) – Device to run circuit on.

  • transpiler (Transpiler[Circuit] | None) – Transpiler for converting circuits into a form suitable for the backend.

  • is_timeslot (bool) – If True, the device is a timeslot device.

  • iqm_options (CircuitCompilationOptions | None) – Options to be passed to the IQM backend when running the circuits.

  • callback (BackendCallback | None) – A callback that can be used to record the input circuit, backend job, and measurement result.

Return type:

None

property client: IQMClient

IQM Client.

get_device_data() DeviceData

Get the device data for the IQM backend.

Return type:

DeviceData

property name: str

Name of the backend.

run(circuits: Circuit | Sequence[Circuit], shots: int | None) IqmJob

Run circuit on the backend.

Parameters:
  • circuits (Circuit | Sequence[Circuit]) – circuits to run on backend

  • shots (int | None) – number of shots. Must be a positive integer

Return type:

IqmJob

validate_shots_type(shots_type: Type[int | None]) list[str]

Validate that the sampler supports the given shots type. Return a list of error messages if not supported.

Parameters:

shots_type (Type[int | None])

Return type:

list[str]

verify_backend_works() None

Verify that the backend works by running a simple circuit.

The circuit is run on the actual hardware, so this requires a valid token and may take some time and cost a small number of credits.

Return type:

None

class IqmResonanceDevices

Bases: Enum

Available IQM devices.

EMERALD = 'emerald'
EMERALD_MOCK = 'emerald:mock'
GARNET = 'garnet'
GARNET_MOCK = 'garnet:mock'
SIRIUS = 'sirius'
SIRIUS_MOCK = 'sirius:mock'
is_mock() bool

Return whether the device is a mock device.

Return type:

bool