lava.magma.core

lava.magma.core.callback_fx

digraph inheritanceab89b6e0cb { 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"]; "CallbackFx" [URL="../lava/lava.magma.core.html#lava.magma.core.callback_fx.CallbackFx",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="Base class for callback functions which are executed before"]; "ABC" -> "CallbackFx" [arrowsize=0.5,style="setlinewidth(0.5)"]; "IterableCallBack" [URL="../lava/lava.magma.core.html#lava.magma.core.callback_fx.IterableCallBack",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="NxSDK callback function to execute iterable of function pointers"]; "NxSdkCallbackFx" -> "IterableCallBack" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NxBoard" [URL="../lava/lava.magma.core.html#lava.magma.core.callback_fx.NxBoard",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"]; "NxSdkCallbackFx" [URL="../lava/lava.magma.core.html#lava.magma.core.callback_fx.NxSdkCallbackFx",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 class for callback functions processed in the"]; "CallbackFx" -> "NxSdkCallbackFx" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.core.callback_fx.CallbackFx

Bases: ABC

Base class for callback functions which are executed before and after a run in the runtime service. The base class provides the infrastructure to communicate information from runtime to runtime service and vice versa as well as the abstract pre- and post-callback methods, which needs to be overrwritten by the special CallbackFx classes for each compute ressource.

TODO: implement runtime <-> runtime_service channel communication.

get_data_from_runtime()
Return type:

ndarray

get_data_from_runtime_service()
Return type:

ndarray

send_data_to_runtime(data)
send_data_to_runtime_service(data)
class lava.magma.core.callback_fx.IterableCallBack(pre_run_fxs=None, post_run_fxs=None)

Bases: NxSdkCallbackFx

NxSDK callback function to execute iterable of function pointers as pre and post run.

post_run_callback(board=None, var_id_to_var_model_map=None)
Return type:

None

pre_run_callback(board=None, var_id_to_var_model_map=None)
Return type:

None

class lava.magma.core.callback_fx.NxBoard

Bases: object

class lava.magma.core.callback_fx.NxSdkCallbackFx

Bases: CallbackFx

Abstract class for callback functions processed in the NxSdkRuntimeSercice pre- and post run.

TODO: implement runtime <-> runtime_service channel communication.

abstract post_run_callback(board=None, var_id_to_var_model_map=None)
abstract pre_run_callback(board=None, var_id_to_var_model_map=None)

lava.magma.core.decorator

lava.magma.core.decorator.implements(proc=None, protocol=None)

Decorates ProcessModel class by adding the class of the Process and SyncProtocol that this ProcessModel implements as a class variable.

‘implements’ will fail if an attempt is made to overwrite an already set Process or SyncProtocol class of a parent class.

Parameters:
  • proc (The Process class that the ProcessModel implements.) –

  • protocol (The SyncProtocol tht the ProcessModel implements.) –

lava.magma.core.decorator.requires(*args)

Decorator for ProcessModel classes that adds class variable to ProcessModel class that specifies which resources the ProcessModel requires. In order to express optionality between one or more resources, include them in a list or tuple.

Example: @requires(Res1, Res2, [Res3, Res4])

-> Requires Res1 and Res2 and one of Res3 or Res4

lava.magma.core.decorator.tag(*args)

Decorator for ProcessModel to add a class variable (a list of tags) to ProcessModel class, which further distinguishes ProcessModels implementing the same Process, with the same type and requiring the same ComputeResources.

For example, a user may write multiple ProcessModels in Python ( PyProcessModels), requiring CPU for execution (@requires(CPU)). The compiler selects the appropriate ProcessModel via RunConfig using the keywords stored in the list of tags set by this decorator.

The list of tags is additive over inheritance. Which means, if @tag decorates a child class, whose parent is already decorated, then the new keywords are appended to the tag-list inherited from the parent.

Parameters:

args (keywords that tag a ProcessModel) –

Return type:

Decorated class

Examples

>>> @implements(proc=ExampleProcess)
>>> @tag('bit-accurate', 'loihi')
>>> class ExampleProcModel(AbstractProcessModel):...

These tags identify a particular ProcessModel as being bit-accurate with Loihi hardware platform. This means that, the numerical output produced by such a ProcessModel on a CPU would be the same as on Loihi.

lava.magma.core.resources

digraph inheritancef76bd67e81 { 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"]; "AbstractComputeResource" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.AbstractComputeResource",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="A compute resource, for example a particular type of neuromorphic"]; "AbstractResource" -> "AbstractComputeResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractNode" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.AbstractNode",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="A node is a resource that has other compute or peripheral resources."]; "ABC" -> "AbstractNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractPeripheralResource" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.AbstractPeripheralResource",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="A hardware resource that is a peripheral device."]; "AbstractResource" -> "AbstractPeripheralResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractResource" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.AbstractResource",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="A hardware resource like a compute resource (e.g., a particular type"]; "ABC" -> "AbstractResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CPU" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.CPU",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="A central processing unit on a regular computer or laptop."]; "AbstractComputeResource" -> "CPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "DVS" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.DVS",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="An event-based dynamic vision sensor (DVS)."]; "AbstractPeripheralResource" -> "DVS" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ECPU" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.ECPU",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="An embedded central processing unit that is part of a neuromorphic"]; "AbstractComputeResource" -> "ECPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GPU" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.GPU",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="A graphical processing unit."]; "AbstractComputeResource" -> "GPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "GenericNode" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.GenericNode",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="A generic resource with a regular CPU and a hard drive."]; "AbstractNode" -> "GenericNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HardDrive" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.HardDrive",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="A hard drive in a computer."]; "AbstractPeripheralResource" -> "HardDrive" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HeadNode" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.HeadNode",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="The node on which user executes code, perhaps because processes"]; "GenericNode" -> "HeadNode" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HeadNodeHardDrive" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.HeadNodeHardDrive",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="A hard drive attached to a HeadNode (the node on which a user executes"]; "AbstractPeripheralResource" -> "HeadNodeHardDrive" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HostCPU" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.HostCPU",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="A central processing unit on a special host system that holds"]; "AbstractComputeResource" -> "HostCPU" [arrowsize=0.5,style="setlinewidth(0.5)"]; "KapohoBay" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.KapohoBay",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="A KapohoBay system (USB form-factor) that consists of two Loihi 1 chips"]; "Loihi1System" -> "KapohoBay" [arrowsize=0.5,style="setlinewidth(0.5)"]; "KapohoPoint" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.KapohoPoint",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="The smallest form-factor system with four Loihi 2 chips."]; "Loihi2System" -> "KapohoPoint" [arrowsize=0.5,style="setlinewidth(0.5)"]; "LMT" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.LMT",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="A Lakemont embedded central processing unit."]; "ECPU" -> "LMT" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi1NeuroCore" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Loihi1NeuroCore",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="A neuromorphic core on a Loihi 1 chip."]; "NeuroCore" -> "Loihi1NeuroCore" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi1System" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Loihi1System",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="A neuromorphic system that carries Loihi 1 chips."]; "AbstractNode" -> "Loihi1System" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi2NeuroCore" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Loihi2NeuroCore",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="A neuromorphic core on a Loihi 2 chip."]; "NeuroCore" -> "Loihi2NeuroCore" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi2System" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Loihi2System",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="A neuromorphic system that carries Loihi 2 chips."]; "AbstractNode" -> "Loihi2System" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Nahuku" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Nahuku",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="A Nahuku system that carries up to 32 Loihi 1 chips."]; "Loihi1System" -> "Nahuku" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NeuroCore" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.NeuroCore",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="A neuromorphic core."]; "AbstractComputeResource" -> "NeuroCore" [arrowsize=0.5,style="setlinewidth(0.5)"]; "OheoGulch" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.OheoGulch",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="Development and test system with a single Loihi 2 chip."]; "Loihi2System" -> "OheoGulch" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PB" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.PB",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="A Powell Bute embedded central processing unit."]; "ECPU" -> "PB" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Pohoiki" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Pohoiki",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="A system configurable to have one or more Nahuku sub systems."]; "Loihi1System" -> "Pohoiki" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Unalaska" [URL="../lava/lava.magma.core.html#lava.magma.core.resources.Unalaska",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"]; "Loihi2System" -> "Unalaska" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.core.resources.AbstractComputeResource

