-
PulserEmulatorBackend — Base Emulator class.
-
LocalEmulator — Run QoolQit
QuantumPrograms on a Pasqal local emulator backends. -
RemoteEmulator — Run QoolQit
QuantumPrograms on a Pasqal remote emulator backends. -
QPU — Run QoolQit
QuantumPrograms on a Pasqal QPU.
qoolqit.execution.backends
module
qoolqit.execution.backends
Classes
class
PulserEmulatorBackend
(runs: int = 1000)
Base Emulator class.
Parameters
-
runs : int — run the program
runstimes to collect bitstrings statistics. On QPU backends this represents the actual number of runs of the program. On emulators, instead the bitstring are sampled from the quantum staterunstimes.
Methods
-
validate_emulation_config — Returns a valid config for emulator backends, if needed.
-
default_emulation_config — Return a unique emulation config for all emulators.
method
validate_emulation_config
(emulation_config: Optional[EmulationConfig]) → EmulationConfig
Returns a valid config for emulator backends, if needed.
Parameters
-
emulation_config : EmulationConfig — base configuration class for all emulators backends. If no config is provided to an emulator backend, a default will be provided instead.
-
Note — Emulators backend (local/remote) can be configured through the generic
EmulationConfigobject. Early validation makes the error easier to understand.
method
default_emulation_config
() → EmulationConfig
Return a unique emulation config for all emulators.
Defaults to a configuration that asks for the final bitstring, sampled runs times.
class
PulserRemoteBackend
()
Methods
-
validate_connection — Validate the required connection to instantiate a RemoteBackend.
staticmethod
validate_connection
(connection: RemoteConnection) → RemoteConnection
Validate the required connection to instantiate a RemoteBackend.
Remote emulators and QPUs require a pulser.backend.remote.RemoteConnection or derived
to send jobs. Validation also happens inside the backend. Early validation just makes the
error easier to understand.
Raises
-
TypeError
class
LocalEmulator
(*, backend_type: type[EmulatorBackend] = QutipBackendV2, emulation_config: Optional[EmulationConfig] = None, runs: int = 100)
Bases : PulserEmulatorBackend
Run QoolQit QuantumPrograms on a Pasqal local emulator backends.
This class serves as a primary interface between tools written using QoolQit (including solvers) and local emulator backends.
Parameters
-
backend_type : type — backend type. Must be a subtype of
pulser.backend.EmulatorBackend. -
emulation_config : EmulationConfig — optional configuration object emulators.
-
runs : int — number of bitstring samples to collect from the final quantum state. It emulates running the program
runstimes to collect bitstrings statistics.
Examples
from qoolqit.execution import LocalEmulator, BackendTypebackend = LocalEmulator(backend_type=BackendType.QutipBackendV2)result = backend.run(program)Methods
-
run — Run a compiled QuantumProgram and return the results.
method
run
(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram and return the results.
class
RemoteEmulator
(*, backend_type: type[RemoteEmulatorBackend] = EmuFreeBackendV2, connection: RemoteConnection, emulation_config: Optional[EmulationConfig] = None, runs: int = 100)
Bases : PulserEmulatorBackend, PulserRemoteBackend
Run QoolQit QuantumPrograms on a Pasqal remote emulator backends.
This class serves as a primary interface between tools written using QoolQit (including solvers)
and remote emulator backends.
The behavior is similar to LocalEmulator, but here, requires credentials through
a connection to submit/run a program.
To get your credentials and to create a connection object, please refer to the Pasqal Cloud
interface documentation (external).
Parameters
-
backend_type : type — backend type. Must be a subtype of
pulser_pasqal.backends.RemoteEmulatorBackend. -
connection : RemoteConnection — connection to execute the program on remote backends.
-
emulation_config : EmulationConfig — optional configuration object emulators.
-
runs : int — number of bitstring samples to collect from the final quantum state. It emulates running the program
runstimes to collect bitstrings statistics.
Examples
from pulser_pasqal import PasqalCloudfrom qoolqit.execution import RemoteEmulator, BackendTypeconnection = PasqalCloud(username=..., password=..., project_id=...)backend = RemoteEmulator(backend_type=BackendType.EmuFreeBackendV2, connection=connection)remote_results = backend.submit(program)results = backend.run(program)Methods
method
submit
(program: QuantumProgram, wait: bool = False) → RemoteResults
Submit a compiled QuantumProgram and return a remote handler of the results.
The returned handler `RemoteResults` can be used to
- query the job status with
remote_results.get_batch_status() - when DONE, retrieve results with
remote_results.results
Parameters
-
program : QuantumProgram — the compiled quantum program to run.
-
wait : bool — Wait for remote backend to complete the job.
method
run
(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram remotely and return the results.
class
QPU
(*, connection: RemoteConnection, runs: int = 100)
Bases : PulserRemoteBackend
Run QoolQit QuantumPrograms on a Pasqal QPU.
This class serves as a primary interface between tools written using QoolQit (including solvers)
and QPU backend. It requires credentials through a connection to submit/run a program.
Please, contact your provider to get your credentials and get help on how create a
connection object:
- Pasqal Cloud interface documentation (external)
- Atos MyQML framework (external)
Parameters
-
connection : RemoteConnection — connection to execute the program on remote backends.
-
runs : int — run the program
runstimes to collect bitstrings statistics.
Examples
from pulser_pasqal import PasqalCloudfrom qoolqit.execution import QPUconnection = PasqalCloud(username=..., password=..., project_id=...)backend = QPU(connection=connection)remote_results = backend.submit(program)Methods
method
submit
(program: QuantumProgram, wait: bool = False) → RemoteResults
Submit a compiled QuantumProgram and return a remote handler of the results.
The returned handler `RemoteResults` can be used to
- query the job status with
remote_results.get_batch_status() - when DONE, retrieve results with
remote_results.results
Parameters
-
program : QuantumProgram — the compiled quantum program to run.
-
wait : bool — Wait for remote backend to complete the job.
method
run
(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram remotely and return the results.