pacman.utilities.algorithm_utilities package

Submodules

pacman.utilities.algorithm_utilities.element_allocator_algorithm module

class pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm(size_begin, size_end)[source]

Bases: object

Abstract element allocator algorithm which allocates elements from a pool of a given size

Parameters:
  • size_begin (int) –
  • size_end (int) –

pacman.utilities.algorithm_utilities.machine_algorithm_utilities module

pacman.utilities.algorithm_utilities.machine_algorithm_utilities.create_virtual_chip(machine, link_data, virtual_chip_x, virtual_chip_y)[source]

Create a virtual chip on a real machine.

Parameters:
  • machine (Machine) –
  • link_data (AbstractLinkData) – Describes the link from the real machine.
  • virtual_chip_x (int) – Virtual chip coordinate
  • virtual_chip_y (int) – Virtual chip coordinate

pacman.utilities.algorithm_utilities.partition_algorithm_utilities module

A collection of methods which support partitioning algorithms.

pacman.utilities.algorithm_utilities.partition_algorithm_utilities.determine_max_atoms_for_vertex(vertex)[source]

returns the max atom constraint after assessing them all.

Parameters:vertex (ApplicationVertex) – the vertex to find max atoms of
Returns:the max number of atoms per core
Return type:int
pacman.utilities.algorithm_utilities.partition_algorithm_utilities.get_remaining_constraints(vertex)[source]

Gets the rest of the constraints from a vertex after removing partitioning constraints.

Parameters:vertex (ApplicationVertex) –
Return type:list(AbstractConstraint)
pacman.utilities.algorithm_utilities.partition_algorithm_utilities.get_same_size_vertex_groups(vertices)[source]

Get a dictionary of vertex to vertex that must be partitioned the same size.

Parameters:vertices (iterble(ApplicationVertex)) –
Return type:dict(ApplicationVertex, set(ApplicationVertex))

pacman.utilities.algorithm_utilities.placer_algorithm_utilities module

pacman.utilities.algorithm_utilities.placer_algorithm_utilities.add_set(all_sets, new_set)[source]

Adds a new set into the list of sets, concatenating sets if required.

If the new set does not overlap any existing sets it is added.

However if the new sets overlaps one or more existing sets, a superset is created combining all the overlapping sets. Existing overlapping sets are removed and only the new superset is added.

Parameters:
  • all_sets (list(set)) – List of non-overlapping sets
  • new_set (set) – A new set which may or may not overlap the previous sets.
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.create_requirement_collections(vertices, machine_graph)[source]

Get a collection of requirements that includes SDRAM edge resources

pacman.utilities.algorithm_utilities.placer_algorithm_utilities.create_vertices_groups(vertices, same_group_as_function)[source]
Parameters:
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.get_same_chip_vertex_groups(graph)[source]

Get a dictionary of vertex to list of vertices that must be placed on the same chip

Parameters:graph (Graph) – The graph containing the vertices
Return type:dict(AbstractVertex, set(AbstractVertex))
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.get_vertices_on_same_chip(vertex, graph)[source]

Get the vertices that must be on the same chip as the given vertex

Parameters:
  • vertex (AbstractVertex) – The vertex to search with
  • graph (Graph) – The graph containing the vertex
Return type:

set(AbstractVertex)

pacman.utilities.algorithm_utilities.placer_algorithm_utilities.sort_vertices_by_known_constraints(vertices)[source]

Sort vertices to be placed by constraint so that those with more restrictive constraints come first.

Parameters:vertices (list(ApplicationVertex)) –
Return type:list(ApplicationVertex)

pacman.utilities.algorithm_utilities.routing_info_allocator_utilities module

class pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.ConstraintGroup(values)[source]

Bases: list

A list of edges that share a constraint.

Parameters:values (iterable(AbstractSingleSourcePartition)) –
constraint

The shared constraint.

Return type:AbstractConstraint
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.check_types_of_edge_constraint(machine_graph)[source]

Go through the graph for operations and checks that the constraints are compatible.

Parameters:machine_graph (MachineGraph) – the graph to search through
Raises:PacmanConfigurationException – if a problem is found
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.get_fixed_mask(same_key_group)[source]

Get a fixed mask from a group of edges if a FixedMaskConstraint constraint exists in any of the edges in the group.

Parameters:same_key_group (iterable(MachineEdge)) – Set of edges that are to be assigned the same keys and masks
Returns:The fixed mask if found, or None
Return type:tuple(int or None, iterable(Field) or None)
Raises:PacmanValueError – If two edges conflict in their requirements
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.get_mulitcast_edge_groups(machine_graph)[source]

Utility method to get groups of multicast edges using any KeyAllocatorSameKeyConstraint constraints. Note that no checking is done here about conflicts related to other constraints.

Parameters:machine_graph (MachineGraph) – the machine graph
Returns:(fixed key groups, shared key groups, fixed mask groups, fixed field groups, continuous groups, noncontinuous groups)
Return type:tuple(list(ConstraintGroup), list(ConstraintGroup), list(ConstraintGroup), list(ConstraintGroup), list(ConstraintGroup), list(ConstraintGroup))

Module contents

class pacman.utilities.algorithm_utilities.ElementAllocatorAlgorithm(size_begin, size_end)[source]

Bases: object

Abstract element allocator algorithm which allocates elements from a pool of a given size

Parameters:
  • size_begin (int) –
  • size_end (int) –