iqm.qiskit_iqm.iqm_provider.IQMBackend#

class iqm.qiskit_iqm.iqm_provider.IQMBackend(client, **kwargs)#

Bases: IQMBackendBase

Backend for executing quantum circuits on IQM quantum computers.

Parameters:
  • client (IQMClient) – client instance for communicating with an IQM server

  • **kwargs – optional arguments to be passed to the parent Backend initializer

Initialize a BackendV2 based backend

Parameters:
  • provider – An optional backwards reference to the Provider object that the backend is from

  • name – An optional name for the backend

  • description – An optional description of the backend

  • online_date – An optional datetime the backend was brought online

  • backend_version – An optional backend version string. This differs from the version attribute as version is for the abstract Backend abstract interface version of the object while backend_version is for versioning the backend itself.

  • fields – kwargs for the values to use to override the default options.

  • client (IQMClient) –

Raises:

AttributeError – If a field is specified that’s outside the backend’s options

Attributes

max_circuits

Maximum number of circuits that should be run in a single batch.

architecture

name

Name of the backend.

description

Optional human-readable description.

online_date

Date that the backend came online.

backend_version

Version of the backend being provided.

Methods

_default_options()

Return the default options

close_client()

Close IQMClient's session with the authentication server.

retrieve_job(job_id)

Create and return an IQMJob instance associated with this backend with given job id.

run(run_input, **options)

Run on the backend.

serialize_circuit(circuit)

Serialize a quantum circuit into the IQM data transfer format.

property max_circuits: int | None#

Maximum number of circuits that should be run in a single batch.

Currently there is no hard limit on the number of circuits that can be executed in a single batch/job. However, some libraries like Qiskit Experiments use this property to split multi-circuit computational tasks into multiple baches/jobs.

The default value is None, meaning there is no limit. You can set it to a specific integer value to force these libraries to execute at most that many circuits in a single batch.

run(run_input, **options)#

Run on the backend.

This method returns a Job object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.

Parameters:
  • run_input (QuantumCircuit or Schedule or ScheduleBlock or list) – An individual or a list of QuantumCircuit, ScheduleBlock, or Schedule objects to run on the backend.

  • options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.

Returns:

The job object for the run

Return type:

Job

retrieve_job(job_id)#

Create and return an IQMJob instance associated with this backend with given job id.

Parameters:

job_id (str) –

Return type:

IQMJob

close_client()#

Close IQMClient’s session with the authentication server. Discard the client.

serialize_circuit(circuit)#

Serialize a quantum circuit into the IQM data transfer format.

Serializing is not strictly bound to the native gateset, i.e. some gates that are not explicitly mentioned in the native gateset of the backend can still be serialized. For example, the native single qubit gate for IQM backend is the ‘r’ gate, however ‘x’, ‘rx’, ‘y’ and ‘ry’ gates can also be serialized since they are just particular cases of the ‘r’ gate. If the circuit was transpiled against a backend using Qiskit’s transpiler machinery, these gates are not supposed to be present. However, when constructing circuits manually and submitting directly to the backend, it is sometimes more explicit and understandable to use these concrete gates rather than ‘r’. Serializing them explicitly makes it possible for the backend to accept such circuits.

Qiskit uses one measurement instruction per qubit (i.e. there is no measurement grouping concept). While serializing we do not group any measurements together but rather associate a unique measurement key with each measurement instruction, so that the results can later be reconstructed correctly (see MeasurementKey documentation for more details).

Parameters:

circuit (QuantumCircuit) – quantum circuit to serialize

Returns:

data transfer object representing the circuit

Raises:

ValueError – circuit contains an unsupported instruction or is not transpiled in general

Return type:

Circuit