Bases: AbstractResource

A compute resource, for example a particular type of neuromorphic processor or CPU.

class lava.magma.core.resources.AbstractNode

Bases: ABC

A node is a resource that has other compute or peripheral resources.

class lava.magma.core.resources.AbstractPeripheralResource

Bases: AbstractResource

A hardware resource that is a peripheral device.

class lava.magma.core.resources.AbstractResource

Bases: ABC

A hardware resource like a compute resource (e.g., a particular type of neuromorphic processor or a CPU), peripheral device, or complete system that is required for a ProcessModel.

Each ProcessModel lists its required hardware resources with the @requires decorator.

class lava.magma.core.resources.CPU

Bases: AbstractComputeResource

A central processing unit on a regular computer or laptop.

class lava.magma.core.resources.DVS

Bases: AbstractPeripheralResource

An event-based dynamic vision sensor (DVS).

class lava.magma.core.resources.ECPU

Bases: AbstractComputeResource

An embedded central processing unit that is part of a neuromorphic chip.

class lava.magma.core.resources.GPU

Bases: AbstractComputeResource

A graphical processing unit.

class lava.magma.core.resources.GenericNode

Bases: AbstractNode

A generic resource with a regular CPU and a hard drive.

resources = [<class 'lava.magma.core.resources.CPU'>, <class 'lava.magma.core.resources.HardDrive'>]
class lava.magma.core.resources.HardDrive

