pacman.model.graphs.application package¶
Module contents¶

class
pacman.model.graphs.application.
ApplicationEdge
(pre_vertex, post_vertex, label=None, machine_edge_type=<class 'pacman.model.graphs.machine.machine_edge.MachineEdge'>)[source]¶ Bases:
pacman.model.graphs.abstract_edge.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.

forget_machine_edges
()[source]¶ Clear the collection of machine edges created by this application edge.

machine_edges
¶ The machine
Return type: iterable(MachineEdge)

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

remember_associated_machine_edge
(machine_edge)[source]¶ Adds the Machine Edge to the iterable returned by machine_edges
Parameters: machine_edge (MachineEdge) – A pointer to a machine_edge. This edge may not be fully initialised

class
pacman.model.graphs.application.
ApplicationEdgePartition
(identifier, pre_vertex, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.abstract_single_source_partition.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
 constraints (list(AbstractConstraint)) – Any initial constraints
 label (str) – An optional label of the partition
 traffic_weight (int) – The weight of traffic going down this partition
 traffic_type – the traffic type acceptable here.

clone_without_edges
()[source]¶ Make a copy of this edge partition without any of the edges in it
This follows the design pattern that only the graph adds edges to partitions already added to the graph
Returns: The copied edge partition but excluding edges Return type: ApplicationEdgePartition

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)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_fpga.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, resources_required, 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.
 resources_required (ResourceContainer) – The resources 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:

get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms.
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a resource container that contains a CPUCyclesPerTickResource
,DTCMResource
andSDRAMResource
Return type: ResourceContainer

set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex.
Parameters:


class
pacman.model.graphs.application.
ApplicationGraph
(label)[source]¶ Bases:
pacman.model.graphs.graph.Graph
An applicationlevel abstraction of a graph.
Parameters: label (str or None) – The label on the graph, or None 
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 (AbstractEdgePartition) – The edge partition to add Raises: PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier

clone
()[source]¶ Makes as shallow as possible copy of the graph.
Vertices and edges are copied over. Partition will be new objects.
Returns: A shallow copy of this graph Return type: ApplicationGraph

forget_machine_edges
()[source]¶ Ensure that all application edges in this graph forget what machine edges they map to. The mapping of vertices is unaffected.

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)

new_edge_partition
(name, edge)[source]¶ How we create a new
AbstractSingleSourcePartition
in the first place. Uses the first/only element in the allowed partition types argument to the graph’s constructor.Called from
add_edge()
. Can be overridden if different arguments should be passed.Parameters:  name (str) – The identifier of the partition
 edge (AbstractEdge) – An edge for the partition
Returns: the new edge partition
Return type:

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


class
pacman.model.graphs.application.
ApplicationGraphView
(other)[source]¶ Bases:
pacman.model.graphs.application.application_graph.ApplicationGraph
A frozen view of an Application Graph
As this shares all the same objects as the graph it is a view over except for the class and id. So any changes to the other are reflected.
All methods that allow changes to the graph should be disabled.

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 (AbstractEdge) – 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: 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 (AbstractEdgePartition) – 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 (AbstractVertex) – 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


class
pacman.model.graphs.application.
ApplicationSpiNNakerLinkVertex
(n_atoms, spinnaker_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_spinnaker_link.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, resources_required, 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.
 resources_required (ResourceContainer) – The resources 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:

get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms.
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a resource container that contains a CPUCyclesPerTickResource
,DTCMResource
andSDRAMResource
Return type: ResourceContainer

set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex.
Parameters:


class
pacman.model.graphs.application.
ApplicationVertex
(label=None, constraints=None, max_atoms_per_core=9223372036854775807, splitter=None)[source]¶ Bases:
pacman.model.graphs.abstract_vertex.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

forget_machine_vertices
()[source]¶ Arrange to forget all machine vertices that this application vertex maps to.

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 if a constraint lowers it.
Return type: int

machine_vertices
¶ The machine vertices that this application vertex maps to. Will be the same length as
vertex_slices()
.Return type: iterable(MachineVertex)

remember_machine_vertex
(machine_vertex)[source]¶ Adds the Machine vertex the iterable returned by machine_vertices
This method will be called by MachineVertex.app_vertex No other place should call it.
Parameters: machine_vertex (MachineVertex) – A pointer to a machine_vertex. This vertex may not be fully initialized but will have a slice Raises: PacmanValueError – If the slice of the machine_vertex is too big

round_n_atoms
(n_atoms, label='n_atoms')[source]¶ Utility function to allow suoerclasses 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:

splitter
¶ Return type: AbstractSplitterPartitioner

vertex_slices
¶ The slices of this vertex that each machine vertex manages. Will be the same length as
machine_vertices()
.Return type: iterable(Slice)