lava.magma.compiler.channels

lava.magma.compiler.channels.interfaces

digraph inheritanceca5ac05711 { 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"]; "AbstractCspPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspPort",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 base class for CSP channel."]; "ABC" -> "AbstractCspPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractCspRecvPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspRecvPort",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"]; "AbstractCspPort" -> "AbstractCspRecvPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractCspSendPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspSendPort",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"]; "AbstractCspPort" -> "AbstractCspSendPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Channel" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.Channel",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" -> "Channel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ChannelType" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.ChannelType",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="Type of a channel given the two process models"]; "IntEnum" -> "ChannelType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "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)"]; }
class lava.magma.compiler.channels.interfaces.AbstractCspPort

Bases: ABC

Abstract base class for CSP channel.

abstract property d_type: dtype
is_msg_size_static()
Return type:

bool

abstract join()
abstract property name: str
abstract property shape: Tuple[int, ...]
abstract property size: int
abstract start()
class lava.magma.compiler.channels.interfaces.AbstractCspRecvPort

Bases: AbstractCspPort

abstract recv()
Return type:

ndarray

class lava.magma.compiler.channels.interfaces.AbstractCspSendPort

Bases: AbstractCspPort

abstract send(data)
class lava.magma.compiler.channels.interfaces.Channel

Bases: ABC

abstract property dst_port: AbstractCspRecvPort
abstract property src_port: AbstractCspSendPort
class lava.magma.compiler.channels.interfaces.ChannelType(value)

Bases: IntEnum

Type of a channel given the two process models

CC = 3
CNc = 3
CPy = 1
NcC = 4
NcNc = 5
NcPy = 6
PyC = 2
PyNc = 7
PyPy = 0

lava.magma.compiler.channels.pypychannel

digraph inheritance60856325b3 { 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"]; "AbstractCspPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspPort",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 base class for CSP channel."]; "ABC" -> "AbstractCspPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractCspRecvPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspRecvPort",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"]; "AbstractCspPort" -> "AbstractCspRecvPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AbstractCspSendPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.AbstractCspSendPort",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"]; "AbstractCspPort" -> "AbstractCspSendPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Channel" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.interfaces.Channel",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" -> "Channel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CspRecvPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.CspRecvPort",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="CspRecvPort is a low level recv port implementation based on CSP"]; "AbstractCspRecvPort" -> "CspRecvPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CspRecvQueue" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.CspRecvQueue",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="Underlying queue which backs the CspRecvPort"]; "Queue" -> "CspRecvQueue" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CspSelector" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.CspSelector",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="Utility class to allow waiting for multiple channels to become ready"]; "CspSendPort" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.CspSendPort",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="CspSendPort is a low level send port implementation based on CSP"]; "AbstractCspSendPort" -> "CspSendPort" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Proto" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.Proto",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="Proto(shape: numpy.ndarray, dtype: numpy.dtype, nbytes: int)"]; "PyPyChannel" [URL="../lava/lava.magma.compiler.channels.html#lava.magma.compiler.channels.pypychannel.PyPyChannel",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="Helper class to create the set of send and recv port and encapsulate"]; "Channel" -> "PyPyChannel" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Queue" [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="Create a queue object with a given maximum size."]; }
class lava.magma.compiler.channels.pypychannel.CspRecvPort(name, shm, proto, size, req, ack, io_watchdog, join_watchdog)

Bases: AbstractCspRecvPort

CspRecvPort is a low level recv port implementation based on CSP semantics. It can be understood as the output port of a CSP channel.

property d_type: dtype
join()
property name: str
peek()

Return the next token on the channel without acknowledging it. Blocks if there is no data on the channel.

probe()

Returns True if a ‘recv’ call will not block, and False otherwise. Does not block.

recv()

Receive from the channel. Blocks if there is no data on the channel.

property shape: Tuple[int, ...]
property size: int
start()

Starts the port to listen on a thread

class lava.magma.compiler.channels.pypychannel.CspRecvQueue(maxsize=0)

Bases: Queue

Underlying queue which backs the CspRecvPort

get(block=True, timeout=None, peek=False)

Implementation from the standard library augmented with ‘peek’ to optionally return the head element without removing it.

class lava.magma.compiler.channels.pypychannel.CspSelector

Bases: object

Utility class to allow waiting for multiple channels to become ready

select(*channel_actions)

Wait for any channel to become ready, then execute the corresponding callable and return the result.

Return type:

None

class lava.magma.compiler.channels.pypychannel.CspSendPort(name, shm, proto, size, req, ack, io_watchdog, join_watchdog)

Bases: AbstractCspSendPort

CspSendPort is a low level send port implementation based on CSP semantics. It can be understood as the input port of a CSP channel.

property d_type: dtype
join()
property name: str
probe()

Returns True if a ‘send’ call will not block, and False otherwise. Does not block.

send(data)

Send data on the channel. May block if the channel is already full.

property shape: Tuple[int, ...]
property size: int
start()

Starts the port to listen on a thread

class lava.magma.compiler.channels.pypychannel.Proto(shape, dtype, nbytes)

Bases: object

dtype: dtype
nbytes: int
shape: ndarray
class lava.magma.compiler.channels.pypychannel.PyPyChannel(message_infrastructure, src_name, dst_name, shape, dtype, size, src_send_watchdog=<lava.magma.compiler.channels.watchdog.NoOPWatchdog object>, src_join_watchdog=<lava.magma.compiler.channels.watchdog.NoOPWatchdog object>, dst_recv_watchdog=<lava.magma.compiler.channels.watchdog.NoOPWatchdog object>, dst_join_watchdog=<lava.magma.compiler.channels.watchdog.NoOPWatchdog object>)

Bases: Channel

Helper class to create the set of send and recv port and encapsulate them inside a common structure. We call this a PyPyChannel

property dst_port: AbstractCspRecvPort
nbytes(shape, dtype)
property src_port: AbstractCspSendPort