Bases: AbstractPeripheralResource

A hard drive in a computer.

class lava.magma.core.resources.HeadNode

Bases: GenericNode

The node on which user executes code, perhaps because processes require access to specific disk location.

resources = [<class 'lava.magma.core.resources.CPU'>, <class 'lava.magma.core.resources.HeadNodeHardDrive'>]
class lava.magma.core.resources.HeadNodeHardDrive

Bases: AbstractPeripheralResource

A hard drive attached to a HeadNode (the node on which a user executes code).

class lava.magma.core.resources.HostCPU

Bases: AbstractComputeResource

A central processing unit on a special host system that holds neuromorphic devices.

class lava.magma.core.resources.KapohoBay

Bases: Loihi1System

A KapohoBay system (USB form-factor) that consists of two Loihi 1 chips with Lakemont processors.

resources = [<class 'lava.magma.core.resources.Loihi1NeuroCore'>, <class 'lava.magma.core.resources.LMT'>]
class lava.magma.core.resources.KapohoPoint

Bases: Loihi2System

The smallest form-factor system with four Loihi 2 chips.

resources = [<class 'lava.magma.core.resources.Loihi2NeuroCore'>, <class 'lava.magma.core.resources.LMT'>, <class 'lava.magma.core.resources.PB'>]
class lava.magma.core.resources.LMT

Bases: ECPU

A Lakemont embedded central processing unit.

class lava.magma.core.resources.Loihi1NeuroCore

Bases: NeuroCore

A neuromorphic core on a Loihi 1 chip.

class lava.magma.core.resources.Loihi1System

Bases: AbstractNode

A neuromorphic system that carries Loihi 1 chips.

class lava.magma.core.resources.Loihi2NeuroCore

Bases: NeuroCore

A neuromorphic core on a Loihi 2 chip.

class lava.magma.core.resources.Loihi2System

Bases: AbstractNode

A neuromorphic system that carries Loihi 2 chips.

class lava.magma.core.resources.Nahuku

Bases: Loihi1System

A Nahuku system that carries up to 32 Loihi 1 chips.

resources = [<class 'lava.magma.core.resources.CPU'>, <class 'lava.magma.core.resources.Loihi1NeuroCore'>, <class 'lava.magma.core.resources.LMT'>]
class lava.magma.core.resources.NeuroCore

Bases: AbstractComputeResource

A neuromorphic core.

class lava.magma.core.resources.OheoGulch

Bases: Loihi2System

Development and test system with a single Loihi 2 chip.

resources = [<class 'lava.magma.core.resources.Loihi2NeuroCore'>, <class 'lava.magma.core.resources.LMT'>, <class 'lava.magma.core.resources.PB'>]
class lava.magma.core.resources.PB

Bases: ECPU

A Powell Bute embedded central processing unit.

class lava.magma.core.resources.Pohoiki

Bases: Loihi1System

A system configurable to have one or more Nahuku sub systems.

resources = [<class 'lava.magma.core.resources.CPU'>, <class 'lava.magma.core.resources.Loihi1NeuroCore'>, <class 'lava.magma.core.resources.LMT'>]
class lava.magma.core.resources.Unalaska

Bases: Loihi2System

resources = [<class 'lava.magma.core.resources.CPU'>, <class 'lava.magma.core.resources.Loihi2NeuroCore'>, <class 'lava.magma.core.resources.LMT'>, <class 'lava.magma.core.resources.PB'>]

lava.magma.core.run_conditions

