pacman.utilities.algorithm_utilities package¶
Submodules¶
pacman.utilities.algorithm_utilities.partition_algorithm_utilities module¶
A collection of methods which support partitioning algorithms.
- pacman.utilities.algorithm_utilities.partition_algorithm_utilities.get_multidimensional_slices(app_vertex: ApplicationVertex) List[Slice] [source]¶
Get the multi-dimensional slices of an application vertex such that each is sized to the maximum atoms per dimension per core except the last, which might be smaller in one or more dimensions.
- Parameters:
app_vertex (ApplicationVertex) – The vertex to get the slices of
- Returns:
The slices
- Return type:
- pacman.utilities.algorithm_utilities.partition_algorithm_utilities.get_single_dimension_slices(app_vertex: ApplicationVertex) List[Slice] [source]¶
- Get the single dimension slices of an application vertex
such that each is sized to the maximum atoms per dimension per core except the last which might be smaller in one or more dimensions
- Parameters:
app_vertex (ApplicationVertex) – The vertex to get the slices of
pacman.utilities.algorithm_utilities.routes_format module¶
- pacman.utilities.algorithm_utilities.routes_format.format_route(entry: MulticastRoutingEntry) str [source]¶
How to render a single routing entry.
- Parameters:
entry (MulticastRoutingEntry)
- Return type:
pacman.utilities.algorithm_utilities.routing_algorithm_utilities module¶
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.get_app_partitions() List[ApplicationEdgePartition] [source]¶
Find all application partitions.
Note
Where a vertex splitter indicates that it has internal partitions but is not the source of an external partition, a “fake” empty application partition is added. This allows the calling algorithm to loop over the returned list and look at the set of edges and internal partitions to get a complete picture of all targets for each source machine vertex at once.
- Returns:
list of partitions
Note
Where there are only internal multicast partitions, the partition will have no edges. Caller should use vertex.splitter.get_internal_multicast_partitions for details.
- Return type:
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.longest_dimension_first(vector: Tuple[int, int, int], start: Tuple[int, int]) List[Tuple[int, Tuple[int, int]]] [source]¶
List the (x, y) steps on a longest-dimension first route.
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.vector_to_nodes(dm_vector: List[Tuple[int, int]], start: Tuple[int, int]) List[Tuple[int, Tuple[int, int]]] [source]¶
Convert a vector to a set of nodes.
- Parameters:
- Returns:
A list of (link_id, (target_x, target_y)) of nodes on a route
- Return type:
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.vertex_chip(vertex: MachineVertex) Chip [source]¶
- Parameters:
vertex (MachineVertex)
- Return type:
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.vertex_xy(vertex: MachineVertex) Tuple[int, int] [source]¶
- Parameters:
vertex (MachineVertex)
- Return type:
- pacman.utilities.algorithm_utilities.routing_algorithm_utilities.vertex_xy_and_route(vertex: MachineVertex) Tuple[Tuple[int, int], Tuple[MachineVertex, int | None, int | None]] [source]¶
Get the non-virtual chip coordinates, the vertex, and processor or link to follow to get to the vertex.
- Parameters:
vertex (MachineVertex)
- Returns:
the (x,y) coordinates of the target vertex mapped to a tuple of the vertex, core and link. One of core or link is provided the other is None
- Return type:
tuple(tuple(int, int), tuple(MachineVertex, int, None)) or tuple(tuple(int, int), tuple(MachineVertex, None, int))
pacman.utilities.algorithm_utilities.routing_tree module¶
An explicit representation of a routing tree in a machine.
This representation of a route explicitly describes a tree-structure and the complete path taken by a route. This is used during place and route in preference to a set of RoutingEntry tuples since it is more easily verified and more accurately represents the problem at hand.
Based on https://github.com/project-rig/rig/blob/master/rig/place_and_route/routing_tree.py
- class pacman.utilities.algorithm_utilities.routing_tree.RoutingTree(chip: Tuple[int, int], label: str | None = None)[source]¶
Bases:
object
Explicitly defines a multicast route through a SpiNNaker machine.
Each instance represents a single hop in a route and recursively refers to following steps.
- append_child(child: Tuple[int, RoutingTree | MachineVertex])[source]¶
- Parameters:
child (tuple(int, RoutingTree or MachineVertex))
- property children: Iterable[Tuple[int, RoutingTree | MachineVertex]]¶
A
iterable
of the next steps in the route represented by a (route, object) tuple.Note
Up until Rig 1.5.1, this structure used
set
s to store children. This was changed tolist
s since sets incur a large memory overhead and in practice the set-like behaviour of the list of children is not useful.The object indicates the intended destination of this step in the route. It may be one of:
RoutingTree
representing the continuation of the routing tree after following a given link.A vertex (i.e. some other Python object) when the route terminates at the supplied vertex.
Note
The direction may be None and so additional logic may be required to determine what core to target to reach the vertex.
- Return type:
iterable(tuple(int, RoutingTree or MachineVertex))
- property label: str | None¶
The label value provided to the init (if applicable).
- Return type:
str or None
- remove_child(child: Tuple[int, RoutingTree | MachineVertex])[source]¶
- Parameters:
child (tuple(int, RoutingTree or MachineVertex))