pacman.utilities package¶
Subpackages¶
- pacman.utilities.algorithm_utilities package
- Submodules
- pacman.utilities.algorithm_utilities.element_allocator_algorithm module
- pacman.utilities.algorithm_utilities.machine_algorithm_utilities module
- pacman.utilities.algorithm_utilities.partition_algorithm_utilities module
- pacman.utilities.algorithm_utilities.placer_algorithm_utilities module
- pacman.utilities.algorithm_utilities.routing_info_allocator_utilities module
- Module contents
- pacman.utilities.file_format_schemas package
- pacman.utilities.utility_objs package
Submodules¶
pacman.utilities.constants module¶
-
class
pacman.utilities.constants.
EDGES
¶ Bases:
enum.Enum
An enumeration.
-
EAST
= 0¶
-
NORTH
= 2¶
-
NORTH_EAST
= 1¶
-
SOUTH
= 5¶
-
SOUTH_WEST
= 4¶
-
WEST
= 3¶
-
-
pacman.utilities.constants.
SARK_PER_MALLOC_SDRAM_USAGE
= 8¶ The number of bytes used by SARK per memory allocation
pacman.utilities.json_utils module¶
Miscellaneous minor functions for converting between JSON and Python objects.
-
pacman.utilities.json_utils.
constraint_to_json
(constraint)[source]¶ Converts a constraint to JSON.
Note
Vertexes are represented by just their label.
If an unexpected constraint is received, the str() and repr() values are saved
If an Exception occurs, that is caught and added to the JSON object.
Parameters: constraint (AbstractConstraint) – The constraint to describe Returns: A dict describing the constraint Return type: dict
pacman.utilities.utility_calls module¶
-
pacman.utilities.utility_calls.
check_algorithm_can_support_constraints
(constrained_vertices, supported_constraints, abstract_constraint_type)[source]¶ - Helper method to find out if an algorithm can support all the
- constraints given the objects its expected to work on
Parameters: - constrained_vertices (list(AbstractVertex)) – a list of constrained vertices which each has constraints given to the algorithm
- supported_constraints (list(type(AbstractConstraint))) – The constraints supported
- abstract_constraint_type (type(AbstractConstraint)) – The overall abstract c type supported
Raises: PacmanInvalidParameterException – When the algorithm cannot support the constraints demanded of it
-
pacman.utilities.utility_calls.
check_constrained_value
(value, current_value)[source]¶ Checks that the current value and a new value match
Parameters: - value – The value to check
- current_value – The existing value
-
pacman.utilities.utility_calls.
compress_bits_from_bit_array
(bit_array, bit_positions)[source]¶ Compress specific positions from a bit array of 32 uint8 value, where is a 1 or 0, into a 32-bit value.
Parameters: Return type:
-
pacman.utilities.utility_calls.
compress_from_bit_array
(bit_array)[source]¶ - Compress a bit array of 32 uint8 values, where each is a 1 or 0,
- into a 32-bit value
Parameters: bit_array (ndarray(uint8)) – The array to compress Return type: int
-
pacman.utilities.utility_calls.
expand_to_bit_array
(value)[source]¶ - Expand a 32-bit value in to an array of length 32 of uint8 values,
- each of which is a 1 or 0
Parameters: value (int) – The value to expand Return type: ndarray(uint8)
-
pacman.utilities.utility_calls.
get_key_ranges
(key, mask)[source]¶ - Get a generator of base_key, n_keys pairs that represent ranges
- allowed by the mask.
Parameters: Return type:
-
pacman.utilities.utility_calls.
ident
(object)[source]¶ Get the ID of the given object.
Parameters: object (object) – Return type: str
-
pacman.utilities.utility_calls.
is_equal_or_None
(a, b)[source]¶ If a and b are both not None, return True iff they are equal, otherwise return True
Return type: bool
-
pacman.utilities.utility_calls.
is_single
(iterable)[source]¶ Test if there is exactly one item in the iterable
Return type: bool
-
pacman.utilities.utility_calls.
locate_constraints_of_type
(constraints, constraint_type)[source]¶ Locates all constraints of a given type out of a list
Parameters: - constraints (iterable(AbstractConstraint)) – The constraints to filter
- constraint_type (type(AbstractConstraint)) – The type of constraints to return
Returns: The constraints of constraint_type that are found in the constraints given
Return type: iterable(AbstractConstraint)
-
pacman.utilities.utility_calls.
locate_first_constraint_of_type
(constraints, constraint_type)[source]¶ Locates the first constraint of a given type out of a list
Parameters: - constraints (iterable(AbstractConstraint)) – The constraints to select from
- constraint_type (type(AbstractConstraint)) – The type of constraints to return
Returns: The first constraint of constraint_type that was found in the constraints given
Return type: Raises: PacmanInvalidParameterException – If no such constraint is present
Module contents¶
-
class
pacman.utilities.
ConstraintOrder
(constraint_class, relative_order, required_optional_properties=None)[source]¶ Bases:
object
A constraint order definition for sorting.
Parameters: - constraint_class (type) – The class of the constraint
- relative_order (int) – The order of the constraint relative to other constraints to be sorted
- required_optional_properties (list(str) or None) – Properties of the constraint instances that must not be None for the constraint to match this ordering
-
class
pacman.utilities.
VertexSorter
(constraint_order)[source]¶ Bases:
object
Sorts vertices based on constraints with given criteria.
Parameters: constraint_order (list(ConstraintOrder)) – The order in which the constraints are to be sorted -
sort
(vertices)[source]¶ Sort the given set of vertices by the constraint ordering
Parameters: vertices (list(AbstractVertex)) – The vertices to sort Returns: The sorted list of vertices Return type: list(AbstractVertex)
-