qoolqit.execution.backends
source module qoolqit.execution.backends
Classes
-
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.
source 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.
source method PulserEmulatorBackend.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.
source method PulserEmulatorBackend.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.
source class PulserRemoteBackend()
Methods
-
validate_connection — Validate the required connection to instantiate a RemoteBackend.
source staticmethod PulserRemoteBackend.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
source 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
Methods
-
run — Run a compiled QuantumProgram and return the results.
source method LocalEmulator.run(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram and return the results.
source 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.
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
Methods
source method RemoteEmulator.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.
source method RemoteEmulator.run(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram remotely and return the results.
source 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
- Atos MyQML framework
Parameters
-
connection : RemoteConnection — connection to execute the program on remote backends.
-
runs : int — run the program
runstimes to collect bitstrings statistics.
Examples
Methods
source method QPU.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.
source method QPU.run(program: QuantumProgram) → Sequence[Results]
Run a compiled QuantumProgram remotely and return the results.