pacman.model.graphs.machine package

Module contents

class pacman.model.graphs.machine.AbstractSDRAMPartition

Bases: object

An edge partition that contains SDRAM edges.

abstract get_sdram_base_address_for(vertex: MachineVertex) int[source]

Get the SDRAM base address for a edge given which side the vertex is on.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM base address of

Returns:

the SDRAM address for this vertex

Return type:

int

abstract get_sdram_size_of_region_for(vertex: MachineVertex) int[source]

Get the size of the region for a vertex given a edge.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM size of

Returns:

the SDRAM size for this vertex

Return type:

int

abstract property sdram_base_address: int

The base address of the SDRAM piece used for communication.

abstract total_sdram_requirements() int[source]

Get the total SDRAM required by this outgoing partition.

Returns:

int

class pacman.model.graphs.machine.ConstantSDRAMMachinePartition(identifier: str, pre_vertex: V)

Bases: AbstractSingleSourcePartition[V, E], Generic[V, E], AbstractSDRAMPartition

An SDRAM partition that uses a fixed amount of memory. The edges in the partition must agree on how much memory is required.

Parameters:
  • identifier (str) – The identifier of the partition

  • allowed_edge_types (type or tuple(type, ...)) – The types of edges allowed

  • label (str) – An optional label of the partition

add_edge(edge: E)[source]

Add an edge to the edge partition.

Parameters:

edge (AbstractEdge) – the edge to add

Raises:

PacmanInvalidParameterException – If the edge does not belong in this edge partition

get_sdram_base_address_for(vertex: MachineVertex) int[source]

Get the SDRAM base address for a edge given which side the vertex is on.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM base address of

Returns:

the SDRAM address for this vertex

Return type:

int

get_sdram_size_of_region_for(vertex: MachineVertex) int[source]

Get the size of the region for a vertex given a edge.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM size of

Returns:

the SDRAM size for this vertex

Return type:

int

property sdram_base_address: int

The base address of the SDRAM piece used for communication.

total_sdram_requirements() int[source]

Get the total SDRAM required by this outgoing partition.

Returns:

int

class pacman.model.graphs.machine.DestinationSegmentedSDRAMMachinePartition(identifier: str, pre_vertex: MachineVertex)

Bases: AbstractSingleSourcePartition[MachineVertex, SDRAMMachineEdge], AbstractSDRAMPartition

An SDRAM partition that gives each edge its own slice of memory from a contiguous block. The edges all have the same source vertex.

Parameters:
  • identifier (str) – The identifier of the partition

  • allowed_edge_types (type or tuple(type, ...)) – The types of edges allowed

  • label (str) – An optional label of the partition

add_edge(edge: SDRAMMachineEdge)[source]

Add an edge to the edge partition.

Parameters:

edge (AbstractEdge) – the edge to add

Raises:

PacmanInvalidParameterException – If the edge does not belong in this edge partition

get_sdram_base_address_for(vertex: MachineVertex) int[source]

Get the SDRAM base address for a edge given which side the vertex is on.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM base address of

Returns:

the SDRAM address for this vertex

Return type:

int

get_sdram_size_of_region_for(vertex: MachineVertex) int[source]

Get the size of the region for a vertex given a edge.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM size of

Returns:

the SDRAM size for this vertex

Return type:

int

property sdram_base_address: int

The base address of the SDRAM piece used for communication.

total_sdram_requirements() int[source]

Get the total SDRAM required by this outgoing partition.

Returns:

int

class pacman.model.graphs.machine.MachineEdge(pre_vertex: MachineVertex, post_vertex: MachineVertex, label: str | None = None)

Bases: AbstractEdge[object]

A simple implementation of a machine edge.

Parameters:
  • pre_vertex (MachineVertex) – The vertex at the start of the edge.

  • post_vertex (MachineVertex) – The vertex at the end of the edge.

  • label (str or None) – The name of the edge.

property label: str | None

The label of the edge.

Return type:

str

property post_vertex: MachineVertex

The vertex at the end of the edge.

Return type:

MachineVertex

property pre_vertex: MachineVertex

The vertex at the start of the edge.

Return type:

MachineVertex

