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.

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

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

class
pacman.model.graphs.application.
ApplicationFPGAVertex
(n_atoms, incoming_fpga_connections=None, outgoing_fpga_connection=None, label=None, n_machine_vertices_per_link=1)¶ Bases:
pacman.model.graphs.application.ApplicationVirtualVertex
A virtual application vertex connected to one or more FPGA links.
Parameters:  n_atoms (int) – The number of atoms in the vertex
 incoming_fpga_connections (list(FPGAConnection) or None) – The connections from one or more FPGAs that that packets are expected to be received from for this device, or None if no incoming traffic is expected from the device
 outgoing_fpga_connection (FPGAConnection or None) – The connection to an FPGA that packets to be sent to this device should be sent down, or None if no outgoing traffic is expected to be sent to the device.
 label (str) – The optional name of the vertex.
 n_machine_vertices_per_link (int) – The optional number of machine vertices to create for each FPGA link (1 by default)

get_incoming_slice_for_link
(link, index)[source]¶ Get the slice to be given to the connection from the given link.
Parameters:  link (FPGAConnection) – The FPGA connection to get the slice for
 index (int) – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1
Return type:

get_outgoing_link_data
(machine)[source]¶ Get the link data for outgoing connections from the machine.
Parameters: machine (Machine) – The machine to get the link data from Return type: AbstractLinkData

get_outgoing_slice
()[source]¶ Get the slice to be given to the outgoing connection.
Return type: Slice

incoming_fpga_connections
¶ The connections from one or more FPGAs that packets are expected to be received from for this device.
Return type: iterable(FPGAConnection)

n_machine_vertices_per_link
¶ The number of machine vertices to create for each link of the FPGA.
Return type: int

outgoing_fpga_connection
¶ The connection to one FPGA via one link to which packets are sent to this device.
Return type: FPGAConnection or None

class
pacman.model.graphs.application.
ApplicationGraph
¶ Bases:
object
An applicationlevel 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
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
Returns: The partition the edge was added to.
Return type: 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_vertex
(vertex)[source]¶ Add a vertex to the graph.
Parameters: vertex (ApplicationVertex) – The vertex to add
Raises:  PacmanInvalidParameterException – If the vertex is not of a valid type
 PacmanConfigurationException – If there is an attempt to add the same vertex more than once

edges
¶ The edges in the graph.
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:

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)

outgoing_edge_partitions
¶ The edge partitions in the graph.
Return type: iterable(AbstractEdgePartition)

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, n_machine_vertices=1, incoming=True, outgoing=True)¶ Bases:
pacman.model.graphs.application.ApplicationVirtualVertex
A virtual application vertex on a SpiNNaker Link.
Parameters:  n_atoms (int) – The number of atoms in the vertex
 spinnaker_link_id (int) – The index of the spinnaker link to which the device is connected
 board_address (str) – The optional IP address of the board to which the device is connected e.g. in a multiboard system
 label (str) – The optional name of the vertex.

board_address
¶ The board to which this device is connected, or None for the default board.
Return type: str or None

get_incoming_slice
(index)[source]¶ Get the slice to be given to the connection.
Parameters: index (int) – The index of the connection, for when n_machine_vertices > 1 Return type: Slice

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

get_outgoing_link_data
(machine)[source]¶ Get the link data for outgoing connections from the machine.
Parameters: machine (Machine) – The machine to get the link data from Return type: AbstractLinkData

get_outgoing_slice
()[source]¶ Get the slice to be given to the outgoing connection.
Return type: Slice

incoming
¶

outgoing
¶

