qrunch.quantum.backends.ibm.ibm_quantum_platform_backend
Module with implementation of IBM’s backend for running quantum circuits.
Classes
Job class for handling job on IBM's backend. |
|
Class for handling IBM's quantum devices. |
|
Available IBM devices. |
- class IbmBackendJob
Bases:
BackendJobJob class for handling job on IBM’s backend.
- __init__(backend: IbmQuantumPlatformBackend, job_id: str, ibm_job: RuntimeJobV2, error_log: str) None
Initialize a IBM job.
- Parameters:
backend (IbmQuantumPlatformBackend) – Backend used for the job.
job_id (str) – id of the job.
ibm_job (RuntimeJobV2) – IBM job.
error_log (str) – Error log in case the job fails.
- Return type:
None
- property backend: IbmQuantumPlatformBackend
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 result of the job.
- Return type:
- status() BackendJobStatus
Get the status of the job.
- Return type:
- wait_for_final_state(timeout: float | None = None) None
Wait until the job status is in a final state, i.e.,
DONE,CANCELLED, orFAILED.- 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 IbmQuantumPlatformBackend
Bases:
BackendClass for handling IBM’s quantum devices.
- __init__(device: IbmQuantumPlatformDevices = IbmQuantumPlatformDevices.LEAST_BUSY, token: str | None = None, *, compiler: Compiler | None = None) None
Initialize an IBM backend.
The backend can be used to launch quantum circuits to quantum devices on IBM’s quantum platform. To do so, an instance for a region (us-east or eu-de) must be created. The api token for the instance is then supplied to the backend. The region for the instance must match the region of the device.
- Parameters:
device (IbmQuantumPlatformDevices) – Device to run circuit on.
token (str | None) – Token used to access IBM’s cloud. All hardware devices require a token.
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method.
- Return type:
None
- get_device_data() DeviceData
Get device data if available.
- Return type:
- property name: str
Name of the backend.
- run(circuits: Circuit | Sequence[Circuit], shots: int | None) IbmBackendJob | SimulatedJob
Run circuit on the backend.
- Parameters:
- Return type:
- supports_shots_equals_none() bool
Return whether the backend supports shots = None.
IBM’s devices requires positive number of shots.
- Return type:
bool
- class IbmQuantumPlatformDevices
Bases:
EnumAvailable IBM devices.
- AACHEN = 'aachen'
- BRISBANE = 'brisbane'
- BRUSSELS = 'brussels'
- FAKE_BRISBANE = 'fake_brisbane'
- FAKE_FEZ = 'fake_fez'
- FAKE_MARRAKESH = 'fake_marrakesh'
- FAKE_TORINO = 'fake_torino'
- FEZ = 'fez'
- KINGSTON = 'kingston'
- LEAST_BUSY = 'least_busy'
- MARRAKESH = 'marrakesh'
- PITTSBURGH = 'pittsburgh'
- STRASBOURG = 'strasbourg'
- TORINO = 'torino'