class pacman.model.graphs.machine.MachineFPGAVertex(fpga_id: int, fpga_link_id: int, board_address: str | None = None, linked_chip_coordinates: XY | None = None, label: str | None = None, app_vertex: ApplicationVertex | None = None, vertex_slice: Slice | None = None, outgoing_keys_and_masks: List[BaseKeyAndMask] | None = None, incoming: bool = True, outgoing: bool = False)

Bases: MachineVertex, AbstractVirtual

A virtual vertex on an FPGA link.

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
property board_address: str | None

The IP address of the board to which the device is connected, or None for the boot board, or when using linked chip coordinates.

Return type:

str or None

property fpga_id: int

The Field Programmable Gate Arrays id provided top the init.

Return type:

int

The Field Programmable Gate Arrays link id provided to the init.

Return type:

int

Get link data from the machine.

Parameters:

machine (Machine) – The machine to get the data from

Return type:

AbstractLinkData

property incoming: bool

Whether this device sends traffic into SpiNNaker.

Return type:

bool

property linked_chip_coordinates: XY | None

The coordinates of the chip to which the device is connected, or None for the boot board, or when using a board address.

Return type:

tuple(int, int) or None

property outgoing: bool

Whether this device receives traffic from SpiNNaker.

Return type:

bool

outgoing_keys_and_masks() List[BaseKeyAndMask] | None[source]

Get the keys sent by the device or None if there aren’t any explicitly defined.

Return type:

list(BaseKeyAndMask) or None

property sdram_required: ConstantSDRAM

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

class pacman.model.graphs.machine.MachineSpiNNakerLinkVertex(spinnaker_link_id: int, board_address: str | None = None, linked_chip_coordinates: XY | None = None, label: str | None = None, app_vertex: ApplicationVertex | None = None, vertex_slice: Slice | None = None, outgoing_keys_and_masks: List[BaseKeyAndMask] | None = None, incoming: bool = True, outgoing: bool = False)

Bases: MachineVertex, AbstractVirtual

A virtual vertex on a SpiNNaker Link.

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
property board_address: str | None

The IP address of the board to which the device is connected, or None for the boot board, or when using linked chip coordinates.

Return type:

str or None

Get link data from the machine.

Parameters:

machine (Machine) – The machine to get the data from

Return type:

AbstractLinkData

property incoming: bool

Whether this device sends traffic into SpiNNaker.

Return type:

bool

property linked_chip_coordinates: XY | None

The coordinates of the chip to which the device is connected, or None for the boot board, or when using a board address.

Return type:

tuple(int, int) or None

property outgoing: bool

Whether this device receives traffic from SpiNNaker.

Return type:

bool

outgoing_keys_and_masks() List[BaseKeyAndMask] | None[source]

Get the keys sent by the device or None if there aren’t any explicitly defined.

Return type:

list(BaseKeyAndMask) or None

property sdram_required: ConstantSDRAM

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

The id of the spinnaker link as passed into the init.

Return type:

int

class pacman.model.graphs.machine.MachineVertex(label: str | None = None, app_vertex: ApplicationVertex | None = None, vertex_slice: Slice | None = None)

Bases: AbstractVertex

A machine graph vertex.

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
property app_vertex: ApplicationVertex | None

The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

Return type:

ApplicationVertex or None

get_fixed_location() ChipAndCore | None[source]

The x, y and possibly p the vertex must be placed on.

Typically None! Does not have the value of a normal placements.

Used instead of ChipAndCoreConstraint.

Return type:

None or ChipAndCore

Note

If the Machine vertex has no fixed_location but does have an app_vertex, app_vertex.fixed_location is used. If both have a fixed_location the app level is ignored!

get_n_keys_for_partition(partition_id: str) int[source]

Get the number of keys required by the given partition of edges.

Parameters:

partition_id (str) – The identifier of the partition; the partition_id param is only used by some MachineVertex subclasses

Returns:

The number of keys required

Return type:

int

property index: int

The index into the collection of machine vertices for an application vertex.

Return type:

int

property iptags: Iterable[IPtagResource]

The IPTags used by this vertex, if any.

Return type:

