EmulatorBuilder¶
- class guppylang.emulator.EmulatorBuilder(_name: str | None = None, _build_dir: Path | None = None, _verbose: bool = False, _planner: BuildPlanner | None = None, _utilities: Sequence[Utility] | None = None, _interface: QuantumInterface | None = None, _progress_bar: bool = False, _strict: bool = False, _save_planner: bool = False, _custom_args: dict[str, Any] | None = None, _platform: Platform = 'helios')[source]¶
A builder class for creating EmulatorInstance objects.
Supports configuration parameters for compilation of emulator instances.
- __delattr__(name)¶
Implement delattr(self, name).
- __eq__(other)¶
Return self==value.
- __init__(_name: str | None = None, _build_dir: Path | None = None, _verbose: bool = False, _planner: BuildPlanner | None = None, _utilities: Sequence[Utility] | None = None, _interface: QuantumInterface | None = None, _progress_bar: bool = False, _strict: bool = False, _save_planner: bool = False, _custom_args: dict[str, Any] | None = None, _platform: Platform = 'helios') None¶
- __repr__()¶
Return repr(self).
- __setattr__(name, value)¶
Implement setattr(self, name, value).
- build(package: Package, n_qubits: int, arg_specs: Sequence[EntrypointArgSpec] = ()) EmulatorInstance[source]¶
Build an EmulatorInstance from a compiled package.
- Parameters:
package – The compiled HUGR package to build the emulator from.
n_qubits – The number of qubits to allocate for the emulator instance.
arg_specs – The runtime argument schema of the (wrapped) entrypoint, if it takes arguments. Used to validate values passed to
run.
- Returns:
An EmulatorInstance that can be used to run the compiled program.
- property build_dir: Path | None¶
Directory to store intermediate build files and execution results. Defaults to None, in which case a temporary directory is used.
- link_utility(utility: Utility) Self[source]¶
Link a selene
Utilityinto the emulator build.May be called multiple times to link additional utilities.
- property platform: Literal['helios', 'sol']¶
The quantum platform to target. Defaults to
"helios".
- with_build_arg(key: str, value: Any) Self[source]¶
Selene builds may support additional customisable arguments, e.g. to override the choice of compilation route. This is passed to selene_sim.build as kwargs.
For example:
.with_build_arg("build_method", "via-llvm_ir")
is equivalent to
selene_sim.build(..., build_method="via-llvm_ir")
which saves LLVM IR into the build directory rather than saving bitcode.
- with_build_dir(value: Path | None) Self[source]¶
Set the build directory for the emulator instance, see EmulatorBuilder.build_dir.