API documentation¶
Backends for processing pytket circuits with Azure devices
- class pytket.extensions.azure.AzureBackend(name, resource_id=None, location=None, connection_string=None, use_string=False)[source]¶
Interface to Azure Quantum.
- __init__(name, resource_id=None, location=None, connection_string=None, use_string=False)[source]¶
Construct an Azure backend for a device.
If the environment variable AZURE_QUANTUM_CONNECTION_STRING is set, this is used for authentication. Otherwise, the Azure Quantum resource_id and location are read from pytket config, if set, or else from the provided arguments.
- Parameters:
name (
str
) – Device name. Use AzureBackend.available_devices() to obtain a list of possible device names.resource_id (
Optional
[str
]) – Azure Quantum resource_id. If omitted this is read from config (see set_azure_config()), unless the environment variable AZURE_QUANTUM_CONNECTION_STRING is set in which case this is used.location (
Optional
[str
]) – Azure Quantum location. If omitted this is read from config (see set_azure_config()), unless the environment variable AZURE_QUANTUM_CONNECTION_STRING is set in which case this is used.connection_string (
Optional
[str
]) – Azure Quantum connection_string. The connection_string can be set on Azure Quantum. See https://learn.microsoft.com/en-us/azure/quantum/how-to-connect-workspace If omitted this is read from config (see set_azure_config()), unless the environment variable AZURE_QUANTUM_CONNECTION_STRING is set in which case this is used.use_string (
bool
) – Use the connection_string. Defaults to False.
- classmethod available_devices(cls, **kwargs)[source]¶
See
pytket.backends.Backend.get_result()
.Supported kwargs: :rtype:
list
[BackendInfo
]resource_id (str)
location (str)
connection_string (str)
use_string (bool) = False
If omitted these are read from config, unless the environment variable AZURE_QUANTUM_CONNECTION_STRING is set in which case it is used.
- circuit_status(handle)[source]¶
Return a CircuitStatus reporting the status of the circuit execution corresponding to the ResultHandle
- Return type:
- default_compilation_pass(optimisation_level=2, timeout=300)[source]¶
- Parameters:
optimisation_level (
int
) – Allows values of 0, 1, 2 or 3, with higher values prompting more computationally heavy optimising compilation that can lead to reduced gate count in circuits.timeout (
int
) – Only valid for optimisation level 3, gives a maximimum time for running a single thread of the pass GreedyPauliSimp. Increase for optimising larger circuits.
- Return type:
- Returns:
Compilation pass for compiling circuits to Quantinuum devices
- get_result(handle, **kwargs)[source]¶
See
pytket.backends.Backend.get_result()
.Supported kwargs: :rtype:
BackendResult
timeout (int): timeout in seconds
- process_circuits(circuits, n_shots=None, valid_check=True, **kwargs)[source]¶
See
pytket.backends.Backend.process_circuits()
.Supported kwargs: :rtype:
list
[ResultHandle
]option_params: a dictionary with string keys and arbitrary values; key-value pairs in the dictionary are passed as input parameters to the backend. Their semantics are backend-dependent.
- rebase_pass()[source]¶
A single compilation pass that when run converts all gates in a Circuit to an OpType supported by the Backend (ignoring architecture constraints).
- Returns:
Compilation pass that converts gates to primitives supported by Backend.
- Return type:
BasePass
- property backend_info: BackendInfo¶
Retrieve all Backend properties in a BackendInfo object, including device architecture, supported gate set, gate errors and other hardware-specific information.
- Returns:
The BackendInfo describing this backend if it exists.
- Return type:
Optional[BackendInfo]