pacman.model.routing_info package¶
Module contents¶
- class pacman.model.routing_info.AppVertexRoutingInfo(key_and_mask: BaseKeyAndMask, partition_id: str, app_vertex: ApplicationVertex, machine_mask: int, n_bits_atoms: int, max_machine_index: int)¶
Bases:
VertexRoutingInfoRouting information for an application vertex.
- Parameters:
key_and_mask
partition_id
app_vertex
machine_mask
n_bits_atoms
max_machine_index
- merge_machine_entries(entries: List[Tuple[RoutingEntry, MachineVertexRoutingInfo]]) Iterable[MulticastRoutingEntry][source]¶
Merge the machine entries.
- Parameters:
entries – The entries to merge
- Returns:
The routing info in the merged/ multicast format.
- property vertex: ApplicationVertex¶
The vertex of the information.
- class pacman.model.routing_info.BaseKeyAndMask(base_key: int, mask: int)¶
Bases:
objectA Key and Mask to be used for routing.
- Parameters:
base_key – The routing key
mask – The routing mask
- Raises:
PacmanConfigurationException – If key & mask != key i.e. the key is not valid for the given mask
- get_keys(key_array: ndarray | None = None, offset: int = 0, n_keys: int | None = None) Tuple[ndarray, int][source]¶
Get the ordered list of keys that the combination allows.
- Parameters:
key_array – Optional array into which the returned keys will be placed
offset – Optional offset into the array at which to start placing keys
n_keys – Optional limit on the number of keys returned. If less than this number of keys are available, only the keys available will be added
- Returns:
A tuple of an array of keys and the number of keys added to the array
- class pacman.model.routing_info.MachineVertexRoutingInfo(key_and_mask: BaseKeyAndMask, partition_id: str, machine_vertex: MachineVertex, index: int)¶
Bases:
VertexRoutingInfoAssociates a machine vertex and partition identifier to its routing information (keys and masks).
- Parameters:
key_and_mask – The key allocated to the machine partition
partition_id – The partition to set the keys for
machine_vertex – The vertex to set the keys for
index – The index of the machine vertex
- property machine_vertex: MachineVertex¶
The machine vertex.
- property vertex: MachineVertex¶
The vertex of the information.
- class pacman.model.routing_info.RoutingInfo¶
Bases:
objectAn association of machine vertices to a non-overlapping set of keys and masks.
- add_routing_info(info: VertexRoutingInfo) None[source]¶
Add a routing information item.
- Parameters:
info – The routing information item to add
- Raises:
PacmanAlreadyExistsException – If the partition is already in the set of edges
- check_info_from(vertex: AbstractVertex, allowed_partition_ids: Set[str]) None[source]¶
Check that the partition ids for a vertex are in the allowed set.
- Parameters:
vertex – The vertex to search for
allowed_partition_ids – The allowed partition ids
- Raises:
KeyError – If the vertex has an unknown partition ID
- get_first_key_from_pre_vertex(vertex: AbstractVertex, partition_id: str) int | None[source]¶
Get the first key for the partition starting at a vertex.
- Parameters:
vertex – The vertex which the partition starts at
partition_id – The ID of the partition for which to get the routing information
- Returns:
The routing key of the partition
- get_info_from(vertex: AbstractVertex, partition_id: str) VertexRoutingInfo[source]¶
- Parameters:
vertex – The vertex to search for
partition_id – The ID of the partition for which to get the routing information
- Returns:
Routing information for a given partition_id from a vertex.
- Raises:
KeyError – If the vertex/partition_id combination is not in the routing information
- get_key_from(vertex: AbstractVertex, partition_id: str) int[source]¶
Get the first key for the partition starting at a vertex.
- Parameters:
vertex – The vertex which the partition starts at
partition_id – The ID of the partition for which to get the routing information
- Returns:
The routing key of the partition
- Raises:
KeyError – If the vertex/partition_id combination is not in the routing information
- get_partitions_from(vertex: AbstractVertex) Iterable[str][source]¶
Get the outgoing partitions from a vertex.
- Parameters:
vertex – The vertex to search for
- Returns:
The partition ids for routes from this Vertex
- get_routing_info_from_pre_vertex(vertex: AbstractVertex, partition_id: str) VertexRoutingInfo | None[source]¶
- Parameters:
vertex – The vertex to search for
partition_id – The ID of the partition for which to get the routing information
- Returns:
Routing information for a given partition_id from a vertex.
- get_single_info_from(vertex: AbstractVertex) VertexRoutingInfo | None[source]¶
Get routing information for a given vertex. Fails if the vertex has more than one outgoing partition.
- Parameters:
vertex – The vertex to search for
- Returns:
The only routing from this vertex
- Raises:
KeyError – If the vertex has more than one outgoing partition
- get_single_key_from(vertex: AbstractVertex) int | None[source]¶
Get the first key for the partition starting at a vertex. Fails if the vertex has more than one outgoing partition.
- Parameters:
vertex – The vertex which the partition starts at
- Returns:
The key of the only route from this vertex
- Raises:
KeyError – If the vertex has more than one outgoing partition
- has_info_from(vertex: AbstractVertex, partition_id: str) bool[source]¶
Check if there is routing information for a given vertex and ID.
- Parameters:
vertex – The vertex to search for
partition_id – The ID of the partition for which to get the routing information
- Returns:
True if there is a route from this vertex for this partition.
- class pacman.model.routing_info.VertexRoutingInfo(key_and_mask: BaseKeyAndMask, partition_id: str)¶
Bases:
objectAssociates a partition identifier to its routing information (keys and masks).
- Parameters:
key_and_mask – The keys allocated to the machine partition
partition_id – The partition to set the keys for
- get_keys(n_keys: int | None = None) ndarray[source]¶
Get the ordered list of individual keys allocated to the edge.
- Parameters:
n_keys – Optional limit on the number of keys to return
- Returns:
An array of keys
- property key_and_mask: BaseKeyAndMask¶
The only key and mask.
- abstract property vertex: AbstractVertex¶
The vertex of the information.