qrunch.quantum.backends.oqc_cloud.oqc_cloud

Module with implementation of Oxford Quantum Circuit’s backend for running quantum circuits.

Classes

OqcCloudBackend

Class for handling Oxford Quantum Circuit's (OQC) quantum devices through the OQC cloud.

OqcCloudDevices

Available Oxford Quantum Circuit devices.

OqcJob

Job class for handling job on Oxford Quantum Circuit.

class OqcCloudBackend

Bases: Backend

Class for handling Oxford Quantum Circuit’s (OQC) quantum devices through the OQC cloud.

__init__(token: str, device: OqcCloudDevices = OqcCloudDevices.TOKYO, *, compiler: Compiler | None = None, error_mitigation: ErrorMitigationConfig | None = None, compiler_configuration: CompilerConfig | 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.

  • compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method.

  • 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.

Return type:

None

property client: OQCClient

OQC Client.

get_device_data() DeviceData

Device data is not currently available for OQC devices.

Return type:

DeviceData

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.

run(circuits: Circuit | Sequence[Circuit], shots: int | None) OqcJob

Run circuit on the backend.

Parameters:
  • circuits (Circuit | Sequence[Circuit]) – circuits to run on backend

  • shots (int | None) – number of shots. Must be a positive integer

Return type:

OqcJob

supports_shots_equals_none() bool

Return whether the backend supports shots = None.

Oxford Quantum Circuit’s devices requires number of shots.

Return type:

bool

class OqcCloudDevices

Bases: Enum

Available Oxford Quantum Circuit devices.

TOKYO = 'OQC Toshiko Tokyo-1'
class OqcJob

Bases: BackendJob

Job class for handling job on Oxford Quantum Circuit.

__init__(backend: OqcCloudBackend, job_id: str, tasks: list[QPUTask], shots: int, error_log: str) 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 (str) – Message to be logged in case of errors.

Return type:

None

property backend: Backend

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:

BackendResult

status() BackendJobStatus

Return the collective status of all tasks in the job.

Return type:

BackendJobStatus

wait_for_final_state(timeout: float | None = None) None

Wait until the job status is in a final state, i.e., DONE, CANCELLED, or FAILED.

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