pacman.model.graphs.application package

Module contents

class pacman.model.graphs.application.ApplicationEdge(pre_vertex, post_vertex, label=None)

Bases: pacman.model.graphs.AbstractEdge

A simple implementation of an application edge.

Parameters:
  • pre_vertex (ApplicationVertex) – The application vertex at the start of the edge.
  • post_vertex (ApplicationVertex) – The application vertex at the end of the edge.
  • label (str or None) – The name of the edge.
  • machine_edge_type (type(MachineEdge)) – The type of machine edges made from this app edge. If None, standard machine edges will be made.
label

The label of the edge

Return type:str
post_vertex

The vertex at the end of the edge

Return type:AbstractVertex
pre_vertex

The vertex at the start of the edge

Return type:AbstractVertex
class pacman.model.graphs.application.ApplicationEdgePartition(identifier, pre_vertex)

Bases: pacman.model.graphs.AbstractSingleSourcePartition

A simple implementation of an application edge partition that will communicate using SpiNNaker multicast packets. They have the same source(s) and semantics and so can share a single key.

Parameters:
  • identifier (str) – The identifier of the partition
  • pre_vertex (ApplicationVertex) – The source of this partition
class pacman.model.graphs.application.ApplicationFPGAVertex(n_atoms, fpga_id, fpga_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)

Bases: pacman.model.graphs.application.ApplicationVertex, pacman.model.graphs.AbstractFPGA, pacman.model.partitioner_interfaces.legacy_partitioner_api.LegacyPartitionerAPI

A virtual vertex on an FPGA link.

board_address

The IP address of the board to which the device is connected, or None for the boot board.

Return type:str
create_machine_vertex(vertex_slice, sdram, label=None, constraints=None)[source]

Create a machine vertex from this application vertex.

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover.
  • sdram (resourcesAbstractSDRAM) – The sdram used by the machine vertex.
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex.
Returns:

The created machine vertex

Return type:

MachineVertex

fpga_id

The ID of the FPGA to which the vertex is connected.

Return type:int

The link of the FPGA to which the vertex is connected.

Return type:int
get_sdram_used_by_atoms(vertex_slice)[source]

Get the separate sdram requirements for a range of atoms.

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Return type:AbstractSDRAM
n_atoms

The number of atoms in the vertex

Returns:The number of atoms
Return type:int
class pacman.model.graphs.application.ApplicationGraph

Bases: object

An application-level abstraction of a graph.

add_edge(edge, outgoing_edge_partition_name)[source]

Add an edge to the graph and its partition

If required and possible will create a new partition in the graph

Returns the partition the edge was added to

Parameters:
  • edge (ApplicationEdge) – The edge to add
  • outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Return type:

AbstractEdgePartition

Raises:

PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one

add_outgoing_edge_partition(edge_partition)[source]

Add an edge partition to the graph.

Will also add any edges already in the partition as well

Parameters:edge_partition (ApplicationEdgePartition) – The edge partition to add
Raises:PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
add_vertex(vertex)[source]

Add a vertex to the graph.

Parameters:

vertex (ApplicationVertex) – The vertex to add

Raises:
edges

The edges in the graph

Return type:iterable(AbstractEdge)
get_edges_starting_at_vertex(vertex)[source]

Get all the edges that start at the given vertex.

Parameters:vertex (AbstractVertex) – The vertex at which the edges to get start
Return type:iterable(AbstractEdge)
get_outgoing_edge_partition_starting_at_vertex(vertex, outgoing_edge_partition_name)[source]

Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists.

Parameters:
  • vertex (AbstractVertex) – The vertex at the start of the edges in the partition
  • outgoing_edge_partition_name (str) – The name of the edge partition
Returns:

the named edge partition, or None if no such partition exists

Return type:

AbstractEdgePartition or None

get_outgoing_edge_partitions_starting_at_vertex(vertex)[source]

Get all the edge partitions that start at the given vertex.

Parameters:vertex (AbstractVertex) – The vertex at which the edge partitions to find starts
Return type:iterable(AbstractEdgePartition)
n_outgoing_edge_partitions

The number of outgoing edge partitions in the graph.

Return type:int
n_vertices

The number of vertices in the graph.

Return type:int
outgoing_edge_partitions

The edge partitions in the graph.

Return type:iterable(AbstractEdgePartition)
reset()[source]

Reset all the application vertices

vertex_by_label(label)[source]
vertices

The vertices in the graph.

Return type:iterable(AbstractVertex)
class pacman.model.graphs.application.ApplicationSpiNNakerLinkVertex(n_atoms, spinnaker_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)

Bases: pacman.model.graphs.application.ApplicationVertex, pacman.model.graphs.AbstractSpiNNakerLink, pacman.model.partitioner_interfaces.legacy_partitioner_api.LegacyPartitionerAPI

A virtual vertex on a SpiNNaker Link.

board_address

The IP address of the board to which the device is connected, or None for the boot board.

Return type:str
create_machine_vertex(vertex_slice, sdram, label=None, constraints=None)[source]

Create a machine vertex from this application vertex.

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover.
  • sdram (resourcesAbstractSDRAM) – The sdram used by the machine vertex.
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex.
Returns:

The created machine vertex

Return type:

MachineVertex

get_sdram_used_by_atoms(vertex_slice)[source]

Get the separate sdram requirements for a range of atoms.

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Return type:AbstractSDRAM
n_atoms

The number of atoms in the vertex

Returns:The number of atoms
Return type:int

The SpiNNaker Link that the vertex is connected to.

Return type:int
class pacman.model.graphs.application.ApplicationVertex(label=None, constraints=None, max_atoms_per_core=9223372036854775807, splitter=None)

Bases: pacman.model.graphs.AbstractVertex

A vertex that can be broken down into a number of smaller vertices based on the resources that the vertex requires.

Parameters:
  • label (str) – The optional name of the vertex.
  • constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex.
  • max_atoms_per_core (int) – The max number of atoms that can be placed on a core, used in partitioning.
  • splitter (None or AbstractSplitterPartitioner) – The splitter object needed for this vertex. Leave as None to delegate the choice of splitter to the selector.
Raises:

PacmanInvalidParameterException – If one of the constraints is not valid

SETTING_SPLITTER_ERROR_MSG = 'The splitter object on {} has already been set, it cannot be reset. Please fix and try again. '
add_constraint(constraint)[source]

Add a new constraint to the collection of constraints

Parameters:constraint (AbstractConstraint) – constraint to add
Raises:PacmanInvalidParameterException – If the constraint is not valid
get_max_atoms_per_core()[source]

Gets the maximum number of atoms per core, which is either the number of atoms required across the whole application vertex, or a lower value set.

Return type:int
machine_vertices

The machine vertices that this application vertex maps to

Return type:iterable(MachineVertex)
n_atoms

The number of atoms in the vertex

Return type:int
remember_machine_vertex(machine_vertex)[source]

Adds the Machine vertex the iterable returned by machine_vertices

Parameters:machine_vertex (MachineVertex) – A pointer to a machine_vertex
reset()[source]

Forget all machine vertices in the application vertex, and reset the splitter (if any)

round_n_atoms(n_atoms, label='n_atoms')[source]

Utility function to allow suoer-classes to make sure n_atom is an int

Parameters:n_atoms (int or float or numpy.) – Value convertible to int to be used for n_atoms
Returns:
set_max_atoms_per_core(new_value)[source]

Set the max_atoms_per_core.

Can be used to raise or lower the maximum number of atoms.

Parameters:new_value (int) – Value to set
splitter
Return type:AbstractSplitterPartitioner