digraph inheritance3b57513042 { 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"]; "AbstractRunCondition" [URL="../lava/lava.magma.core.html#lava.magma.core.run_conditions.AbstractRunCondition",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="Base class for run conditions."]; "ABC" -> "AbstractRunCondition" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RunContinuous" [URL="../lava/lava.magma.core.html#lava.magma.core.run_conditions.RunContinuous",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="Runs a Process continuously without a time step limit (non-blocking)."]; "AbstractRunCondition" -> "RunContinuous" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RunSteps" [URL="../lava/lava.magma.core.html#lava.magma.core.run_conditions.RunSteps",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="Runs a process for a specified number of time steps with respect to a"]; "AbstractRunCondition" -> "RunSteps" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.core.run_conditions.AbstractRunCondition(blocking)

Bases: ABC

Base class for run conditions.

RunConditions specify for how long a process will run.

Parameters:

blocking (bool) – If set to True, blocks further commands from execution until returns.

class lava.magma.core.run_conditions.RunContinuous

Bases: AbstractRunCondition

Runs a Process continuously without a time step limit (non-blocking).

Using this RunCondition, the runtime runs continuously and non-blocking. This means that the runtime must be paused or stopped manually by calling pause() or stop() from the running process. The runtime can be continued after pause() by calling run() again.

class lava.magma.core.run_conditions.RunSteps(num_steps, blocking=True)

Bases: AbstractRunCondition

Runs a process for a specified number of time steps with respect to a SyncDomain assigned to any sub processes.

Parameters:
  • num_steps (int) – Number of steps to be run with respect to the SyncDomain.

  • blocking (bool) – If set to True, blocks further commands from execution until returns. (Default = True)

lava.magma.core.run_configs

digraph inheritancec8ce03f7ad { 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"]; "AbstractCProcessModel" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.AbstractCProcessModel",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"]; "AbstractLoihiHWRunCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.AbstractLoihiHWRunCfg",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"]; "AbstractLoihiRunCfg" -> "AbstractLoihiHWRunCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractLoihiRunCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.AbstractLoihiRunCfg",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="Selects the appropriate ProcessModel for Loihi RunConfigs."]; "RunConfig" -> "AbstractLoihiRunCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractLoihiSimRunCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.AbstractLoihiSimRunCfg",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"]; "AbstractLoihiRunCfg" -> "AbstractLoihiSimRunCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractNcProcessModel" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.AbstractNcProcessModel",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"]; "Loihi1HwCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.Loihi1HwCfg",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="A RunConfig for executing model on Loihi1 HW."]; "AbstractLoihiHWRunCfg" -> "Loihi1HwCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi1SimCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.Loihi1SimCfg",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="Run configuration selects appropriate ProcessModel -- either"]; "AbstractLoihiSimRunCfg" -> "Loihi1SimCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi2HwCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.Loihi2HwCfg",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="A RunConfig for executing model on Loihi2 HW."]; "AbstractLoihiHWRunCfg" -> "Loihi2HwCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Loihi2SimCfg" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.Loihi2SimCfg",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="A RunConfig for simulating a Loihi 2 model CPU/GPU."]; "Loihi1SimCfg" -> "Loihi2SimCfg" [arrowsize=0.5,style="setlinewidth(0.5)"]; "RunConfig" [URL="../lava/lava.magma.core.html#lava.magma.core.run_configs.RunConfig",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="Basic run configuration and base class for other run configurations."]; "ABC" -> "RunConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class lava.magma.core.run_configs.AbstractCProcessModel

Bases: object

class lava.magma.core.run_configs.AbstractLoihiHWRunCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30)

Bases: AbstractLoihiRunCfg

class lava.magma.core.run_configs.AbstractLoihiRunCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30)

Bases: RunConfig

Selects the appropriate ProcessModel for Loihi RunConfigs.

The following set of rules is applied, in that order of precedence:

1. A dictionary of exceptions exception_proc_model_map is checked first, in which user specifies key-value pairs {Process: ProcessModel} and the ProcessModel is returned.

  1. If there is only 1 ProcessModel available:

    • If the user does not specifically ask for any tags, the ProcessModel is returned

    • If the user asks for a specific tag, then the ProcessModel is returned only if the tag is found in its list of tags.

  2. If there are multiple `ProcessModel`s available:

    • If the user asks specifically to look for `SubProcessModel`s and they are available:

      • If there is only 1 SubProcessModel available, it is returned

      • If the user did not ask for any specific tags, the first available SubProcessModel is returned

      • If user asked for a specific tag, the first valid SubProcessModel is returned, which has the tag in its tag-list

    • If user did not explicitly ask for `SubProcessModel`s:

      • If the user did not also ask for any specific tag, then the first available ProcessModel is returned that requires the correct computing hardware.

      • If the user asked for a specific tag, the hardware-specific ProcessModel which has the tag in its tag-list is returned