class
pacman.model.graphs.application.
ApplicationVertex
(label=None, max_atoms_per_core=None, 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.
 max_atoms_per_core (None or int or tuple(int,..)) – The max number of atoms that can be placed on a core for each dimension, used in partitioning. If the vertex is ndimensional, with n > 1, the value must be a tuple with a value for each dimension. If it is singledimensional the value can be a 1tuple or an int.
 splitter (None or AbstractSplitterCommon) – The splitter object needed for this vertex. Leave as None to delegate the choice of splitter to the selector.

add_incoming_edge
(edge, partition)[source]¶ Add an edge incoming to this vertex. This is ignored by default, but could be used to track incoming edges, and/or report faults.
Parameters:  edge (ApplicationEdge) – The edge to add.
 partition (ApplicationEdgePartition) – The partition to add the edge to.

atoms_shape
¶ The “shape” of the atoms in the vertex i.e. how the atoms are split between the dimensions of the vertex. By default everything is 1dimensional, so the value will be a 1tuple but can be overridden by a vertex that supports multiple dimensions.
Return type: tuple(int, ..)

get_fixed_key_and_mask
(partition_id)[source]¶ Get a fixed key and mask for the application vertex or None if not fixed (the default). See
get_machine_gixed_key_and_mask()
for the conditions.Parameters: partition_id (str) – The identifier of the partition to get the key for Return type: BaseKeyAndMask or None

get_machine_fixed_key_and_mask
(machine_vertex, partition_id)[source]¶ Get a fixed key and mask for the given machine vertex and partition identifier, or None if not fixed (the default).
If this doesn’t return None,
get_fixed_key_and_mask()
must also not return None, and the keys returned here must align with those such that for eachkey:mask
returned here,key & app_mask == app_key
. It is OK for this to return None andget_fixed_key_and_mask()
to return nonNone if and only if there is only one machine vertex.Parameters:  machine_vertex (MachineVertex) – A source machine vertex of this application vertex
 partition_id (str) – The identifier of the partition to get the key for
Return type:

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

get_max_atoms_per_dimension_per_core
()[source]¶ Gets the maximum number of atoms per dimension per core. This will return a tuple with a number for each dimension of the vertex, which might be one if this is a singledimension vertex.
Return type: tuple(int,..)

machine_vertices
¶ The machine vertices that this application vertex maps to.
Return type: iterable(MachineVertex)

remember_machine_vertex
(machine_vertex)[source]¶ Adds the machine vertex to 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 superclasses to make sure n_atoms is an integer.
Parameters: n_atoms (int or float or numpy.) – Value convertible to int to be used for n_atoms Returns: Number of atoms. Return type: int Raises: PacmanInvalidParameterException – If the value cannot be safely converted to an integer

set_max_atoms_per_dimension_per_core
(new_value)[source]¶ Set the maximum number of atoms per dimension per core.
Can be used to raise or lower the maximum number of atoms per core or per dimension per core.
Parameters: new_value (None or int or tuple(int,..)) – Value to set. If the vertex is ndimensional where n > 1, a tuple of n values must be given. If the vertex is 1 dimensional, a 1tuple or integer can be given. If this is set to None the vertex will have atoms_shape as the maximum.

splitter
¶ Return type: AbstractSplitterCommon

class
pacman.model.graphs.application.
FPGAConnection
¶ Bases:
tuple
A connection from or to an FPGA.
Create new instance of FPGAConnection(fpga_id, fpga_link_id, board_address, chip_coords)

board_address
¶ Alias for field number 2

chip_coords
¶ Alias for field number 3

expanded
¶ Get a list of concrete FPGA connections, where fpga_id and fpga_link_id are not None.
Return type: iterable(FPGAConnection)

fpga_id
¶ Alias for field number 0

fpga_link_id
¶ Alias for field number 1


class
pacman.model.graphs.application.
Application2DFPGAVertex
(width, height, sub_width, sub_height, incoming_fpga_connections=None, outgoing_fpga_connection=None, label=None)¶ Bases:
pacman.model.graphs.application.ApplicationFPGAVertex
,pacman.model.graphs.application.abstract.abstract_2d_device_vertex.Abstract2DDeviceVertex
A device connected to an FPGA with input or output in two dimensions.
Parameters:  width (int) – The width of the vertex in atoms
 height (int) – The height of the vertex in atoms
 sub_width (int) – The width of the subrectangle to break the vertex up into
 sub_height (int) – The height of the subrectangle to break the vertex up into
 incoming_fpga_connections (list(FPGAConnection) or None) – The connections from one or more FPGAs that that packets are expected to be received from for this device, or None if no incoming traffic is expected from the device
 outgoing_fpga_connection (FPGAConnection or None) – The connection to an FPGA that packets to be sent to this device should be sent down, or None if no outgoing traffic is expected to be sent to the device.
 label (str) – The optional name of the vertex.

atoms_shape
¶ The “shape” of the atoms in the vertex i.e. how the atoms are split between the dimensions of the vertex. By default everything is 1dimensional, so the value will be a 1tuple but can be overridden by a vertex that supports multiple dimensions.
Return type: tuple(int, ..)

get_incoming_slice_for_link
(link, index)[source]¶ Get the slice to be given to the connection from the given link.
Parameters:  link (FPGAConnection) – The FPGA connection to get the slice for
 index (int) – The index of the connection on the FGPA link, for when n_machine_vertices_per_link > 1
Return type:

class
pacman.model.graphs.application.
Application2DSpiNNakerLinkVertex
(width, height, sub_width, sub_height, spinnaker_link_id, board_address=None, label=None, incoming=True, outgoing=False)¶ Bases:
pacman.model.graphs.application.ApplicationSpiNNakerLinkVertex
,pacman.model.graphs.application.abstract.abstract_2d_device_vertex.Abstract2DDeviceVertex
Parameters:  width (int) – The width of the vertex in atoms
 height (int) – The height of the vertex in atoms
 sub_width (int) – The width of the subrectangle to break the vertex up into
 sub_height (int) – The height of the subrectangle to break the vertex up into
 spinnaker_link_id (int) – The index of the spinnaker link to which the device is connected
 board_address (str) – The optional IP address of the board to which the device is connected e.g. in a multiboard system
 label (str) – The optional name of the vertex.
 incoming (bool) – Whether the device supports sending traffic into spinnaker
 outgoing (bool) – Whether the device supports receiving traffic from spinnaker

class
pacman.model.graphs.application.
ApplicationVirtualVertex
(label=None, max_atoms_per_core=None, splitter=None)¶ Bases:
pacman.model.graphs.application.ApplicationVertex
An application vertex which is virtual.
Parameters:  label (str) – The optional name of the vertex.
 max_atoms_per_core (None or int or tuple(int,..)) – The max number of atoms that can be placed on a core for each dimension, used in partitioning. If the vertex is ndimensional, with n > 1, the value must be a tuple with a value for each dimension. If it is singledimensional the value can be a 1tuple or an int.
 splitter (None or AbstractSplitterCommon) – The splitter object needed for this vertex. Leave as None to delegate the choice of splitter to the selector.

get_outgoing_link_data
(machine)[source]¶ Get the link data for outgoing connections from the machine.
Parameters: machine (Machine) – The machine to get the link data from Return type: AbstractLinkData