IBMBackend
class IBMBackend(configuration, service, api_client, instance=None)
Backend class interfacing with an IBM Quantum backend.
- You should not instantiate the
IBMBackend
class directly. Instead, use the methods provided by anQiskitRuntimeService
instance to retrieve and handle backends.
This class represents an IBM Quantum backend. Its attributes and methods provide information about the backend. For example, the status()
method returns a BackendStatus
instance. The instance contains the operational
and pending_jobs
attributes, which state whether the backend is operational and also the number of jobs in the server queue for the backend, respectively:
status = backend.status()
is_operational = status.operational
jobs_in_queue = status.pending_jobs
Here is list of attributes available on the IBMBackend
class:
name: backend name.
backend_version: backend version in the form X.Y.Z.
num_qubits: number of qubits.
target: A
qiskit.transpiler.Target
object for the backend.basis_gates: list of basis gates names on the backend.
gates: list of basis gates on the backend.
local: backend is local or remote.
simulator: backend is a simulator.
conditional: backend supports conditional operations.
open_pulse: backend supports open pulse.
memory: backend supports memory.
max_shots: maximum number of shots supported.
coupling_map (list): The coupling map for the device
supported_instructions (List[str]): Instructions supported by the backend.
dynamic_reprate_enabled (bool): whether delay between programs can be set dynamically (ie via
rep_delay
). Defaults to False.rep_delay_range (List[float]): 2d list defining supported range of repetition delays for backend in μs. First entry is lower end of the range, second entry is higher end of the range. Optional, but will be specified when
dynamic_reprate_enabled=True
.default_rep_delay (float): Value of
rep_delay
if not specified by user anddynamic_reprate_enabled=True
.n_uchannels: Number of u-channels.
u_channel_lo: U-channel relationship on device los.
meas_levels: Supported measurement levels.
qubit_lo_range: Qubit lo ranges for each qubit with form (min, max) in GHz.
meas_lo_range: Measurement lo ranges for each qubit with form (min, max) in GHz.
dt: Qubit drive channel timestep in nanoseconds.
dtm: Measurement drive channel timestep in nanoseconds.
rep_times: Supported repetition times (program execution time) for backend in μs.
meas_kernels: Supported measurement kernels.
discriminators: Supported discriminators.
hamiltonian: An optional dictionary with fields characterizing the system hamiltonian.
channel_bandwidth (list): Bandwidth of all channels (qubit, measurement, and U)
acquisition_latency (list): Array of dimension n_qubits x n_registers. Latency (in units of dt) to write a measurement result from qubit n into register slot m.
conditional_latency (list): Array of dimension n_channels [d->u->m] x n_registers. Latency (in units of dt) to do a conditional operation on channel n from register slot m
meas_map (list): Grouping of measurement which are multiplexed
max_circuits (int): The maximum number of experiments per job
sample_name (str): Sample name for the backend
n_registers (int): Number of register slots available for feedback (if conditional is True)
register_map (list): An array of dimension n_qubits X n_registers that specifies whether a qubit can store a measurement in a certain register slot.
configurable (bool): True if the backend is configurable, if the backend is a simulator
credits_required (bool): True if backend requires credits to run a job.
online_date (datetime): The date that the device went online
display_name (str): Alternate name field for the backend
description (str): A description for the backend
tags (list): A list of string tags to describe the backend
version: version of
Backend
class (Ex: 1, 2)channels: An optional dictionary containing information of each channel – their purpose, type, and qubits operated on.
parametric_pulses (list): A list of pulse shapes which are supported on the backend. For example:
['gaussian', 'constant']
processor_type (dict): Processor type for this backend. A dictionary of the form
{"family": <str>, "revision": <str>, segment: <str>}
such as{"family": "Canary", "revision": "1.0", segment: "A"}
.
- family: Processor family of this backend.
- revision: Revision version of this processor.
- segment: Segment this processor belongs to within a larger chip.
IBMBackend constructor.
Parameters
- configuration (
Union
[QasmBackendConfiguration
,PulseBackendConfiguration
]) – Backend configuration. - service (
QiskitRuntimeService
) – Instance of QiskitRuntimeService. - api_client (
RuntimeClient
) – IBM client used to communicate with the server.
Attributes
coupling_map
Return the CouplingMap
object
dt
Return the system time resolution of input signals
This is required to be implemented if the backend supports Pulse scheduling.
Return type
Optional
[float
]
Returns
The input signal timestep in seconds. If the backend doesn’t define dt
, None
will be returned.
dtm
Return the system time resolution of output signals
Returns
The output signal timestep in seconds.
Return type
dtm
id_warning_issued
Default value: False
instruction_durations
Return the InstructionDurations
object.
instruction_schedule_map
Return the InstructionScheduleMap
for the instructions defined in this backend’s target.
instructions
A list of Instruction tuples on the backend of the form (instruction, (qubits)
Return type
List
[Tuple
[Instruction
, Tuple
[int
]]]
max_circuits
The maximum number of circuits
The maximum number of circuits (or Pulse schedules) that can be run in a single job. If there is no limit this will return None.
Return type
int
meas_map
Return the grouping of measurements which are multiplexed
This is required to be implemented if the backend supports Pulse scheduling.
Returns
The grouping of measurements which are multiplexed
Return type
meas_map
num_qubits
Return the number of qubits the backend has.
Return type
int
operation_names
A list of instruction names that the backend supports.
Return type
List
[str
]
operations
A list of Instruction
instances that the backend supports.
Return type
List
[Instruction
]
options
Return the options for the backend
The options of a backend are the dynamic parameters defining how the backend is used. These are used to control the run()
method.
provider
Return the backend Provider.
Returns
the Provider responsible for the backend.
Return type
Provider
service
Return the service
object
Returns
instance of QiskitRuntimeService
Return type
service
session
Return session
Return type
Session
target
A qiskit.transpiler.Target
object for the backend.
Return type
Target
Returns
Target
version
Default value: 2
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. This is not the same as BackendV2.version
, which is the version of the Backend
abstract interface.
Methods
__call__
acquire_channel
acquire_channel(qubit)
Return the acquisition channel for the given qubit.
Returns
The Qubit measurement acquisition line.
Return type
AcquireChannel
cancel_session
check_faulty
check_faulty(circuit)
Check if the input circuit uses faulty qubits or edges.
Parameters
circuit (QuantumCircuit
) – Circuit to check.
Raises
ValueError – If an instruction operating on a faulty qubit or edge is found.
Return type
None
close_session
close_session()
Close the session so new jobs will no longer be accepted, but existing queued or running jobs will run to completion. The session will be terminated once there are no more pending jobs.
Return type
None
configuration
configuration()
Return the backend configuration.
Backend configuration contains fixed information about the backend, such as its name, number of qubits, basis gates, coupling map, quantum volume, etc.
The schema for backend configuration can be found in Qiskit/ibm-quantum-schemas/backend_configuration.
Return type
Union
[QasmBackendConfiguration
, PulseBackendConfiguration
]
Returns
The configuration for the backend.
control_channel
control_channel(qubits)
Return the secondary drive channel for the given qubit
This is typically utilized for controlling multiqubit interactions. This channel is derived from other channels.
Parameters
qubits (Iterable
[int
]) – Tuple or list of qubits of the form (control_qubit, target_qubit)
.
Returns
The Qubit measurement acquisition line.
Return type
List[ControlChannel]
defaults
defaults(refresh=False)
Return the pulse defaults for the backend.
The schema for default pulse configuration can be found in Qiskit/ibm-quantum-schemas/default_pulse_configuration.
Parameters
refresh (bool
) – If True
, re-query the server for the backend pulse defaults. Otherwise, return a cached version.
Return type
Optional
[PulseDefaults
]
Returns
The backend pulse defaults or None
if the backend does not support pulse.
drive_channel
drive_channel(qubit)
Return the drive channel for the given qubit.
Returns
The Qubit drive channel
Return type
DriveChannel
measure_channel
measure_channel(qubit)
Return the measure stimulus channel for the given qubit.
Returns
The Qubit measurement stimulus line
Return type
MeasureChannel
open_session
properties
properties(refresh=False, datetime=None)
Return the backend properties, subject to optional filtering.
This data describes qubits properties (such as T1 and T2), gates properties (such as gate length and error), and other general properties of the backend.
The schema for backend properties can be found in Qiskit/ibm-quantum-schemas/backend_properties.
Parameters
- refresh (
bool
) – IfTrue
, re-query the server for the backend properties. Otherwise, return a cached version. - datetime (
Optional
[datetime
]) – By specifying datetime, this function returns an instance of theBackendProperties
whose timestamp is closest to, but older than, the specified datetime. Note that this is only supported usingibm_quantum
runtime.
Return type
Optional
[BackendProperties
]
Returns
The backend properties or None
if the backend properties are not currently available.
Raises
- TypeError – If an input argument is not of the correct type.
- NotImplementedError – If datetime is specified when cloud runtime is used.
qubit_properties
qubit_properties(qubit)
Return QubitProperties for a given qubit.
If there are no defined or the backend doesn’t support querying these details this method does not need to be implemented.
Parameters
qubit (Union
[int
, List
[int
]]) – The qubit to get the QubitProperties
object for. This can be a single integer for 1 qubit or a list of qubits and a list of QubitProperties
objects will be returned in the same order
Return type
Union
[QubitProperties
, List
[QubitProperties
]]
Returns
The QubitProperties
object for the specified qubit. If a list of qubits is provided a list will be returned. If properties are missing for a qubit this can be None
.
Raises
NotImplementedError – if the backend doesn’t support querying the qubit properties
run
run(circuits, dynamic=None, job_tags=None, init_circuit=None, init_num_resets=None, header=None, shots=None, memory=None, meas_level=None, meas_return=None, rep_delay=None, init_qubits=None, use_measure_esp=None, noise_model=None, seed_simulator=None, **run_config)
Run on the backend. If a keyword specified here is also present in the options
attribute/object, the value specified here will be used for this run.
Parameters
-
circuits (
Union
[QuantumCircuit
,str
,List
[Union
[QuantumCircuit
,str
]]]) – An individual or a list ofQuantumCircuit
. -
dynamic (
Optional
[bool
]) – Whether the circuit is dynamic (uses in-circuit conditionals) -
job_tags (
Optional
[List
[str
]]) – Tags to be assigned to the job. The tags can subsequently be used as a filter in thejobs()
function call. -
init_circuit (
Optional
[QuantumCircuit
]) – A quantum circuit to execute for initializing qubits before each circuit. If specified,init_num_resets
is ignored. Applicable only ifdynamic=True
is specified. -
init_num_resets (
Optional
[int
]) – The number of qubit resets to insert before each circuit execution. -
or (The following parameters are applicable only if dynamic=False is specified) –
-
to. (defaulted) –
-
header (
Optional
[Dict
]) – User input that will be attached to the job and will be copied to the corresponding result header. Headers do not affect the run. This replaces the oldQobj
header. -
shots (
Union
[int
,float
,None
]) – Number of repetitions of each circuit, for sampling. Default: 4000 ormax_shots
from the backend configuration, whichever is smaller. -
memory (
Optional
[bool
]) – IfTrue
, per-shot measurement bitstrings are returned as well (provided the backend supports it). For OpenPulse jobs, only measurement level 2 supports this option. -
meas_level (
Union
[int
,MeasLevel
,None
]) –Level of the measurement output for pulse experiments. See OpenPulse specification for details:
0
, measurements of the raw signal (the measurement output pulse envelope)1
, measurement kernel is selected (a complex number obtained after applying the measurement kernel to the measurement output signal)2
(default), a discriminator is selected and the qubit state is stored (0 or 1)
-
meas_return (
Union
[str
,MeasReturnType
,None
]) –Level of measurement data for the backend to return. For
meas_level
0 and 1:single
returns information from every shot.avg
returns average measurement output (averaged over number of shots).
-
rep_delay (
Optional
[float
]) – Delay between programs in seconds. Only supported on certain backends (ifbackend.configuration().dynamic_reprate_enabled=True
). If supported,rep_delay
must be from the range supplied by the backend (backend.configuration().rep_delay_range
). Default is given bybackend.configuration().default_rep_delay
. -
init_qubits (
Optional
[bool
]) – Whether to reset the qubits to the ground state for each shot. Default:True
. -
use_measure_esp (
Optional
[bool
]) – Whether to use excited state promoted (ESP) readout for measurements which are the terminal instruction to a qubit. ESP readout can offer higher fidelity than standard measurement sequences. See here. Default:True
if backend supports ESP readout, elseFalse
. Backend support for ESP readout is determined by the flagmeasure_esp_enabled
inbackend.configuration()
. -
noise_model (
Optional
[Any
]) – Noise model. (Simulators only) -
seed_simulator (
Optional
[int
]) – Random seed to control sampling. (Simulators only) -
**run_config – Extra arguments used to configure the run.
Return type
Returns
The job to be executed.
Raises
-
IBMBackendApiError – If an unexpected error occurred while submitting the job.
-
IBMBackendApiProtocolError – If an unexpected value received from the server.
-
IBMBackendValueError –
- If an input parameter value is not valid. - If ESP readout is used and the backend does not support this.
set_options
set_options(**fields)
Set the options fields for the backend
This method is used to update the options of a backend. If you need to change any of the options prior to running just pass in the kwarg with the new value for the options.
Parameters
fields – The fields to update the options
Raises
AttributeError – If the field passed in is not part of the options
status
status()
Return the backend status.
If the returned BackendStatus
instance has operational=True
but status_msg="internal"
, then the backend is accepting jobs but not processing them.
Return type
BackendStatus
Returns
The status of the backend.
Raises
IBMBackendApiProtocolError – If the status for the backend cannot be formatted properly.
target_history
target_history(datetime=None)
A qiskit.transpiler.Target
object for the backend. :rtype: Target
:returns: Target with properties found on datetime