Select local Selene or Nexus Helios for direct HUGR execution.
Overview¶
| Class | Description |
|---|---|
HugrExecutionTarget | Identify a supported HUGR execution destination. |
HugrExecutor | Execute HUGR packages on local Selene or Nexus Helios. |
NexusExecutionOptions | Configure HUGR execution on a Helios target through Nexus. |
SeleneExecutionOptions | Configure local Selene execution. |
Classes¶
HugrExecutionTarget [source]¶
class HugrExecutionTarget(StrEnum)Identify a supported HUGR execution destination.
Attributes¶
HELIOSSELENE
HugrExecutor [source]¶
class HugrExecutorExecute HUGR packages on local Selene or Nexus Helios.
Parameters:
| Name | Type | Description |
|---|---|---|
target | str | HugrExecutionTarget | Destination, default selene. |
options | SeleneExecutionOptions | NexusExecutionOptions | None | Destination-specific settings. Defaults to the destination defaults. |
Raises:
ValueError— If the destination is unknown.TypeError— If options belong to another destination.
Example:
>>> executor = HugrExecutor(options=SeleneExecutionOptions(seed=7))
>>> remote = HugrExecutor("helios", options=NexusExecutionOptions())Constructor¶
def __init__(
self,
target: str | HugrExecutionTarget = HugrExecutionTarget.SELENE,
*,
options: SeleneExecutionOptions | NexusExecutionOptions | None = None,
) -> NoneInitialize the destination and local compilation cache.
Parameters:
| Name | Type | Description |
|---|---|---|
target | str | HugrExecutionTarget | Selene or Helios destination. |
options | SeleneExecutionOptions | NexusExecutionOptions | None | Destination-specific configuration. |
Raises:
ValueError— If the destination is unknown.TypeError— If options are incompatible with the destination.
Attributes¶
capabilities: ExecutionCapabilities Describe this destination’s actual execution features.optionstarget
Methods¶
retrieve¶
def retrieve(self, reference: ExecutionReference) -> ExecutionHandle[list[dict[str, Any]]]Restore a remote tagged execution without resubmitting it.
Parameters:
| Name | Type | Description |
|---|---|---|
reference | ExecutionReference | Saved Nexus job reference. |
Returns:
ExecutionHandle[list[dict[str, Any]]] — ExecutionHandle[list[dict[str, Any]]]: Restored remote handle.
Raises:
ValueError— If the destination is local or reference is invalid.Exception— If the provider cannot retrieve the referenced job.
submit¶
def submit(self, package: Any, shots: int = 1024) -> ExecutionHandle[list[dict[str, Any]]]Submit a zero-argument HUGR entrypoint with recorded outputs.
Use HugrExecutable for ABI-aware runtime arguments and typed jobs.
Parameters:
| Name | Type | Description |
|---|---|---|
package | Any | HUGR package with a zero-argument main function. |
shots | int | Number of repetitions, default 1024. |
Returns:
ExecutionHandle[list[dict[str, Any]]] — ExecutionHandle[list[dict[str, Any]]]: Tagged values for each shot.
Raises:
ValueError— If shots is invalid or output tags repeat.ImportError— If destination dependencies are missing.RuntimeError— If the simulator returns an incorrect shot count.Exception— If provider compilation or submission fails.
NexusExecutionOptions [source]¶
class NexusExecutionOptionsConfigure HUGR execution on a Helios target through Nexus.
Parameters:
| Name | Type | Description |
|---|---|---|
project | Any | None | Native qnexus project reference. None uses the active Nexus project. |
backend_config | Any | None | Native qnexus.HeliosConfig with optional emulator or compiler settings. When supplied, its system_name takes precedence over system_name below. |
system_name | str | Helios device name, defaulting to Helios-1. |
name | str | Program and job name prefix. Each submission receives a unique suffix, including separate expectation measurement jobs. |
max_cost | float | None | Optional maximum HQC cost for each submitted program. This is not an aggregate expectation-estimation budget. |
n_qubits | int | None | Optional maximum qubit count passed to Nexus. |
credential_name | str | None | Name of a credential already in Nexus. |
user_group | str | None | Nexus user group for scheduling. |
target_region | str | NexusRegion | None | Execution region, us or sg. |
poll_interval_seconds | float | Positive local status polling interval. |
timeout_seconds | float | None | Default local status-wait deadline. None waits indefinitely. Timing out never cancels a job. |
Raises:
ValueError— If a numeric option, name, region, or config is invalid.
Constructor¶
def __init__(
self,
project: Any | None = None,
backend_config: Any | None = None,
system_name: str = 'Helios-1',
name: str = 'qamomile-hugr',
max_cost: float | None = None,
n_qubits: int | None = None,
credential_name: str | None = None,
user_group: str | None = None,
target_region: str | NexusRegion | None = None,
poll_interval_seconds: float = 1.0,
timeout_seconds: float | None = None,
) -> NoneAttributes¶
backend_config: Any | Nonecredential_name: str | Nonemax_cost: float | Nonen_qubits: int | Nonename: strpoll_interval_seconds: floatproject: Any | Nonesystem_name: strtarget_region: str | NexusRegion | Nonetimeout_seconds: float | Noneuser_group: str | None
SeleneExecutionOptions [source]¶
class SeleneExecutionOptionsConfigure local Selene execution.
Parameters:
| Name | Type | Description |
|---|---|---|
seed | int | None | Reproducible simulator seed, or provider default. |
n_qubits | int | None | Simulator capacity override. By default use an allocation bound expanded through the submitted call graph. |
timeout_seconds | float | None | Maximum simulator execution duration. |
build_dir | Path | None | Root for persistent isolated compilation directories. If omitted, the executor owns a temporary directory that is removed when the executor is released. |
Raises:
ValueError— If a numeric option is invalid.TypeError— If the seed or capacity is not an integer.
Constructor¶
def __init__(
self,
seed: int | None = None,
n_qubits: int | None = None,
timeout_seconds: float | None = None,
build_dir: Path | None = None,
) -> NoneAttributes¶
build_dir: Path | Nonen_qubits: int | Noneseed: int | Nonetimeout_seconds: float | None