Skip to main contentIBM Quantum Documentation

GenericBackendV2

class qiskit.providers.fake_provider.GenericBackendV2(num_qubits, basis_gates=None, *, coupling_map=None, control_flow=False, calibrate_instructions=None, dtm=None, seed=None, pulse_channels=True, noise_info=True)

GitHub

Bases: BackendV2

Generic BackendV2 implementation with a configurable constructor. This class will return a BackendV2 instance that runs on a local simulator (in the spirit of fake backends) and contains all the necessary information to test backend-interfacing components, such as the transpiler. A GenericBackendV2 instance can be constructed from as little as a specified num_qubits, but users can additionally configure the basis gates, coupling map, ability to run dynamic circuits (control flow instructions), instruction calibrations and dtm. The remainder of the backend properties are generated by randomly sampling from default ranges extracted from historical IBM backend data. The seed for this random generation can be fixed to ensure the reproducibility of the backend output. This backend only supports gates in the standard library, if you need a more flexible backend, there is always the option to directly instantiate a Target object to use for transpilation.

Parameters

  • num_qubits (int) – Number of qubits that will be used to construct the backend’s target. Note that, while there is no limit in the size of the target that can be constructed, this backend runs on local noisy simulators, and these might present limitations in the number of qubits that can be simulated.

  • basis_gates (list[str] | None) – List of basis gate names to be supported by the target. These must be part of the standard qiskit circuit library. The default set of basis gates is ["id", "rz", "sx", "x", "cx"] The "reset", "delay", and "measure" instructions are always supported by default, even if not specified via basis_gates.

  • coupling_map (list[list[int]] | CouplingMap | None) –

    Optional coupling map for the backend. Multiple formats are supported:

    1. CouplingMap instance
    2. List, must be given as an edge list representing the two qubit interactions supported by the backend, for example: [[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]

    If coupling_map is specified, it must match the number of qubits specified in num_qubits. If coupling_map is not specified, a fully connected coupling map will be generated with num_qubits qubits.

  • control_flow (bool) – Flag to enable control flow directives on the target (defaults to False).

  • calibrate_instructions (bool |InstructionScheduleMap | None) –

    Instruction calibration settings, this argument supports both boolean and InstructionScheduleMap as input types, and is None by default:

    1. If calibrate_instructions==None, no calibrations will be added to the target.

    2. If calibrate_instructions==True, all gates will be calibrated for all

      qubits using the default pulse schedules generated internally.

    3. If calibrate_instructions==False, all gates will be “calibrated” for

      all qubits with an empty pulse schedule.

    4. If an InstructionScheduleMap instance is given, the calibrations

      in this instruction schedule map will be appended to the target instead of the default pulse schedules (this allows for custom calibrations).

  • dtm (float | None) – System time resolution of output signals in nanoseconds. None by default.

  • seed (int | None) – Optional seed for generation of default values.

  • pulse_channels (bool) – If true, sets default pulse channel information on the backend.

  • noise_info (bool) – If true, associates gates and qubits with default noise information.


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.

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

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)

max_circuits

meas_map

num_qubits

Return the number of qubits the backend has.

operation_names

A list of instruction names that the backend supports.

operations

A list of Instruction instances that the backend supports.

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

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

acquire_channel

acquire_channel(qubit)

GitHub

Return the acquisition channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns

The Qubit measurement acquisition line.

Return type

AcquireChannel

Raises

NotImplementedError – if the backend doesn’t support querying the measurement mapping

control_channel

control_channel(qubits)

GitHub

Return the secondary drive channel for the given qubit

This is typically utilized for controlling multiqubit interactions. This channel is derived from other channels.

This is required to be implemented if the backend supports Pulse scheduling.

Parameters

qubits (Iterable[int]) – Tuple or list of qubits of the form (control_qubit, target_qubit).

Returns

The multi qubit control line.

Return type

List[ControlChannel]

Raises

NotImplementedError – if the backend doesn’t support querying the measurement mapping

drive_channel

drive_channel(qubit)

GitHub

Return the drive channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns

The Qubit drive channel

Return type

DriveChannel

Raises

NotImplementedError – if the backend doesn’t support querying the measurement mapping

measure_channel

measure_channel(qubit)

GitHub

Return the measure stimulus channel for the given qubit.

This is required to be implemented if the backend supports Pulse scheduling.

Returns

The Qubit measurement stimulus line

Return type

MeasureChannel

Raises

NotImplementedError – if the backend doesn’t support querying the measurement mapping

qubit_properties

qubit_properties(qubit)

GitHub

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 (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

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

Return type

QubitProperties | List[QubitProperties]

run

run(run_input, **options)

GitHub

Run on the backend using a simulator.

This method runs circuit jobs (an individual or a list of QuantumCircuit ) and pulse jobs (an individual or a list of Schedule or ScheduleBlock) using BasicSimulator or Aer simulator and returns a Job object.

If qiskit-aer is installed, jobs will be run using the AerSimulator with noise model of the backend. Otherwise, jobs will be run using the BasicSimulator simulator without noise.

Noisy simulations of pulse jobs are not yet supported in GenericBackendV2.

Parameters

  • run_input (QuantumCircuit orSchedule orScheduleBlock orlist) – 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

Raises

QiskitError – If a pulse job is supplied and qiskit_aer is not installed.

set_options

set_options(**fields)

GitHub

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

Was this page helpful?
Report a bug or request content on GitHub.