ibmq_worker

Module Contents

Functions

get_backend_info

Retrieves a BackendInfo object for a given device name.

backend_pass_from_info

Returns a compilation pass according to the backend info.

backend_default_compilation_pass

Returns the default compilation pass for a given device name.

fixed_pass

Returns a predefined compilation pass for IBMQ devices.

compile

Gets a compiled circuit for a given device name.

compile_circuit_ibmq

Applies a predefined optimization pass for IBMQ devices.

compile_circuits_ibmq

Applies a predefined optimization pass for IBMQ devices.

run_circuit

Submits a circuit to an IBMQ backend and returns the result.

main

Data

API

ibmq_worker.worker = 'Worker(...)'
ibmq_worker.get_backend_info(device_name: str) pytket.backends.backendinfo.BackendInfo

Retrieves a BackendInfo object for a given device name.

Parameters:

device_name (str) – The name of the device.

Raises:

TierkreisError – If the device is not found or not accessible.

Returns:

The BackendInfo object for the device.

Return type:

BackendInfo

ibmq_worker.backend_pass_from_info(backend_info: pytket.backends.backendinfo.BackendInfo, optimisation_level: int = 2) pytket.passes.BasePass

Returns a compilation pass according to the backend info.

Parameters:
  • backend_info (BackendInfo) – Device information to use for compilation.

  • optimisation_level (int, optional) – The optimization level for the compilation, defaults to 2

Returns:

A compilation pass for the backend.

Return type:

BasePass

ibmq_worker.backend_default_compilation_pass(device_name: str, optimisation_level: int = 2) pytket.passes.BasePass

Returns the default compilation pass for a given device name.

Parameters:
  • device_name (str) – The name of the device.

  • optimisation_level (int, optional) – The optimization level for the compilation, defaults to 2

Returns:

The default compilation pass for the backend.

Return type:

BasePass

ibmq_worker.fixed_pass(coupling_map: collections.abc.Sequence[tuple[int, int]], optimisation_level: int = 2) pytket.passes.BasePass

Returns a predefined compilation pass for IBMQ devices.

Parameters:
  • coupling_map (Sequence[tuple[int, int]]) – The coupling map for the device.

  • optimisation_level (int, optional) – The optimization level for the compilation, defaults to 2

Returns:

A compilation pass for the backend.

Return type:

BasePass

ibmq_worker.compile(circuit: pytket._tket.circuit.Circuit, device_name: str, optimisation_level: int = 2) pytket._tket.circuit.Circuit

Gets a compiled circuit for a given device name.

Parameters:
  • circuit (Circuit) – The original circuit to compile.

  • device_name (str) – The name of the device to compile for.

  • optimisation_level (int, optional) – The optimization level for the compilation, defaults to 2

Returns:

The compiled circuit.

Return type:

Circuit

ibmq_worker.compile_circuit_ibmq(circuit: pytket._tket.circuit.Circuit, device_name: str, optimisation_level: int = 2) pytket._tket.circuit.Circuit

Applies a predefined optimization pass for IBMQ devices.

The optimization pass corresponds to a level=3 optimization.

Parameters:

circuit (Circuit) – The original circuit.

Returns:

The optimized circuit.

Return type:

Circuit

ibmq_worker.compile_circuits_ibmq(circuits: list[pytket._tket.circuit.Circuit], device_name: str, optimisation_level: int = 2) list[pytket._tket.circuit.Circuit]

Applies a predefined optimization pass for IBMQ devices.

Parameters:

circuits (list[Circuit]) – A list of circuits to be optimized.

Returns:

The optimized circuits.

Return type:

list[Circuit]

ibmq_worker.run_circuit(circuit: pytket._tket.circuit.Circuit, n_shots: int, device_name: str) pytket.backends.backendresult.BackendResult

Submits a circuit to an IBMQ backend and returns the result.

Parameters:
  • circuit (Circuit) – The circuit to be run.

  • n_shots (int) – The number of shots to run.

Returns:

The backend result.

Return type:

BackendResult

ibmq_worker.main() None