pacman.utilities package¶
Subpackages¶
- pacman.utilities.algorithm_utilities package
- Submodules
- pacman.utilities.algorithm_utilities.element_allocator_algorithm module
- pacman.utilities.algorithm_utilities.field_based_system_utilities 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_converters package
- pacman.utilities.file_format_schemas package
- pacman.utilities.utility_objs package
Submodules¶
pacman.utilities.constants module¶
pacman.utilities.json_utils module¶
-
pacman.utilities.json_utils.
constraint_to_json
(constraint)[source]¶ Converts a constraint to JSON.
Note: Vertexes are represented by just their label.
Note: 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 – The constraint to describe Returns: A dict describing the constraint
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 (iterable(
pacman.model.constraints.AbstractConstraint
)) – a list of constrained vertices which each has constraints given to the algorithm - supported_constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The constraints supported - abstract_constraint_type (
pacman.model.constraints.AbstractConstraint
) – The overall abstract c type supported
Returns: Nothing is returned
Return type: None
Raises: pacman.exceptions.PacmanInvalidParameterException – When the algorithm cannot support the constraints demanded of it
- constrained_vertices (iterable(
-
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: - bit_array (numpy.array(uint8)) – The array to extract the value from
- bit_positions (numpy.array(int)) – The positions of the bits to extract, each value being between 0 and 31
Return type: int
-
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 (numpy.array(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: numpy.array(uint8)
-
pacman.utilities.utility_calls.
ident
(object)[source]¶ Get the ID of the given 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
-
pacman.utilities.utility_calls.
is_single
(iterable)[source]¶ Test if there is exactly one item in the iterable
-
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(
pacman.model.constraints.AbstractConstraint
)) – The constraints to filter - constraint_type (
pacman.model.constraints.partitioner_constraints.AbstractPartitionConstraint
) – The type of constraints to return
Returns: The constraints of constraint_type that are found in the constraints given
Return type: Raises: None – no known exceptions
- constraints (iterable(
-
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(
pacman.model.constraints.AbstractConstraint
)) – The constraints to select from - constraint_type (
pacman.model.constraints.partitioner_constraints.AbstractPartitionConstraint
) – The type of constraints to return
Returns: The first constraint of constraint_type that was found in the constraints given
Return type: Raises: pacman.exceptions.PacmanInvalidParameterException – If no such constraint is present
- constraints (iterable(
pacman.utilities.vertex_sorter module¶
-
class
pacman.utilities.vertex_sorter.
ConstraintOrder
(constraint_class, relative_order, required_optional_properties=None)[source]¶ Bases:
object
A constraint order definition for sorting.
Parameters: - constraint_class – The class of the constraint
- relative_order – The order of the constraint relative to other constraints to be sorted
- required_optional_properties – Properties of the constraint instances that must not be None for the constraint to match this ordering
-
constraint_class
¶ property method for the constraint class
-
relative_order
¶ property method for the relative order
-
required_optional_properties
¶ property method for the required optional properties
-
class
pacman.utilities.vertex_sorter.
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
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 – The class of the constraint
- relative_order – The order of the constraint relative to other constraints to be sorted
- required_optional_properties – Properties of the constraint instances that must not be None for the constraint to match this ordering
-
constraint_class
¶ property method for the constraint class
-
relative_order
¶ property method for the relative order
-
required_optional_properties
¶ property method for the required optional properties
-
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