pacman.model.graphs package

Subpackages

Module contents

class pacman.model.graphs.AbstractEdge[source]

Bases: object

A directed edge in a graph between two vertices.

abstract property label

The label of the edge.

Return type:

str

abstract property post_vertex

The vertex at the end of the edge.

Return type:

AbstractVertex

abstract property pre_vertex

The vertex at the start of the edge.

Return type:

AbstractVertex

class pacman.model.graphs.AbstractEdgePartition(identifier, allowed_edge_types)[source]

Bases: object

A collection of edges which start at a single vertex which have the same semantics and so can share a single key or block of SDRAM (depending on edge type).

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)[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

property edges

The edges in this edge partition.

Note

The order in which the edges are added is preserved for when they are requested later. If not, please talk to the software team.

Return type:

iterable(AbstractEdge)

property identifier

The identifier of this edge partition.

Return type:

str

property n_edges

The number of edges in the edge partition.

Return type:

int

abstract property pre_vertices

The vertices associated with this partition.

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:

iterable(AbstractVertex)

class pacman.model.graphs.AbstractMultiplePartition(pre_vertices, identifier, allowed_edge_types)[source]

Bases: AbstractEdgePartition

An edge partition that has multiple source vertices.

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)[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

property pre_vertices

The vertices associated with this partition.

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:

iterable(AbstractVertex)

class pacman.model.graphs.AbstractSingleSourcePartition(pre_vertex, identifier, allowed_edge_types)[source]

Bases: AbstractEdgePartition

An edge partition that has a single 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)[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

property pre_vertex

The vertex at which all edges in this outgoing edge partition start.

Return type:

AbstractVertex

property pre_vertices

The vertices associated with this partition.

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:

iterable(AbstractVertex)

class pacman.model.graphs.AbstractSupportsSDRAMEdges[source]

Bases: object

Marks a machine vertex that can have SDRAM edges attached to it.

abstract sdram_requirement(sdram_machine_edge)[source]

Asks a machine vertex for the SDRAM requirement it needs.

Parameters:

sdram_machine_edge (SDRAMMachineEdge) – The SDRAM edge in question

Returns:

The size in bytes this vertex needs for the SDRAM edge.

Return type:

int (most likely a multiple of 4)

class pacman.model.graphs.AbstractVertex(label=None)[source]

Bases: object

A vertex in a graph.

Parameters:

label (str) – The optional name of the vertex

addedToGraph()[source]

Records that the vertex has been added to a graph.

Raises:

PacmanConfigurationException – If there is an attempt to add the same vertex more than once

get_fixed_location()[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

property label

The current label to the vertex.

This label could change when the vertex is added to the graph.

Return type:

str

set_fixed_location(x, y, p=None)[source]

Set the location where the vertex must be placed.

Note

If called, must be called prior to the placement algorithms.

Parameters:
  • x (int) – X coordinate of fixed location

  • y (int) – Y coordinate of fixed location

  • p (int) – Processor ID of fixed location

Raises:

PacmanConfigurationException – If a fixed location has already been set to a different location.

set_label(label)[source]

Changes the label for a vertex not yet added to a graph.

Parameters:

label (str) – new value for the label

Raises:

PacmanConfigurationException – If there is an attempt to change the label once the vertex has been added to a graph

class pacman.model.graphs.AbstractVirtual[source]

Bases: object

A vertex which exists outside of the machine, allowing a graph to formally participate in I/O.

Note

Everything that is an instance of AbstractVirtual is also an instance of AbstractVertex.

abstract property board_address

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

abstract property incoming

Whether this device sends traffic into SpiNNaker.

Return type:

bool

abstract property linked_chip_coordinates

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

abstract property outgoing

Whether this device receives traffic from SpiNNaker.

Return type:

bool

abstract outgoing_keys_and_masks()[source]

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

Return type:

list(BaseKeyAndMask) or None