Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

qamomile.hugr.execution

Select local Selene or Nexus Helios for direct HUGR execution.

Overview

ClassDescription
HugrExecutionTargetIdentify a supported HUGR execution destination.
HugrExecutorExecute HUGR packages on local Selene or Nexus Helios.
NexusExecutionOptionsConfigure HUGR execution on a Helios target through Nexus.
SeleneExecutionOptionsConfigure local Selene execution.

Classes

HugrExecutionTarget [source]

class HugrExecutionTarget(StrEnum)

Identify a supported HUGR execution destination.

Attributes


HugrExecutor [source]

class HugrExecutor

Execute HUGR packages on local Selene or Nexus Helios.

Parameters:

NameTypeDescription
targetstr | HugrExecutionTargetDestination, default selene.
optionsSeleneExecutionOptions | NexusExecutionOptions | NoneDestination-specific settings. Defaults to the destination defaults.

Raises:

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,
) -> None

Initialize the destination and local compilation cache.

Parameters:

NameTypeDescription
targetstr | HugrExecutionTargetSelene or Helios destination.
optionsSeleneExecutionOptions | NexusExecutionOptions | NoneDestination-specific configuration.

Raises:

Attributes

Methods

retrieve
def retrieve(self, reference: ExecutionReference) -> ExecutionHandle[list[dict[str, Any]]]

Restore a remote tagged execution without resubmitting it.

Parameters:

NameTypeDescription
referenceExecutionReferenceSaved Nexus job reference.

Returns:

ExecutionHandle[list[dict[str, Any]]] — ExecutionHandle[list[dict[str, Any]]]: Restored remote handle.

Raises:

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:

NameTypeDescription
packageAnyHUGR package with a zero-argument main function.
shotsintNumber of repetitions, default 1024.

Returns:

ExecutionHandle[list[dict[str, Any]]] — ExecutionHandle[list[dict[str, Any]]]: Tagged values for each shot.

Raises:


NexusExecutionOptions [source]

class NexusExecutionOptions

Configure HUGR execution on a Helios target through Nexus.

Parameters:

NameTypeDescription
projectAny | NoneNative qnexus project reference. None uses the active Nexus project.
backend_configAny | NoneNative qnexus.HeliosConfig with optional emulator or compiler settings. When supplied, its system_name takes precedence over system_name below.
system_namestrHelios device name, defaulting to Helios-1.
namestrProgram and job name prefix. Each submission receives a unique suffix, including separate expectation measurement jobs.
max_costfloat | NoneOptional maximum HQC cost for each submitted program. This is not an aggregate expectation-estimation budget.
n_qubitsint | NoneOptional maximum qubit count passed to Nexus.
credential_namestr | NoneName of a credential already in Nexus.
user_groupstr | NoneNexus user group for scheduling.
target_regionstr | NexusRegion | NoneExecution region, us or sg.
poll_interval_secondsfloatPositive local status polling interval.
timeout_secondsfloat | NoneDefault local status-wait deadline. None waits indefinitely. Timing out never cancels a job.

Raises:

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,
) -> None

Attributes


SeleneExecutionOptions [source]

class SeleneExecutionOptions

Configure local Selene execution.

Parameters:

NameTypeDescription
seedint | NoneReproducible simulator seed, or provider default.
n_qubitsint | NoneSimulator capacity override. By default use an allocation bound expanded through the submitted call graph.
timeout_secondsfloat | NoneMaximum simulator execution duration.
build_dirPath | NoneRoot for persistent isolated compilation directories. If omitted, the executor owns a temporary directory that is removed when the executor is released.

Raises:

Constructor

def __init__(
    self,
    seed: int | None = None,
    n_qubits: int | None = None,
    timeout_seconds: float | None = None,
    build_dir: Path | None = None,
) -> None

Attributes