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: VertexRoutingInfo

Routing information for an application vertex.

Parameters:
property machine_mask: int

The mask that covers a specific machine vertex.

Return type:

int

merge_machine_entries(entries: List[Tuple[MulticastRoutingTableByPartitionEntry, MachineVertexRoutingInfo]]) Iterable[MulticastRoutingEntry][source]

Merge the machine entries.

Parameters:

entries – The entries to merge

Return type:

iterable(MulticastRoutingEntry)

property n_bits_atoms: int

The number of bits for the atoms.

Return type:

int

property vertex: ApplicationVertex

The vertex of the information.

Return type:

ApplicationVertex or MachineVertex

class pacman.model.routing_info.BaseKeyAndMask(base_key: int, mask: int)

Bases: object

A Key and Mask to be used for routing.

Parameters:
  • base_key (int) – The routing key

  • mask (int) – 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 (ndarray(int)) – Optional array into which the returned keys will be placed

  • offset (int) – Optional offset into the array at which to start placing keys

  • n_keys (int) – 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

Return type:

tuple(ndarray(int), int)

property key: int

The base key.

Return type:

int

property key_combo: int

The key combined with the mask.

Return type:

int

property mask: int

The mask.

Return type:

int

property n_keys: int

The total number of keys that can be generated given the mask.

Return type:

int

class pacman.model.routing_info.MachineVertexRoutingInfo(key_and_mask: BaseKeyAndMask, partition_id: str, machine_vertex: MachineVertex, index: int)

Bases: VertexRoutingInfo

Associates a machine vertex and partition identifier to its routing information (keys and masks).

Parameters:
  • key_and_mask (BaseKeyAndMask) – The key allocated to the machine partition

  • partition_id (str) – The partition to set the keys for

  • machine_vertex (MachineVertex) – The vertex to set the keys for

  • index (int) – The index of the machine vertex

property index: int

The index of the vertex.

Return type:

int

property machine_vertex: MachineVertex

The machine vertex.

Return type:

MachineVertex

property vertex: MachineVertex

The vertex of the information.

Return type:

ApplicationVertex or MachineVertex

class pacman.model.routing_info.RoutingInfo

Bases: object

An association of machine vertices to a non-overlapping set of keys and masks.

add_routing_info(info: VertexRoutingInfo)[source]

Add a routing information item.

Parameters:

info (VertexRoutingInfo) – The routing information item to add

Raises:

PacmanAlreadyExistsException – If the partition is already in the set of edges

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 (AbstractVertex) – The vertex which the partition starts at

  • partition_id (str) – The ID of the partition for which to get the routing information

Returns:

The routing key of the partition

Return type:

int

get_routing_info_from_pre_vertex(vertex: AbstractVertex, partition_id: str) VertexRoutingInfo | None[source]

Get routing information for a given partition_id from a vertex.

Parameters:
  • vertex (AbstractVertex) – The vertex to search for

  • partition_id (str) – The ID of the partition for which to get the routing information

Return type:

VertexRoutingInfo

class pacman.model.routing_info.VertexRoutingInfo(key_and_mask: BaseKeyAndMask, partition_id: str)

Bases: object

Associates a partition identifier to its routing information (keys and masks).

Parameters:
  • key_and_mask (BaseKeyAndMask) – The keys allocated to the machine partition

  • partition_id (str) – 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 (int) – Optional limit on the number of keys to return

Returns:

An array of keys

Return type:

ndarray

property key: int

The first key (or only one if there is only one).

Return type:

int

property key_and_mask

The only key and mask.

Return type:

BaseKeyAndMask

property mask: int

The first mask (or only one if there is only one).

Return type:

int

property partition_id: str

The identifier of the partition.

Return type:

str

abstract property vertex: ApplicationVertex | MachineVertex

The vertex of the information.

Return type:

ApplicationVertex or MachineVertex