Skip to content

qek.target.backends

source module qek.target.backends

Low-level tools to execute compiled registers and pulses onto Quantum Devices, including local emulators, remote emulators and physical QPUs.

Classes

  • BaseBackend Low-level abstraction to execute a Register and a Pulse on a Quantum Device.

  • QutipBackend Execute a Register and a Pulse on the Qutip Emulator.

  • BaseRemoteBackend Base hierarch for remote backends.

  • RemoteQPUBackend Execute on a remote QPU.

  • RemoteEmuMPSBackend A backend that uses a remote high-performance emulator (EmuMPS) published on Pasqal Cloud.

  • EmuMPSBackend Execute a Register and a Pulse on the high-performance emu-mps Emulator.

source class BaseBackend(device: Device | None)

Bases : abc.ABC

Low-level abstraction to execute a Register and a Pulse on a Quantum Device.

For higher-level abstractions, see BaseExtractor and its subclasses.

The sole role of these abstractions is to provide the same API for all backends. They might be removed in a future version, once Pulser has gained a similar API.

Methods

  • run Execute a register and a pulse.

source async method BaseBackend.run(self, register: targets.Register, pulse: targets.Pulse)Counter[str]

Execute a register and a pulse.

Returns

  • Counter[str] A bitstring Counter, i.e. a data structure counting for each bitstring the number of measured instances of this bitstring.

Raises

  • NotImplementedError

source class QutipBackend(device: Device)

Bases : BaseBackend

Execute a Register and a Pulse on the Qutip Emulator.

Please consider using EmuMPSBackend, which generally works much better with higher number of qubits.

Performance warning

Executing anything quantum related on an emulator takes an amount of resources polynomial in 2^N, where N is the number of qubits. This can easily go beyond the limit of the computer on which you're executing it.

Methods

  • run Execute a register and a pulse.

source async method QutipBackend.run(self, register: targets.Register, pulse: targets.Pulse)Counter[str]

Execute a register and a pulse.

Parameters

  • register : targets.Register The register (geometry) to execute. Typically obtained by compiling a graph.

  • pulse : targets.Pulse The pulse (lasers) to execute. Typically obtained by compiling a graph.

Returns

  • Counter[str] A bitstring Counter, i.e. a data structure counting for each bitstring the number of instances of this bitstring observed at the end of runs.

source class BaseRemoteBackend(project_id: str, username: str, device_name: str = 'FRESNEL', password: str | None = None)

Bases : BaseBackend

Base hierarch for remote backends.

Create a remote backend

Performance warning

As of this writing, using remote Backends to access a remote QPU or remote emulator is slower than using a RemoteExtractor, as the RemoteExtractor optimizes the number of connections used to communicate with the cloud server.

Parameters

  • project_id : str The ID of the project on the Pasqal Cloud API.

  • username : str Your username on the Pasqal Cloud API.

  • password : str | None Your password on the Pasqal Cloud API. If you leave this to None, you will need to enter your password manually.

  • device_name : str The name of the device to use. As of this writing, the default value of "FRESNEL" represents the latest QPU available through the Pasqal Cloud API.

Methods

  • device Make sure that we have fetched the latest specs for the device from the server.

source async method BaseRemoteBackend.device(self)Device

Make sure that we have fetched the latest specs for the device from the server.

source class RemoteQPUBackend(project_id: str, username: str, device_name: str = 'FRESNEL', password: str | None = None)

Bases : BaseRemoteBackend

Execute on a remote QPU.

Create a remote backend

Performance note

As of this writing, the waiting lines for a QPU may be very long. You may use this Extractor to resume your workflow with a computation that has been previously started.

Parameters

  • project_id : str The ID of the project on the Pasqal Cloud API.

  • username : str Your username on the Pasqal Cloud API.

  • password : str | None Your password on the Pasqal Cloud API. If you leave this to None, you will need to enter your password manually.

  • device_name : str The name of the device to use. As of this writing, the default value of "FRESNEL" represents the latest QPU available through the Pasqal Cloud API.

Methods

source async method RemoteQPUBackend.run(self, register: targets.Register, pulse: targets.Pulse)Counter[str]

source class RemoteEmuMPSBackend(project_id: str, username: str, device_name: str = 'FRESNEL', password: str | None = None)

Bases : BaseRemoteBackend

A backend that uses a remote high-performance emulator (EmuMPS) published on Pasqal Cloud.

Create a remote backend

Parameters

  • project_id : str The ID of the project on the Pasqal Cloud API.

  • username : str Your username on the Pasqal Cloud API.

  • password : str | None Your password on the Pasqal Cloud API. If you leave this to None, you will need to enter your password manually.

  • device_name : str The name of the device to use. As of this writing, the default value of "FRESNEL" represents the latest QPU available through the Pasqal Cloud API.

Methods

source async method RemoteEmuMPSBackend.run(self, register: targets.Register, pulse: targets.Pulse, dt: int = 10)Counter[str]

source class EmuMPSBackend(device: Device)

Bases : BaseBackend

Execute a Register and a Pulse on the high-performance emu-mps Emulator.

As of this writing, this local emulator is only available under Unix. However, the RemoteEmuMPSBackend is available on all platforms.

Performance warning

Executing anything quantum related on an emulator takes an amount of resources polynomial in 2^N, where N is the number of qubits. This can easily go beyond the limit of the computer on which you're executing it.

Methods

source async method EmuMPSBackend.run(self, register: targets.Register, pulse: targets.Pulse, dt: int = 10)Counter[str]