iterable(IPtagResource)

property reverse_iptags: Iterable[ReverseIPtagResource]

The ReverseIPTags used by this vertex, if any.

Return type:

iterable(ReverseIPtagResource)

abstract property sdram_required: AbstractSDRAM

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

property vertex_slice: Slice

The slice of the application vertex that this machine vertex implements.

Return type:

Slice

class pacman.model.graphs.machine.MulticastEdgePartition(pre_vertex: MachineVertex, identifier: str)

Bases: AbstractSingleSourcePartition[MachineVertex, MachineEdge]

A simple implementation of a machine edge partition that will communicate with SpiNNaker multicast packets. They have a common set of sources with the same semantics and so can share a single key.

Parameters:
  • pre_vertex (MachineVertex) – the pre vertex of this partition.

  • identifier (str) – The identifier of the partition

class pacman.model.graphs.machine.SDRAMMachineEdge(pre_vertex: MachineVertex, post_vertex: MachineVertex, label: str)

Bases: MachineEdge

An edge that transfers information via a shared SDRAM area. This implies that it must be between two machine vertices placed on the same chip.

Parameters:
  • pre_vertex (MachineVertex) – The vertex at the start of the edge.

  • post_vertex (MachineVertex) – The vertex at the end of the edge.

  • label (str or None) – The name of the edge.

property sdram_base_address: int | None

The start address of the sdram if set

Return type:

int or None

property sdram_size: int

The sdram size reported by the pre_vertex

Return type:

int

class pacman.model.graphs.machine.SimpleMachineVertex(sdram, label=None, app_vertex=None, vertex_slice=None, iptags: Iterable[IPtagResource] | None = None, reverse_iptags: Iterable[ReverseIPtagResource] | None = None)

Bases: MachineVertex

A MachineVertex that stores its own resources.

This class is mainly intended for JSON and testing as it support the minimal API. If a more complex Vertex is required consider the MockMachineVertex.

Parameters:
  • label (str or None) – The optional name of the vertex

  • app_vertex (ApplicationVertex or None) – The application vertex that caused this machine vertex to be created. If None, there is no such application vertex.

  • vertex_slice (Slice or None) – The slice of the application vertex that this machine vertex implements.

Raises:
property iptags: Iterable[IPtagResource]

The IPTags used by this vertex, if any.

Return type:

iterable(IPtagResource)

property reverse_iptags: Iterable[ReverseIPtagResource]

The ReverseIPTags used by this vertex, if any.

Return type:

iterable(ReverseIPtagResource)

property sdram_required: AbstractSDRAM

The SDRAM space required by the vertex.

Return type:

AbstractSDRAM

class pacman.model.graphs.machine.SourceSegmentedSDRAMMachinePartition(identifier: str, pre_vertices: Collection[MachineVertex])

Bases: AbstractMultiplePartition[MachineVertex, SDRAMMachineEdge], AbstractSDRAMPartition

An SDRAM partition that gives each edge its own slice of memory from a contiguous block. The edges all have the same destination vertex.

Parameters:
  • identifier (str) – The identifier of the partition

  • pre_vertices (iterable(AbstractVertex)) – The vertices that an edge in this partition may originate at

add_edge(edge: SDRAMMachineEdge)[source]

Add an edge to the edge partition.

Parameters:

edge (AbstractEdge) – the edge to add

Raises:

PacmanInvalidParameterException – If the edge does not belong in this edge partition

get_sdram_base_address_for(vertex: MachineVertex) int[source]

Get the SDRAM base address for a edge given which side the vertex is on.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM base address of

Returns:

the SDRAM address for this vertex

Return type:

int

get_sdram_size_of_region_for(vertex: MachineVertex) int[source]

Get the size of the region for a vertex given a edge.

Parameters:

vertex (MachineVertex) – the vertex to find SDRAM size of

Returns:

the SDRAM size for this vertex

Return type:

int

is_sdram_base_address_defined(vertex: MachineVertex) bool[source]

Do we have a base address for the given vertex? If the edge does not connect to the vertex, this is an error.

property sdram_base_address: int
Return type:

int

total_sdram_requirements() int[source]
Return type:

int