pacman.model.routing_info package

Submodules

pacman.model.routing_info.abstract_machine_partition_n_keys_map module

class pacman.model.routing_info.abstract_machine_partition_n_keys_map.AbstractMachinePartitionNKeysMap[source]

Bases: object

A map that provides the number of keys required by each partition

n_keys_for_partition(partition)[source]

The number of keys required by the given partition

Parameters:partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
Returns:The number of keys required by the partition
Return type:int

pacman.model.routing_info.base_key_and_mask module

class pacman.model.routing_info.base_key_and_mask.BaseKeyAndMask(base_key, mask)[source]

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=None, offset=0, n_keys=None)[source]

Get the ordered list of keys that the combination allows

Parameters:
  • key_array (array-like of 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:

(array-like of int, int)

key

The base key

Returns:The base key
Return type:int
key_combo

The key combined with the mask

mask

The mask

Returns:The mask
Return type:int
n_keys

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

Returns:The number of keys
Return type:int

pacman.model.routing_info.dict_based_machine_partition_n_keys_map module

class pacman.model.routing_info.dict_based_machine_partition_n_keys_map.DictBasedMachinePartitionNKeysMap[source]

Bases: pacman.model.routing_info.abstract_machine_partition_n_keys_map.AbstractMachinePartitionNKeysMap

A python dict-based implementation of the AbstractMachinePartitionNKeysMap

n_keys_for_partition(partition)[source]
Parameters:partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
set_n_keys_for_partition(partition, n_keys)[source]

Set the number of keys required by a machine outgoing edge partition

Parameters:
  • partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
  • n_keys (int) – The number of keys required by the edge

pacman.model.routing_info.partition_routing_info module

class pacman.model.routing_info.partition_routing_info.PartitionRoutingInfo(keys_and_masks, partition)[source]

Bases: object

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

Parameters:
  • keys_and_masks (iterable of pacman.model.routing_info.BaseKeyAndMask) – The keys allocated to the machine partition
  • partition (pacman.model.graph.OutgoingEdgePartition) – The partition to set the number of keys for
first_key

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

first_key_and_mask

The first key and mask (or only one if there is only one)

first_mask

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

get_keys(n_keys=None)[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:array-like of int
keys_and_masks
partition

pacman.model.routing_info.routing_info module

class pacman.model.routing_info.routing_info.RoutingInfo(partition_info_items=None)[source]

Bases: object

An association of a set of edges to a non-overlapping set of keys and masks

Parameters:partition_info_items (iterable of pacman.model.routing_info.PartitionRoutingInfo or none) – The partition information items to add
Raises:pacman.exceptions.PacmanAlreadyExistsException – If there are two partition information objects with the same partition
add_partition_info(partition_info)[source]

Add a partition information item

Parameters:partition_info (pacman.model.routing_info.PartitionRoutingInfo) – The partition information item to add
Return type:None
Raises:pacman.exceptions.PacmanAlreadyExistsException – If the partition is already in the set of edges
get_first_key_for_edge(edge)[source]

Get routing key for an edge

Parameters:edge – The edge to search for
get_first_key_from_partition(partition)[source]

Get the first key associated with a particular partition

Parameters:partition (pacman.model.graph.OutgoingEdgePartition) – The partition to get the first key of
Returns:The routing key or None if the partition does not exist
Return type:int
Raises:None – does not raise any known exceptions
get_first_key_from_pre_vertex(vertex, partition_id)[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

Return type:

int

get_routing_info_for_edge(edge)[source]

Get routing information for an edge

Parameters:edge – The edge to search for
get_routing_info_from_partition(partition)[source]
Parameters:partition (pacman.model.graph.OutgoingEdgePartition) – The partition to set the number of keys for
Returns:the partition_routing_info for the partition
get_routing_info_from_pre_vertex(vertex, partition_id)[source]

Get routing information for edges with a given partition_id from a pre vertex

Parameters:
  • vertex – The pre_vertex to search for
  • partition_id – The id of the partition for which to get the routing information

Module contents

class pacman.model.routing_info.AbstractMachinePartitionNKeysMap[source]

Bases: object

A map that provides the number of keys required by each partition

n_keys_for_partition(partition)[source]

The number of keys required by the given partition

Parameters:partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
Returns:The number of keys required by the partition
Return type:int
class pacman.model.routing_info.BaseKeyAndMask(base_key, mask)[source]

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=None, offset=0, n_keys=None)[source]

Get the ordered list of keys that the combination allows

Parameters:
  • key_array (array-like of 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:

(array-like of int, int)

key

The base key

Returns:The base key
Return type:int
key_combo

The key combined with the mask

mask

The mask

Returns:The mask
Return type:int
n_keys

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

Returns:The number of keys
Return type:int
class pacman.model.routing_info.DictBasedMachinePartitionNKeysMap[source]

Bases: pacman.model.routing_info.abstract_machine_partition_n_keys_map.AbstractMachinePartitionNKeysMap

A python dict-based implementation of the AbstractMachinePartitionNKeysMap

n_keys_for_partition(partition)[source]
Parameters:partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
set_n_keys_for_partition(partition, n_keys)[source]

Set the number of keys required by a machine outgoing edge partition

Parameters:
  • partition (pacman.model.graph.simple_outgoing_edge_partition.OutgoingEdgePartition) – The partition to set the number of keys for
  • n_keys (int) – The number of keys required by the edge
class pacman.model.routing_info.PartitionRoutingInfo(keys_and_masks, partition)[source]

Bases: object

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

Parameters:
  • keys_and_masks (iterable of pacman.model.routing_info.BaseKeyAndMask) – The keys allocated to the machine partition
  • partition (pacman.model.graph.OutgoingEdgePartition) – The partition to set the number of keys for
first_key

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

first_key_and_mask

The first key and mask (or only one if there is only one)

first_mask

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

get_keys(n_keys=None)[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:array-like of int
keys_and_masks
partition
class pacman.model.routing_info.RoutingInfo(partition_info_items=None)[source]

Bases: object

An association of a set of edges to a non-overlapping set of keys and masks

Parameters:partition_info_items (iterable of pacman.model.routing_info.PartitionRoutingInfo or none) – The partition information items to add
Raises:pacman.exceptions.PacmanAlreadyExistsException – If there are two partition information objects with the same partition
add_partition_info(partition_info)[source]

Add a partition information item

Parameters:partition_info (pacman.model.routing_info.PartitionRoutingInfo) – The partition information item to add
Return type:None
Raises:pacman.exceptions.PacmanAlreadyExistsException – If the partition is already in the set of edges
get_first_key_for_edge(edge)[source]

Get routing key for an edge

Parameters:edge – The edge to search for
get_first_key_from_partition(partition)[source]

Get the first key associated with a particular partition

Parameters:partition (pacman.model.graph.OutgoingEdgePartition) – The partition to get the first key of
Returns:The routing key or None if the partition does not exist
Return type:int
Raises:None – does not raise any known exceptions
get_first_key_from_pre_vertex(vertex, partition_id)[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

Return type:

int

get_routing_info_for_edge(edge)[source]

Get routing information for an edge

Parameters:edge – The edge to search for
get_routing_info_from_partition(partition)[source]
Parameters:partition (pacman.model.graph.OutgoingEdgePartition) – The partition to set the number of keys for
Returns:the partition_routing_info for the partition
get_routing_info_from_pre_vertex(vertex, partition_id)[source]

Get routing information for edges with a given partition_id from a pre vertex

Parameters:
  • vertex – The pre_vertex to search for
  • partition_id – The id of the partition for which to get the routing information