netqasm.runtime.application
NetQASM application definitions.
NetQASM applications are modeled as pieces of Python code together with metadata. Generally, applications are multi-node, i.e. they consist of separate chunks of code that are run by separate nodes.
To distinguish the notion of a multiple-node-spanning collection of code and single-node piece of code, the following terminology is used:
A Program is code that runs on a single node. It is a Python script whose code is executed on (1) the Host component of that node and (2) the quantum node controller of that node.
An Application is a collection of Programs (specifically, one Program per node).
- class netqasm.runtime.application.Program(party, entry, args, results)
Bases:
objectProgram running on one specific node. Part of a multi-node application.
- Parameters:
party (
str) – name of the party or role in the multi-node application (protocol). E.g. a blind computation application may have two parties: “client” and “server”. Note that the party name is not necessarily the name of the node this Program runs on (which may be, e.g. “Delft”).entry (
Callable) – entry point of the Program. This must be Python function.args (
List[str]) – list of argument names that the entry point expectsresults (
List[str]) – list of result names that are keys in the dictionary that this Program returns on completion
-
party:
str
-
entry:
Callable
-
args:
List[str]
-
results:
List[str]
- class netqasm.runtime.application.AppMetadata(name, description, authors, version)
Bases:
objectMetadata about a NetQASM application.
- Parameters:
name (
str) – name of the applicationdescription (
str) – description of the applicationauthors (
List[str]) – list of authors of the applicationversion (
str) – application version
-
name:
str
-
description:
str
-
authors:
List[str]
-
version:
str
- class netqasm.runtime.application.Application(programs, metadata)
Bases:
objectStatic NetQASM application (or protocol) information.
- Parameters:
programs (
List[Program]) – list of programs for each of the parties that are involved in this application (or protocol).metadata (
Optional[AppMetadata]) – application metadata
-
metadata:
Optional[AppMetadata]
- class netqasm.runtime.application.ApplicationInstance(app, program_inputs, network, party_alloc, logging_cfg)
Bases:
object- Instantiation of a NetQASM application with concrete input values and
configuration of the underlying network.
- Parameters:
app (
Application) – static application infoprogram_inputs (
Dict[str,Dict[str,Any]]) – program input values for each of the application’s programsnetwork (
Optional[NetworkConfig]) – configuration for a simulated networkparty_alloc (
Dict[str,str]) – mapping of application parties to nodes in the networklogging_cfg (
Optional[LogConfig]) – logging configuration
-
app:
Application
-
program_inputs:
Dict[str,Dict[str,Any]]
-
network:
Optional[NetworkConfig]
-
party_alloc:
Dict[str,str]
- class netqasm.runtime.application.ApplicationOutput
Bases:
objectResults of a finished run of an ApplicationInstance. Should be subclassed.
- netqasm.runtime.application.load_yaml_file(path)
- Parameters:
path (
str)- Return type:
Any
- netqasm.runtime.application.app_instance_from_path(app_dir=None)
Create an Application Instance based on files in a directory. Uses the current working directory if app_dir is None.
- Parameters:
app_dir (
Optional[str])- Return type:
- netqasm.runtime.application.default_app_instance(programs)
Create an Application Instance with programs that take no arguments.
- Parameters:
programs (
List[Tuple[str,Callable]])- Return type:
- netqasm.runtime.application.network_cfg_from_path(app_dir=None, network_config_file=None)
- Parameters:
app_dir (
Optional[str])network_config_file (
Optional[str])
- Return type:
Optional[NetworkConfig]
- netqasm.runtime.application.post_function_from_path(app_dir=None, post_function_file=None)
- Parameters:
app_dir (
Optional[str])post_function_file (
Optional[str])
- Return type:
Optional[Callable]