Parameters:
  • custom_sync_domains (List[SyncDomain]) – list of synchronization domains

  • select_tag (str) – The RunConfig will select only ProcessModels that have the tag ‘select_tag’. Example: By setting select_tag=”fixed_pt”, it will select ProcessModels that implement a fixed-point implementation of the Lava Processes in the architecture that is to be executed.

  • select_sub_proc_model (bool) – When set to True, hierarchical SubProcessModels are selected over LeafProcessModels, where available.

  • exception_proc_model_map ((Dict[AbstractProcess, AbstractProcessModel])) – explicit dictionary of {Process: ProcessModel} classes, provided as exceptions to the ProcessModel selection logic. The choices made in this dict are respected over any logic. For example, {Dense: PyDenseModel}. Note that this is a dict mapping classnames to classnames.

  • loglevel (int) – sets level of event logging, as defined by Python’s ‘logging’ facility. Default: logging.WARNING

select(process, proc_models)

Selects an appropriate ProcessModel from a list of ProcessModels for a Process, based on user requests.

Parameters:
Return type:

Selected ProcessModel class

class lava.magma.core.run_configs.AbstractLoihiSimRunCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30)

Bases: AbstractLoihiRunCfg

class lava.magma.core.run_configs.AbstractNcProcessModel

Bases: object

class lava.magma.core.run_configs.Loihi1HwCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30, callback_fxs=None, embedded_allocation_order=EMBEDDED_ALLOCATION_ORDER.NORMAL)

Bases: AbstractLoihiHWRunCfg

A RunConfig for executing model on Loihi1 HW. For Loihi1 HW configurations, the preferred ProcModels are NcProcModels that can run on a NeuroCore of a Loihi1NeuroCore or, if none is found, CProcModels. This preference can be overwritten by a tag provided by the user. This RunConfig will default to a PyProcModel if no Loihi1-compatible ProcModel is being found. .

class lava.magma.core.run_configs.Loihi1SimCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30)

Bases: AbstractLoihiSimRunCfg

Run configuration selects appropriate ProcessModel – either SubProcessModel for a hierarchical Process or else a PyProcessModel for a standard Process.

class lava.magma.core.run_configs.Loihi2HwCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30, callback_fxs=None, embedded_allocation_order=EMBEDDED_ALLOCATION_ORDER.NORMAL)

Bases: AbstractLoihiHWRunCfg

A RunConfig for executing model on Loihi2 HW. For Loihi2 HW configurations, the preferred ProcModels are NcProcModels that can run on a NeuroCore of a Loihi2NeuroCore or, if none is found, CProcModels. This preference can be overwritten by a tag provided by the user. This RunConfig will default to a PyProcModel if no Loihi2-compatible ProcModel is being found.

class lava.magma.core.run_configs.Loihi2SimCfg(custom_sync_domains=None, select_tag=None, select_sub_proc_model=False, exception_proc_model_map=None, loglevel=30)

Bases: Loihi1SimCfg

A RunConfig for simulating a Loihi 2 model CPU/GPU.

class lava.magma.core.run_configs.RunConfig(custom_sync_domains=None, loglevel=30)

Bases: ABC

Basic run configuration and base class for other run configurations.

A RunConfig specifies how to execute Processes on a specific hardware backend. Its main purpose is to select the appropriate ProcessModels given the Processes to be executed and the given tags (i.e. bit-accurate, floating, etc) using the select() function.

A RunConfig allows the user to guide the compiler in its choice of ProcessModels. When the user compiles/runs a Process for the first time, a specific RunConfig must be provided. The compiler will follow the selection rules laid out in the select() method of the RunConfig to choose the optimal ProcessModel for the Process.

A RunConfig can filter the ProcessModels by various criteria. Examples include the preferred computing resource or user-defined tags. It may also specify how many computing nodes of a certain type, like embedded CPUs, will be available. This will allow to allocate all RuntimeService processes during compilation. A RunConfig can also give hints to the compiler which computational nodes are required and which are excluded.

Parameters:
  • custom_sync_domains (List[SyncDomain]) – List of user-specified synchronization domains.

  • loglevel (int) – Sets level of event logging, as defined by Python’s ‘logging’ facility. Default: logging.WARNING

exclude_nodes(nodes)

Excludes given nodes from consideration by compiler.

require_nodes(nodes)

Requires that compiler maps processes to given nodes.

select(process, proc_model)
Return type:

ty.Type[AbstractProcessModel]