qrunch.quantum.backends.oqc_cloud.oqc_cloud
Module with implementation of Oxford Quantum Circuit’s backend for running quantum circuits.
Classes
Class for handling Oxford Quantum Circuit's (OQC) quantum devices through the OQC cloud. |
|
Available Oxford Quantum Circuit devices. |
|
Job class for handling job on Oxford Quantum Circuit. |
- class OqcCloudBackend
Bases:
HardwareBackendClass for handling Oxford Quantum Circuit’s (OQC) quantum devices through the OQC cloud.
- Requirements:
Qrunch install requirements: qrunch[oqc] (or qrunch[all]).
- __init__(token: str, device: OqcCloudDevices = OqcCloudDevices.TOKYO, transpiler: Transpiler[QasmStr] | None = None, *, error_mitigation: ErrorMitigationConfig | None = None, compiler_configuration: CompilerConfig | None = None, callback: BackendCallback | None = None) None
Initialize an OQC Cloud Backend.
The backend can be used to launch quantum circuits to quantum devices on OQC’s cloud.
- Parameters:
token (str) – Token used to access OQC’s cloud.
device (OqcCloudDevices) – Device to run circuit on.
transpiler (Transpiler[QasmStr] | None) – Transpiler for converting circuits into a format suitable for the backend.
error_mitigation (ErrorMitigationConfig | None) – Optional OQC error mitigation to use. Mutually exclusive with compiler_config.
compiler_configuration (CompilerConfig | None) – Optional compiler configuration to use. The compiler configuration contains optimizations and error mitigation. Number of repeats and output format will be overwritten. Mutually exclusive with error_mitigation.
callback (BackendCallback | None) – A callback that can be used to record the input circuit, backend job, and measurement result.
- Return type:
None
- property client: OQCClient
OQC Client.
- get_device_data() DeviceData
Device data is not currently available for OQC devices.
- Return type:
- get_qpus() list[dict[str, Any]]
Return all available QPUs from Oxford Quantum Circuit.
- Return type:
list[dict[str, Any]]
- property name: str
Name of the backend.
- property qpu_id: str
QPU id.
- 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 OqcCloudDevices
Bases:
EnumAvailable Oxford Quantum Circuit devices.
- TOKYO = 'OQC Toshiko Tokyo-1'
- class OqcJob
Bases:
BackendJobJob class for handling job on Oxford Quantum Circuit.
- Requirements:
Qrunch install requirements: qrunch[oqc] (or qrunch[all]).
- __init__(backend: OqcCloudBackend, job_id: str, tasks: list[QPUTask], shots: int, callback: BackendCallback | None = None) None
Initialize an Oxford Quantum Circuit job.
- Parameters:
backend (OqcCloudBackend) – Backend used for the job.
job_id (str) – id of the job as a string.
tasks (list[QPUTask]) – list of the tasks running on Oxford Quantum Circuit’s backend.
shots (int) – number of shots.
error_log – Message to be logged in case of errors.
callback (BackendCallback | None) – Callback to record backend events.
- Return type:
None
- property backend: OqcCloudBackend
Backend used for the job.
- cancel() None
Cancel all tasks in the job.
- Return type:
None
- property job_id: str
ID of the job.
- result() BackendResult
Get the results of the tasks.
- Return type:
- status() BackendJobStatus
Return the collective status of all tasks in 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