lava.magma.runtime.runtime_services

lava.magma.runtime.runtime_services.enums

digraph inheritance051daea4d1 { bgcolor=transparent; rankdir=TB; size=""; "Enum" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Generic enumeration."]; "IntEnum" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Enum where members are also (and must be) ints"]; "Enum" -> "IntEnum" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LoihiPhase" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.enums.LoihiPhase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Enumerator of Lava Loihi phases"]; "LoihiVersion" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.enums.LoihiVersion",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Enumerator of different Loihi Versions."]; "IntEnum" -> "LoihiVersion" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NxSdkPhase" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.enums.NxSdkPhase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Enumerator phases in which snip can run in nxcore."]; }
class lava.magma.runtime.runtime_services.enums.LoihiPhase

Bases: object

Enumerator of Lava Loihi phases

HOST = array([5.])
LRN = array([3.])
POST_MGMT = array([4.])
PRE_MGMT = array([2.])
SPK = array([1.])
class lava.magma.runtime.runtime_services.enums.LoihiVersion(value)

Bases: IntEnum

Enumerator of different Loihi Versions.

N2 = 2
N3 = 3
class lava.magma.runtime.runtime_services.enums.NxSdkPhase

Bases: object

Enumerator phases in which snip can run in nxcore.

EMBEDDED_INIT = 1

INIT Phase of Embedded Snip. This executes only once.

EMBEDDED_MGMT = 4

Management Phase of Embedded Snip.

EMBEDDED_PRELEARN_MGMT = 3

Pre-Learn Management Phase of Embedded Snip.

EMBEDDED_REMOTE_MGMT = 9

A management phase snip triggered remotely

EMBEDDED_SPIKING = 2

SPIKING Phase of Embedded Snip.

EMBEDDED_USER_CMD = 8

Any User Command to execute during embedded execution. (Internal Use Only)

HOST_CONCURRENT_EXECUTION = 7

Concurrent Execution for Host Snip.

HOST_POST_EXECUTION = 6

Host Post Execution Phase for Host Snip.

HOST_PRE_EXECUTION = 5

Host Pre Execution Phase for Host Snip.

lava.magma.runtime.runtime_services.interfaces

digraph inheritanceaf6df09e1a { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AbstractRuntimeService" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.interfaces.AbstractRuntimeService",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "ABC" -> "AbstractRuntimeService" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.runtime.runtime_services.interfaces.AbstractRuntimeService(protocol)

Bases: ABC

join()
abstract run()
start()

lava.magma.runtime.runtime_services.runtime_service

digraph inheritance6b50a9cb7b { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AbstractRuntimeService" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.interfaces.AbstractRuntimeService",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "ABC" -> "AbstractRuntimeService" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsyncPyRuntimeService" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.runtime_service.AsyncPyRuntimeService",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="RuntimeService that implements Async SyncProtocol in Py."]; "PyRuntimeService" -> "AsyncPyRuntimeService" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LoihiPyRuntimeService" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.runtime_service.LoihiPyRuntimeService",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="RuntimeService that implements Loihi SyncProtocol in Python."]; "PyRuntimeService" -> "LoihiPyRuntimeService" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PyRuntimeService" [URL="../lava/lava.magma.runtime.runtime_services.html#lava.magma.runtime.runtime_services.runtime_service.PyRuntimeService",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract RuntimeService for Python, it provides base methods"]; "AbstractRuntimeService" -> "PyRuntimeService" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

The RuntimeService interface is responsible for coordinating the execution of a group of process models belonging to a common synchronization domain. The domain will follow a SyncProtocol or will be asynchronous. The processes and their corresponding process models are selected by the Runtime dependent on the RunConfiguration assigned at the start of execution. For each group of processes which follow the same protocol and execute on the same node, the Runtime creates a RuntimeService. Each RuntimeService coordinates all actions and commands from the Runtime, transmitting them to the processes under its management and returning action and command responses back to Runtime.

RuntimeService Types:

PyRuntimeService: (Abstract Class) Coordinates process models executing on

the CPU and written in Python. Concrete Implementations:

  1. LoihiPyRuntimeService: Coordinates process models executing on the CPU and written in Python and following the LoihiProtocol.

  2. AsyncPyRuntimeService: Coordinates process models executing on the CPU and written in Python and following the AsyncProtocol.

class lava.magma.runtime.runtime_services.runtime_service.AsyncPyRuntimeService(protocol, *args, **kwargs)

Bases: PyRuntimeService

RuntimeService that implements Async SyncProtocol in Py.

class PMResponse

Bases: object

REQ_PAUSE = array([-4.])

Signifies Request of PAUSE

REQ_STOP = array([-5.])

Signifies Request of STOP

STATUS_DONE = array([0.])

Signfies Ack or Finished with the Command

STATUS_ERROR = array([-2.])

Signifies Error raised

STATUS_PAUSED = array([-3.])

Signifies Execution State to be Paused

STATUS_TERMINATED = array([-1.])

Signifies Termination

run()

Retrieves commands from the runtime and relays them to the process models. Also send the acknowledgement back to runtime.

class lava.magma.runtime.runtime_services.runtime_service.LoihiPyRuntimeService(protocol, *args, **kwargs)

Bases: PyRuntimeService

RuntimeService that implements Loihi SyncProtocol in Python.

class PMResponse

Bases: object

REQ_LEARNING = array([-5.])

Signifies Request of LEARNING

REQ_PAUSE = array([-7.])

Signifies Request of PAUSE

REQ_POST_LRN_MGMT = array([-6.])

Signifies Request of PREMPTION

REQ_PRE_LRN_MGMT = array([-4.])

Signifies Request of PREMPTION

REQ_STOP = array([-8.])

Signifies Request of STOP

STATUS_DONE = array([0.])

Signfies Ack or Finished with the Command

STATUS_ERROR = array([-2.])

Signifies Error raised

STATUS_PAUSED = array([-3.])

Signifies Execution State to be Paused

STATUS_TERMINATED = array([-1.])

Signifies Termination

class Phase

Bases: object

HOST = array([5.])
LRN = array([3.])
POST_MGMT = array([4.])
PRE_MGMT = array([2.])
SPK = array([1.])
run()

Retrieves commands from the runtime. On STOP or PAUSE commands all ProcessModels are notified and expected to TERMINATE or PAUSE, respectively. Otherwise the number of time steps is received as command. In this case iterate through the phases of the Loihi protocol until the last time step is reached. The runtime is informed after the last time step. The loop ends when receiving the STOP command from the runtime.

class lava.magma.runtime.runtime_services.runtime_service.PyRuntimeService(protocol, *args, **kwargs)

Bases: AbstractRuntimeService

Abstract RuntimeService for Python, it provides base methods for start and run. It is not meant to instantiated directly but used by inheritance

join()

Stop the necessary channels to coordinate with runtime and group of processes this RuntimeService is managing

abstract run()

Override this method to implement the runtime service. The run method is invoked upon start which called when the execution is started by the runtime.

start()

Start the necessary channels to coordinate with runtime and group of processes this RuntimeService is managing