These pages document the python code for the PACMAN module which is part of the SpiNNaker Project.
This code depends on SpiNNUtils and SpiNNMachine (Combined_documentation).
PACMAN¶
Provides various functions which together can be used to take a graph and split it into pieces that can be loaded on to a machine, along with routes between the pieces.
Functional Requirements¶
Creation of an Application Graph of Vertices indicating points of computation within the graph and Edges between the vertices indicating a directional communication between the vertices; and a similar Machine Graph.
Vertices in the Application Graph will have a number of atoms - an atom cannot be broken down in to anything smaller.
Vertices in the Application Graph must be able to indicate what machine resources are required by any given subset of the atoms.
Vertices in the Machine Graph must be able to fit on a single chip of the machine in terms of resource usage.
A Vertex can have a number of constraints which must be respected by any algorithm which uses the graph. Algorithms must check that they can support the given constraints and must fail if they cannot. Provided constraints include support for:
- The maximum number of atoms which any Machine Graph Vertex can contain for a given Application Graph vertex
- The chip and/or processor on to which a Machine Graph Vertex should be placed.
- A set of Application Graph Vertices whose corresponding Machine Graph vertices should contain the same number of atoms.
- A set of Application Graph Vertices whose corresponding Machine Graph vertices should be placed on the same chip if they contain the same atom.
It should be possible to create new constraints as the need arises.
Multiple edges can exist between the same two vertices.
It must be possible to build the Machine Graph directly without requiring that it is created by one of the other modules.
It is not required that there is a Machine Graph Edge between every pair of Machine Graph Vertex from the same Application Graph Vertex.
Where a Machine Graph is created from an Application Graph, it should be possible to find the corresponding Vertices and Edges from one graph to the other.
Creation of multicast routing info consisting of key/mask combinations assigned to Edges of the Machine Graph.
- It must be possible to build this information directly without requiring that it is created by one of the other modules.
- There should be exactly one key/mask combination for each Edge in the Machine Graph, which will represent all the keys which will be sent in all packets from the Vertex at the start of the Edge down that Edge.
- It is possible for a Vertex to send several different keys down several different Edges, but only one per Edge (but note that it is acceptable for different keys to be assigned to different Edges between the same two Vertices).
- There should be no overlap between the key/mask combinations of Edges which come from different Vertices i.e. no two Edges which start at different Vertices should have the same key/mask combination.
Partitioning of an Application graph with respect to a machine, such that the resources consumed by each Vertex does not exceed those provided by each chip on the machine.
- It should be possible to select from a range of partitioning algorithms or provide one, although a default should be provided in the absence of such a choice .
- Any partitioning constraints should be met; if there are any that cannot, or that are not understood by the algorithm in use an exception should be thrown. Non-partitioning constraints can be ignored, although these can be used if it makes sense for the given algorithm.
- It must be possible to create at least one grouping of the generated Vertices so that each group fits within the resources provided by a single chip on the machine.
- It should not be assumed that a given grouping of Vertices will be the final grouping on the machine, although it is acceptable to make hints through additional constraints about what is likely to work.
- The machine itself must not be altered by the partitioning, so that it can be used in further processing.
- The graph itself must not be altered by the partitioning, so that it can be used in further processing.
- No two Machine Graph Vertices created from a single Application Graph Vertex can contain the same atom.
- Any Edges in the Application Graph must be split with the Vertices to create a number of Machine Graph edges, such that where there was a vertex v connected to a vertex w by a single edge in the Application Graph, there should be an Edge in the Machine Graph between every Vertex of Application Graph Vertex v and every Vertex of Application Graph Vertex w; for example, if there are 2 Machine Graph Vertices for each of v and w, and one Edge between them in the Application Graph, then there will be 4 new Edges in the Machine Graph for this Edge.
Placement of a Machine Graph on a given machine, such that the resources required by any combination of Vertices placed on any chip in the machine does not exceed the resources provided by that chip.
- It should be possible to choose from a range of placement algorithms or provide one, although a default should be provided in the absence of such a choice.
- Any placement constraints should be met; if there are any that cannot, or that are not understood by placement algorithm, an exception should be thrown. Non-placement constraints can be ignored, although these can be used if it makes sense for the given algorithm.
- The machine itself should not be altered by placement so that it can be used in further processing.
- The graph itself should not be altered by placement so that it can be used in further processing.
- The returned placements should only contain a single placement for each vertex.
- The placements should be such that the vertices with edges between them must be able to communicate with each other.
Allocation of multicast routing keys and masks to a Machine Graph such that each vertex sends out packets with a different key/mask combination.
- This can use the placement information if required. If an algorithm requires placement information but none is provided an exception is thrown.
Routing of edges between vertices with a given allocation of routing keys and masks with respect to a given machine.
- It should be possible to choose from a range of routing algorithms, or provide one, although a default should be provided in the absence of such a choice
- For any vertex, following the routes from the placement of the vertex should result exactly in the set of placements of the destination vertices described by all the edges which start at that vertex. No additional destination should be reached, and no fewer than this set of destinations should be reached.
It should be possible to call each of the modules independently. There should be no assumption that one of the other modules has produced the data input for any other module.
There should be no assumption about how the inputs and outputs are stored.
Any utility functions that provide access to internal structures within a data structure should operate in approximately O(1) time; for example, where an object of type obj holds a number of objects of type subobj with property prop, requesting a list of subobj objects contained within obj with property value prop = value should not iterate through a list of such objects, but should instead maintain a mapping that allows access to such objects in O(1) time. If this is not possible, obj should only provide access to a list of subobj objects, allowing the caller to filter these themselves. This will ensure that no misunderstanding can be made about the speed of operation of a function.
Contents:
pacman package¶
Subpackages¶
pacman.executor package¶
Subpackages¶
pacman.executor.algorithm_classes package¶
-
class
pacman.executor.algorithm_classes.abstract_algorithm.
AbstractAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs)[source]¶ Bases:
object
Represents the metadata for an algorithm
Parameters: - algorithm_id (str) – The unique id of the algorithm
- required_inputs (list of AbstractInput) – The inputs required by the algorithm
- optional_inputs (list of AbstractInput) – The optional inputs for the algorithm, which will be provided when available
- outputs (list of Output) – The output types of the algorithm
-
algorithm_id
¶ The id for this algorithm
-
call
(inputs)[source]¶ Call the algorithm with the given inputs and return the outputs
Parameters: inputs – A dict of input type -> value Returns: A dict of output type -> value
-
optional_inputs
¶ The optional inputs of the algorithm
-
outputs
¶ The outputs of the algorithm
-
required_inputs
¶ The required inputs of the algorithm
-
class
pacman.executor.algorithm_classes.abstract_python_algorithm.
AbstractPythonAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, python_module)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
An algorithm written in Python
Parameters: - algorithm_id (str) – The unique id of the algorithm
- required_inputs (list of AbstractInput) – The inputs required by the algorithm
- optional_inputs (list of AbstractInput) – The optional inputs for the algorithm, which will be provided when available
- outputs (list of Output) – The output types of the algorithm
- python_module – The module containing the python code to execute
-
class
pacman.executor.algorithm_classes.external_algorithm.
ExternalAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, command_line_arguments)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
the container for a algorithm which is external to the SpiNNaker software
pacman.executor.algorithm_decorators package¶
-
class
pacman.executor.algorithm_decorators.abstract_input.
AbstractInput
[source]¶ Bases:
object
An abstract input to an algorithm
-
get_inputs_by_name
(inputs)[source]¶ Get the inputs that match this input by parameter name
Parameters: inputs – A dict of type to value Returns: A dict of parameter name to value Return type: dict
-
input_matches
(inputs)[source]¶ Determine if this input is in the set of inputs
Parameters: inputs – A set of input types Returns: True if this input type is in the list
-
name
¶ The name of the input
-
param_types
¶ The types of the input
-
-
class
pacman.executor.algorithm_decorators.all_of_input.
AllOfInput
(inputs)[source]¶ Bases:
pacman.executor.algorithm_decorators.abstract_input.AbstractInput
A composite input for which all input parameters must be matched
Parameters: inputs – The inputs that make up this input -
get_inputs_by_name
(inputs)[source]¶ Get the inputs that match this input by parameter name
Parameters: inputs – A dict of type to value Returns: A dict of parameter name to value Return type: dict
-
input_matches
(inputs)[source]¶ Determine if this input is in the set of inputs
Parameters: inputs – A set of input types Returns: True if this input type is in the list
-
name
¶ The name of the input
-
param_types
¶ The types of the input
-
-
class
pacman.executor.algorithm_decorators.one_of_input.
OneOfInput
(inputs)[source]¶ Bases:
pacman.executor.algorithm_decorators.abstract_input.AbstractInput
An input for which one of the input parameters must be matched
Parameters: inputs – The inputs that make up this input -
get_inputs_by_name
(inputs)[source]¶ Get the inputs that match this input by parameter name
Parameters: inputs – A dict of type to value Returns: A dict of parameter name to value Return type: dict
-
input_matches
(inputs)[source]¶ Determine if this input is in the set of inputs
Parameters: inputs – A set of input types Returns: True if this input type is in the list
-
name
¶ The name of the input
-
param_types
¶ The types of the input
-
-
class
pacman.executor.algorithm_decorators.output.
Output
(output_type, file_name_type=None)[source]¶ Bases:
object
Represents an output from an algorithm
Parameters: - output_type – The type of the output
- file_name_type – If the output is file based, the type of the input holding the file name
-
file_name_type
¶
-
output_type
¶
-
class
pacman.executor.algorithm_decorators.single_input.
SingleInput
(name, param_types)[source]¶ Bases:
pacman.executor.algorithm_decorators.abstract_input.AbstractInput
An input that is just one item
Parameters: - name (str) – The name of the input parameter
- param_types (list of str) – The ordered possible types of the input parameter
-
get_inputs_by_name
(inputs)[source]¶ Get the inputs that match this input by parameter name
Parameters: inputs – A dict of type to value Returns: A dict of parameter name to value Return type: dict
-
input_matches
(inputs)[source]¶ Determine if this input is in the set of inputs
Parameters: inputs – A set of input types Returns: True if this input type is in the list
-
name
¶ The name of the input
-
param_types
¶ The types of the input
Submodules¶
pacman.executor.algorithm_metadata_xml_reader module¶
pacman.executor.injection_decorator module¶
pacman.executor.pacman_algorithm_executor module¶
Module contents¶
pacman.model package¶
Subpackages¶
pacman.model.abstract_classes package¶
pacman.model.constraints package¶
-
class
pacman.model.constraints.key_allocator_constraints.abstract_key_allocator_constraint.
AbstractKeyAllocatorConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on key allocation
-
class
pacman.model.constraints.key_allocator_constraints.fixed_key_and_mask_constraint.
FixedKeyAndMaskConstraint
(keys_and_masks, key_list_function=None)[source]¶ -
Key allocator constraint that fixes the key and mask of an edge
Parameters: - keys_and_masks (iterable of
pacman.model.routing_info.BaseKeyAndMask
) – The key and mask combinations to fix - key_list_function ((iterable of
pacman.model.routing_info.BaseKeyAndMask
,pacman.model.graph.machine.MachineEdge
, int) -> iterable of int) – Optional function which will be called to translate the keys_and_masks list into individual keys. If missing, the keys will be generated by iterating through the keys_and_masks list directly. The function parameters are: * An iterable of keys and masks * A machine edge * Number of keys to generate (may be None)
-
key_list_function
¶ A function to call to generate the keys
Returns: A python function, or None if the default function can be used
-
keys_and_masks
¶ The keys and masks to be fixed
Returns: An iterable of key and mask combinations Return type: iterable of pacman.model.routing_info.BaseKeyAndMask
- keys_and_masks (iterable of
-
class
pacman.model.constraints.key_allocator_constraints.fixed_key_field_constraint.
FixedKeyFieldConstraint
(fields=None)[source]¶ -
Constraint that indicates fields in the mask of a key
Parameters: fields (iterable of pacman.utilities.field.Field
) – any fields that define regions in the mask with further limitationsRaises: PacmanInvalidParameterException – if any of the fields are outside of the mask i.e. mask & field.mask != field.mask or if any of the field masks overlap i.e. field.mask & other_field.mask != 0 -
fields
¶ Any fields in the mask - i.e. ranges of the mask that have further limitations
Returns: Iterable of fields, ordered by mask with the highest bit range first Return type: iterable of pacman.utilities.field.Field
-
-
class
pacman.model.constraints.key_allocator_constraints.fixed_mask_constraint.
FixedMaskConstraint
(mask)[source]¶ -
A key allocator that fixes the mask to be assigned to an edge
Parameters: mask (int) – the mask to be used during key allocation -
mask
¶ The mask to be used
Returns: The mask to be used Return type: int
-
-
class
pacman.model.constraints.key_allocator_constraints.
AbstractKeyAllocatorConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on key allocation
-
class
pacman.model.constraints.key_allocator_constraints.
ContiguousKeyRangeContraint
[source]¶ -
Key allocator constraint that keeps the keys allocated to a contiguous range. Without this constraint, keys can be allocated across the key space.
-
class
pacman.model.constraints.key_allocator_constraints.
FixedKeyFieldConstraint
(fields=None)[source]¶ -
Constraint that indicates fields in the mask of a key
Parameters: fields (iterable of pacman.utilities.field.Field
) – any fields that define regions in the mask with further limitationsRaises: PacmanInvalidParameterException – if any of the fields are outside of the mask i.e. mask & field.mask != field.mask or if any of the field masks overlap i.e. field.mask & other_field.mask != 0 -
fields
¶ Any fields in the mask - i.e. ranges of the mask that have further limitations
Returns: Iterable of fields, ordered by mask with the highest bit range first Return type: iterable of pacman.utilities.field.Field
-
-
class
pacman.model.constraints.key_allocator_constraints.
FixedKeyAndMaskConstraint
(keys_and_masks, key_list_function=None)[source]¶ -
Key allocator constraint that fixes the key and mask of an edge
Parameters: - keys_and_masks (iterable of
pacman.model.routing_info.BaseKeyAndMask
) – The key and mask combinations to fix - key_list_function ((iterable of
pacman.model.routing_info.BaseKeyAndMask
,pacman.model.graph.machine.MachineEdge
, int) -> iterable of int) – Optional function which will be called to translate the keys_and_masks list into individual keys. If missing, the keys will be generated by iterating through the keys_and_masks list directly. The function parameters are: * An iterable of keys and masks * A machine edge * Number of keys to generate (may be None)
-
key_list_function
¶ A function to call to generate the keys
Returns: A python function, or None if the default function can be used
-
keys_and_masks
¶ The keys and masks to be fixed
Returns: An iterable of key and mask combinations Return type: iterable of pacman.model.routing_info.BaseKeyAndMask
- keys_and_masks (iterable of
-
class
pacman.model.constraints.key_allocator_constraints.
FixedMaskConstraint
(mask)[source]¶ -
A key allocator that fixes the mask to be assigned to an edge
Parameters: mask (int) – the mask to be used during key allocation -
mask
¶ The mask to be used
Returns: The mask to be used Return type: int
-
-
class
pacman.model.constraints.partitioner_constraints.abstract_partitioner_constraint.
AbstractPartitionerConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on the partitioning of a graph
-
class
pacman.model.constraints.partitioner_constraints.max_vertex_atoms_constraint.
MaxVertexAtomsConstraint
(size)[source]¶ -
A constraint which limits the number of atoms on each division of a vertex
Parameters: size (int) – The maximum number of atoms to split the vertex into -
size
¶ The maximum number of atoms to split the vertex into
Return type: int
-
-
class
pacman.model.constraints.partitioner_constraints.same_atoms_as_vertex_constraint.
SameAtomsAsVertexConstraint
(vertex)[source]¶ -
A constraint which indicates that a vertex must be split in the same way as another vertex
Parameters: vertex ( pacman.model.graph.application.application_vertex.ApplicationVertex
) – The vertex to which the constraint refersRaises: None – does not raise any known exceptions -
vertex
¶ The vertex to partition with
Returns: the vertex Return type: pacman.model.graph.application.application_vertex.ApplicationVertex
Raises: None – does not raise any known exceptions
-
-
class
pacman.model.constraints.partitioner_constraints.
AbstractPartitionerConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on the partitioning of a graph
-
class
pacman.model.constraints.partitioner_constraints.
MaxVertexAtomsConstraint
(size)[source]¶ -
A constraint which limits the number of atoms on each division of a vertex
Parameters: size (int) – The maximum number of atoms to split the vertex into -
size
¶ The maximum number of atoms to split the vertex into
Return type: int
-
-
class
pacman.model.constraints.partitioner_constraints.
SameAtomsAsVertexConstraint
(vertex)[source]¶ -
A constraint which indicates that a vertex must be split in the same way as another vertex
Parameters: vertex ( pacman.model.graph.application.application_vertex.ApplicationVertex
) – The vertex to which the constraint refersRaises: None – does not raise any known exceptions -
vertex
¶ The vertex to partition with
Returns: the vertex Return type: pacman.model.graph.application.application_vertex.ApplicationVertex
Raises: None – does not raise any known exceptions
-
-
class
pacman.model.constraints.placer_constraints.abstract_placer_constraint.
AbstractPlacerConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on placement
-
class
pacman.model.constraints.placer_constraints.board_constraint.
BoardConstraint
(board_address)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint on the board on which a placement is made
Parameters: board_address – The IP address of the Ethernet of the board to be used -
board_address
¶ The board of the constraint
-
-
class
pacman.model.constraints.placer_constraints.chip_and_core_constraint.
ChipAndCoreConstraint
(x, y, p=None)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint to place a vertex on a specific chip and, optionally, a specific core on that chip
Parameters: - x (int) – the x-coordinate of the chip
- y (int) – the y-coordinate of the chip
- p (int) – the processor (if any) of the chip
Raises: None – does not raise any known exceptions
-
location
¶ The location as a dictionary with three keys: “x”, “y” and “p”
Returns: a dictionary containing the location Return type: dict of {“x”: int, “y”: int, “p”: int} Raises: None – does not raise any known exceptions
-
p
¶ The processor on the chip
Returns: the processor id or None Return type: int Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip
Returns: the x-coordinate Return type: int Raises: None – does not raise any known exceptions
-
y
¶ The y-coordinate of the chip
Returns: the y-coordinate Return type: int Raises: None – does not raise any known exceptions
-
class
pacman.model.constraints.placer_constraints.radial_placement_from_chip_constraint.
RadialPlacementFromChipConstraint
(x, y)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint that attempts to place a vertex as close to a chip as possible (including on it)
Parameters: - x (int) – the x-coordinate of the chip
- y (int) – the y-coordinate of the chip
Raises: None – does not raise any known exceptions
-
x
¶
-
y
¶
-
class
pacman.model.constraints.placer_constraints.same_chip_as_constraint.
SameChipAsConstraint
(vertex)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
Indicates that a vertex should be placed on the same chip as another vertex
Parameters: vertex – The vertex to place on the same chip -
vertex
¶ The vertex to place on the same chip
-
-
class
pacman.model.constraints.placer_constraints.
AbstractPlacerConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on placement
-
class
pacman.model.constraints.placer_constraints.
BoardConstraint
(board_address)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint on the board on which a placement is made
Parameters: board_address – The IP address of the Ethernet of the board to be used -
board_address
¶ The board of the constraint
-
-
class
pacman.model.constraints.placer_constraints.
ChipAndCoreConstraint
(x, y, p=None)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint to place a vertex on a specific chip and, optionally, a specific core on that chip
Parameters: - x (int) – the x-coordinate of the chip
- y (int) – the y-coordinate of the chip
- p (int) – the processor (if any) of the chip
Raises: None – does not raise any known exceptions
-
location
¶ The location as a dictionary with three keys: “x”, “y” and “p”
Returns: a dictionary containing the location Return type: dict of {“x”: int, “y”: int, “p”: int} Raises: None – does not raise any known exceptions
-
p
¶ The processor on the chip
Returns: the processor id or None Return type: int Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip
Returns: the x-coordinate Return type: int Raises: None – does not raise any known exceptions
-
y
¶ The y-coordinate of the chip
Returns: the y-coordinate Return type: int Raises: None – does not raise any known exceptions
-
class
pacman.model.constraints.placer_constraints.
RadialPlacementFromChipConstraint
(x, y)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
A constraint that attempts to place a vertex as close to a chip as possible (including on it)
Parameters: - x (int) – the x-coordinate of the chip
- y (int) – the y-coordinate of the chip
Raises: None – does not raise any known exceptions
-
x
¶
-
y
¶
-
class
pacman.model.constraints.placer_constraints.
SameChipAsConstraint
(vertex)[source]¶ Bases:
pacman.model.constraints.placer_constraints.abstract_placer_constraint.AbstractPlacerConstraint
Indicates that a vertex should be placed on the same chip as another vertex
Parameters: vertex – The vertex to place on the same chip -
vertex
¶ The vertex to place on the same chip
-
-
class
pacman.model.constraints.router_constraints.abstract_router_constraint.
AbstractRouterConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on routing
-
class
pacman.model.constraints.router_constraints.
AbstractRouterConstraint
[source]¶ Bases:
pacman.model.constraints.abstract_constraint.AbstractConstraint
A constraint on routing
pacman.model.decorators package¶
-
class
pacman.model.decorators.overrides.
overrides
(super_class_method, extend_doc=True, additional_arguments=None)[source]¶ Bases:
object
A decorator for indicating that a method overrides another method in a super class. This checks that the method does actually exist, copies the doc-string for the method, and enforces that the method overridden is specified, making maintenance easier.
Parameters: - super_class_method – The method to override in the superclass
- extend_doc – True the method doc string should be appended to the super-method doc string, False if the documentation should be set to the super-method doc string only if there isn’t a doc string already
- additional_arguments – Additional arguments taken by the subclass method over the superclass method e.g. that are to be injected
-
class
pacman.model.decorators.
overrides
(super_class_method, extend_doc=True, additional_arguments=None)[source]¶ Bases:
object
A decorator for indicating that a method overrides another method in a super class. This checks that the method does actually exist, copies the doc-string for the method, and enforces that the method overridden is specified, making maintenance easier.
Parameters: - super_class_method – The method to override in the superclass
- extend_doc – True the method doc string should be appended to the super-method doc string, False if the documentation should be set to the super-method doc string only if there isn’t a doc string already
- additional_arguments – Additional arguments taken by the subclass method over the superclass method e.g. that are to be injected
pacman.model.graphs package¶
-
class
pacman.model.graphs.common.constrained_object.
ConstrainedObject
(constraints=None)[source]¶ Bases:
object
An implementation of an object which holds constraints
Parameters: constraints – Any initial constraints -
add_constraint
(constraint)[source]¶ Add a new constraint to the collection of constraints
Parameters: constraint ( pacman.model.constraints.abstract_constraint.AbstractConstraint
) – constraint to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If the constraint is not valid
-
add_constraints
(constraints)[source]¶ Add an iterable of constraints to the collection of constraints
Parameters: constraints (iterable of pacman.model.constraints.abstract_constraint.AbstractConstraint
) – iterable of constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: iterable of constraints Return type: iterable of pacman.model.constraints.abstract_constraint .AbstractConstraint
Raises: None – Raises no known exceptions
-
-
class
pacman.model.graphs.common.graph_mapper.
GraphMapper
[source]¶ Bases:
object
A mapping between an Application Graph and a Machine Graph
-
add_edge_mapping
(machine_edge, application_edge)[source]¶ Add a mapping between a machine edge and an application edge
Parameters: - machine_edge – An edge from a Machine Graph
- application_edge – An edge from an Application Graph
-
add_vertex_mapping
(machine_vertex, vertex_slice, application_vertex)[source]¶ Add a mapping between application and machine vertices
Parameters: - machine_vertex – A vertex from a Machine Graph
- vertex_slice (
pacman.model.graphs.common.slice.Slice
) – The range of atoms from the application vertex that is going to be in the machine_vertex - application_vertex – A vertex from an Application Graph
Raises: pacman.exceptions.PacmanValueError – If atom selection is out of bounds.
-
get_application_edge
(machine_edge)[source]¶ Get the application edge mapped to a machine edge
Parameters: machine_edge – An edge from a Machine Graph Returns: A machine edge, or None if none
-
get_application_vertex
(machine_vertex)[source]¶ Get the application vertex mapped to a machine vertex
Parameters: machine_vertex – A vertex from a Machine Graph Returns: an application vertex, or None if none
-
get_machine_edges
(application_edge)[source]¶ Get all machine edges mapped to a given application edge
Parameters: application_edge – An edge from an Application Graph Returns: An iterable of machine edges or None if none
-
get_machine_vertex_index
(machine_vertex)[source]¶ Get the index of a machine vertex within the list of such vertices associated with an application vertex
-
get_machine_vertices
(application_vertex)[source]¶ Get all machine vertices mapped to a given application vertex
Parameters: application_vertex – A vertex from an Application Graph Returns: An iterable of machine vertices or None if none
-
-
class
pacman.model.graphs.common.slice.
Slice
[source]¶ Bases:
pacman.model.graphs.common.slice.Slice
Represents a slice of a vertex.
Attr int lo_atom: The lowest atom represented in the slice. Attr int hi_atom: The highest atom represented in the slice. Attr int n_atoms: The number of atoms represented by the slice. Attr as_slice: This slice represented as a slice()
object (for use in indexing lists, arrays, etc.)Create a new Slice object.
Parameters: - lo_atom (int) – Index of the lowest atom to represent.
- hi_atom (int) – Index of the highest atom to represent.
Raises: PacmanValueError – If the bounds of the slice are invalid.
-
class
pacman.model.graphs.common.
ConstrainedObject
(constraints=None)[source]¶ Bases:
object
An implementation of an object which holds constraints
Parameters: constraints – Any initial constraints -
add_constraint
(constraint)[source]¶ Add a new constraint to the collection of constraints
Parameters: constraint ( pacman.model.constraints.abstract_constraint.AbstractConstraint
) – constraint to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If the constraint is not valid
-
add_constraints
(constraints)[source]¶ Add an iterable of constraints to the collection of constraints
Parameters: constraints (iterable of pacman.model.constraints.abstract_constraint.AbstractConstraint
) – iterable of constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: iterable of constraints Return type: iterable of pacman.model.constraints.abstract_constraint .AbstractConstraint
Raises: None – Raises no known exceptions
-
-
class
pacman.model.graphs.common.
EdgeTrafficType
[source]¶ Bases:
enum.Enum
Indicates the traffic type of an Edge in a graph
-
FIXED_ROUTE
= 2¶
-
MULTICAST
= 1¶
-
-
class
pacman.model.graphs.common.
GraphMapper
[source]¶ Bases:
object
A mapping between an Application Graph and a Machine Graph
-
add_edge_mapping
(machine_edge, application_edge)[source]¶ Add a mapping between a machine edge and an application edge
Parameters: - machine_edge – An edge from a Machine Graph
- application_edge – An edge from an Application Graph
-
add_vertex_mapping
(machine_vertex, vertex_slice, application_vertex)[source]¶ Add a mapping between application and machine vertices
Parameters: - machine_vertex – A vertex from a Machine Graph
- vertex_slice (
pacman.model.graphs.common.slice.Slice
) – The range of atoms from the application vertex that is going to be in the machine_vertex - application_vertex – A vertex from an Application Graph
Raises: pacman.exceptions.PacmanValueError – If atom selection is out of bounds.
-
get_application_edge
(machine_edge)[source]¶ Get the application edge mapped to a machine edge
Parameters: machine_edge – An edge from a Machine Graph Returns: A machine edge, or None if none
-
get_application_vertex
(machine_vertex)[source]¶ Get the application vertex mapped to a machine vertex
Parameters: machine_vertex – A vertex from a Machine Graph Returns: an application vertex, or None if none
-
get_machine_edges
(application_edge)[source]¶ Get all machine edges mapped to a given application edge
Parameters: application_edge – An edge from an Application Graph Returns: An iterable of machine edges or None if none
-
get_machine_vertex_index
(machine_vertex)[source]¶ Get the index of a machine vertex within the list of such vertices associated with an application vertex
-
get_machine_vertices
(application_vertex)[source]¶ Get all machine vertices mapped to a given application vertex
Parameters: application_vertex – A vertex from an Application Graph Returns: An iterable of machine vertices or None if none
-
-
class
pacman.model.graphs.common.
Slice
[source]¶ Bases:
pacman.model.graphs.common.slice.Slice
Represents a slice of a vertex.
Attr int lo_atom: The lowest atom represented in the slice. Attr int hi_atom: The highest atom represented in the slice. Attr int n_atoms: The number of atoms represented by the slice. Attr as_slice: This slice represented as a slice()
object (for use in indexing lists, arrays, etc.)Create a new Slice object.
Parameters: - lo_atom (int) – Index of the lowest atom to represent.
- hi_atom (int) – Index of the highest atom to represent.
Raises: PacmanValueError – If the bounds of the slice are invalid.
-
class
pacman.model.graphs.impl.graph.
Graph
(allowed_vertex_types, allowed_edge_types, allowed_partition_types, label)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_graph.AbstractGraph
A graph implementation that specifies the allowed types of the vertices and edges
Parameters: - allowed_vertex_types – A single or tuple of types of vertex to be allowed in the graph
- allowed_edge_types – A single or tuple of types of edges to be allowed in the graph
- allowed_partition_types – A single or tuple of types of partitions to be allowed in the graph
- label – The label on the graph, or None
-
add_edge
(edge, outgoing_edge_partition_name)[source]¶ Add an edge to the graph
Parameters: - edge (
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edge to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edge (
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph
Parameters: outgoing_edge_partition ( pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
-
add_vertex
(vertex)[source]¶ Add a vertex to the graph
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex to addRaises: PacmanInvalidParameterException – If the vertex is not of a valid type
-
edges
¶ The edges in the graph
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex_with_partition_name
(vertex, partition_name)[source]¶ - Get all the edges that end at the given vertex, and reside in the
- correct partition id
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_outgoing_edge_partition_starting_at_vertex
(vertex, outgoing_edge_partition_name)[source]¶ Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- vertex (
-
get_outgoing_edge_partitions_starting_at_vertex
(vertex)[source]¶ Get all the edge partitions that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
get_outgoing_edge_partitions_with_traffic_type
(traffic_type)[source]¶ Get the outgoing edge partitions with a given traffic type
Parameters: traffic_type ( pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The traffic type to look for
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_outgoing_edge_partitions
¶ The number of outgoing edge partitions in the graph
Return type: int
-
n_vertices
¶ The number of vertices in the graph
Return type: int
-
outgoing_edge_partitions
¶ The outgoing edge partitions in the graph
Return type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
vertices
¶ The vertices in the graph
Return type: iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
-
class
pacman.model.graphs.impl.outgoing_edge_partition.
OutgoingEdgePartition
(identifier, allowed_edge_types, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- A collection of edges which start at a single vertex which have the
- same semantics and so can share a single key
Parameters: - identifier – The identifier of the partition
- allowed_edge_types – The types of edges allowed
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – The weight of traffic going down this partition
-
add_edge
(edge)[source]¶ Add an edge to the partition
Parameters: edge ( pacman.model.graphs.abstract_edge.AbstractEdge
) – the edge to addRaises: pacman.exceptions.PacmanInvalidParameterException
if the starting vertex of the edge does not match that of the edges already in the partition
-
edges
¶ The edges in this outgoing edge partition
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
identifier
¶ The identifier of this outgoing edge partition
Return type: str
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the partition
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this partition start
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this partition
Return type: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this partition compared to other partitions
Return type: int
-
class
pacman.model.graphs.impl.
Graph
(allowed_vertex_types, allowed_edge_types, allowed_partition_types, label)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_graph.AbstractGraph
A graph implementation that specifies the allowed types of the vertices and edges
Parameters: - allowed_vertex_types – A single or tuple of types of vertex to be allowed in the graph
- allowed_edge_types – A single or tuple of types of edges to be allowed in the graph
- allowed_partition_types – A single or tuple of types of partitions to be allowed in the graph
- label – The label on the graph, or None
-
add_edge
(edge, outgoing_edge_partition_name)[source]¶ Add an edge to the graph
Parameters: - edge (
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edge to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edge (
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph
Parameters: outgoing_edge_partition ( pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
-
add_vertex
(vertex)[source]¶ Add a vertex to the graph
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex to addRaises: PacmanInvalidParameterException – If the vertex is not of a valid type
-
edges
¶ The edges in the graph
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex_with_partition_name
(vertex, partition_name)[source]¶ - Get all the edges that end at the given vertex, and reside in the
- correct partition id
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_outgoing_edge_partition_starting_at_vertex
(vertex, outgoing_edge_partition_name)[source]¶ Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- vertex (
-
get_outgoing_edge_partitions_starting_at_vertex
(vertex)[source]¶ Get all the edge partitions that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
get_outgoing_edge_partitions_with_traffic_type
(traffic_type)[source]¶ Get the outgoing edge partitions with a given traffic type
Parameters: traffic_type ( pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The traffic type to look for
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_outgoing_edge_partitions
¶ The number of outgoing edge partitions in the graph
Return type: int
-
n_vertices
¶ The number of vertices in the graph
Return type: int
-
outgoing_edge_partitions
¶ The outgoing edge partitions in the graph
Return type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
vertices
¶ The vertices in the graph
Return type: iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
-
class
pacman.model.graphs.impl.
OutgoingEdgePartition
(identifier, allowed_edge_types, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- A collection of edges which start at a single vertex which have the
- same semantics and so can share a single key
Parameters: - identifier – The identifier of the partition
- allowed_edge_types – The types of edges allowed
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – The weight of traffic going down this partition
-
add_edge
(edge)[source]¶ Add an edge to the partition
Parameters: edge ( pacman.model.graphs.abstract_edge.AbstractEdge
) – the edge to addRaises: pacman.exceptions.PacmanInvalidParameterException
if the starting vertex of the edge does not match that of the edges already in the partition
-
edges
¶ The edges in this outgoing edge partition
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
identifier
¶ The identifier of this outgoing edge partition
Return type: str
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the partition
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this partition start
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this partition
Return type: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this partition compared to other partitions
Return type: int
-
class
pacman.model.graphs.machine.machine_edge.
MachineEdge
(pre_vertex, post_vertex, traffic_type=<EdgeTrafficType.MULTICAST: 1>, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.abstract_edge.AbstractEdge
A simple implementation of a machine edge
Parameters: - pre_vertex (
pacman.model.graphs.machine.abstract_machine_vertex.impl.MachineVertex
) – the vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.abstract_machine_vertex.impl.MachineVertex
) – the vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The type of traffic that this edge will carry - label (str) – The name of the edge
- traffic_weight (int) – the optional weight of traffic expected to travel down this edge relative to other edges (default is 1)
-
label
¶ The label of the edge
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
post_vertex
¶ The vertex at the end of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
pre_vertex
¶ The vertex at the start of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of the edge
Return type: py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The amount of traffic expected to go down this edge relative to other edges
- pre_vertex (
-
class
pacman.model.graphs.machine.machine_fpga_vertex.
MachineFPGAVertex
(fpga_id, fpga_link_id, board_address=None, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
,pacman.model.graphs.abstract_fpga_vertex.AbstractFPGAVertex
A virtual vertex on an FPGA link
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
fpga_id
¶ The id of the FPGA to which the vertex is connected
Return type: int
-
fpga_link_id
¶ The link of the FPGA to which the vertex is connected
Return type: int
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
-
class
pacman.model.graphs.machine.machine_graph.
MachineGraph
(label)[source]¶ Bases:
pacman.model.graphs.impl.graph.Graph
A graph whose vertices can fit on the chips of a machine
-
class
pacman.model.graphs.machine.machine_outgoing_edge_partition.
MachineOutgoingEdgePartition
(identifier, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.impl.outgoing_edge_partition.OutgoingEdgePartition
An outgoing edge partition for a Machine Graph
Parameters: - identifier – The identifier of the partition
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – the weight of this partition in relation to other partitions
-
class
pacman.model.graphs.machine.machine_spinnaker_link_vertex.
MachineSpiNNakerLinkVertex
(spinnaker_link_id, board_address=None, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
,pacman.model.graphs.abstract_spinnaker_link_vertex.AbstractSpiNNakerLinkVertex
A virtual vertex on a SpiNNaker Link
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
-
class
pacman.model.graphs.machine.machine_vertex.
MachineVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_vertex.AbstractVertex
A machine graph vertex
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable of
pacman.model.constraints.AbstractConstraint
) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
label
¶ The label of the vertex
Return type: str
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
class
pacman.model.graphs.machine.simple_machine_vertex.
SimpleMachineVertex
(resources, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
A MachineVertex that stores its own resources
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
-
class
pacman.model.graphs.machine.
MachineEdge
(pre_vertex, post_vertex, traffic_type=<EdgeTrafficType.MULTICAST: 1>, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.abstract_edge.AbstractEdge
A simple implementation of a machine edge
Parameters: - pre_vertex (
pacman.model.graphs.machine.abstract_machine_vertex.impl.MachineVertex
) – the vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.abstract_machine_vertex.impl.MachineVertex
) – the vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The type of traffic that this edge will carry - label (str) – The name of the edge
- traffic_weight (int) – the optional weight of traffic expected to travel down this edge relative to other edges (default is 1)
-
label
¶ The label of the edge
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
post_vertex
¶ The vertex at the end of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
pre_vertex
¶ The vertex at the start of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of the edge
Return type: py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The amount of traffic expected to go down this edge relative to other edges
- pre_vertex (
-
class
pacman.model.graphs.machine.
MachineFPGAVertex
(fpga_id, fpga_link_id, board_address=None, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
,pacman.model.graphs.abstract_fpga_vertex.AbstractFPGAVertex
A virtual vertex on an FPGA link
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
fpga_id
¶ The id of the FPGA to which the vertex is connected
Return type: int
-
fpga_link_id
¶ The link of the FPGA to which the vertex is connected
Return type: int
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
-
class
pacman.model.graphs.machine.
MachineGraph
(label)[source]¶ Bases:
pacman.model.graphs.impl.graph.Graph
A graph whose vertices can fit on the chips of a machine
-
class
pacman.model.graphs.machine.
MachineOutgoingEdgePartition
(identifier, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.impl.outgoing_edge_partition.OutgoingEdgePartition
An outgoing edge partition for a Machine Graph
Parameters: - identifier – The identifier of the partition
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – the weight of this partition in relation to other partitions
-
class
pacman.model.graphs.machine.
MachineSpiNNakerLinkVertex
(spinnaker_link_id, board_address=None, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
,pacman.model.graphs.abstract_spinnaker_link_vertex.AbstractSpiNNakerLinkVertex
A virtual vertex on a SpiNNaker Link
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
-
class
pacman.model.graphs.machine.
MachineVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_vertex.AbstractVertex
A machine graph vertex
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable of
pacman.model.constraints.AbstractConstraint
) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
label
¶ The label of the vertex
Return type: str
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
class
pacman.model.graphs.machine.
SimpleMachineVertex
(resources, label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.machine.machine_vertex.MachineVertex
A MachineVertex that stores its own resources
-
resources_required
¶ The resources required by the vertex
Return type: pacman.model.resources.ResourceContainer
-
-
class
pacman.model.graphs.abstract_edge.
AbstractEdge
[source]¶ Bases:
object
A directed edge in a graph between two vertices
-
label
¶ The label of the edge
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
post_vertex
¶ The vertex at the end of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
pre_vertex
¶ The vertex at the start of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of the edge
Return type: py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
-
class
pacman.model.graphs.abstract_fpga_vertex.
AbstractFPGAVertex
[source]¶ Bases:
pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex
A vertex connected to an FPGA
-
fpga_id
¶ The id of the FPGA to which the vertex is connected
Return type: int
-
fpga_link_id
¶ The link of the FPGA to which the vertex is connected
Return type: int
-
-
class
pacman.model.graphs.abstract_graph.
AbstractGraph
[source]¶ Bases:
object
A graph
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
add_edge
(edge, outgoing_edge_partition_name)[source]¶ Add an edge to the graph
Parameters: - edge (
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edge to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edge (
-
add_edges
(edges, outgoing_edge_partition_name)[source]¶ Add a collection of edges to the graph
Parameters: - edges (an iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edges to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edges to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If any edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edges (an iterable of
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph
Parameters: outgoing_edge_partition ( pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
-
add_vertex
(vertex)[source]¶ Add a vertex to the graph
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex to addRaises: PacmanInvalidParameterException – If the vertex is not of a valid type
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (an iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertices to addRaises: PacmanInvalidParameterException – If any vertex is not of a valid type
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
edges
¶ The edges in the graph
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex_with_partition_name
(vertex, partition_name)[source]¶ - Get all the edges that end at the given vertex, and reside in the
- correct partition id
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_outgoing_edge_partition_starting_at_vertex
(vertex, outgoing_edge_partition_name)[source]¶ Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- vertex (
-
get_outgoing_edge_partitions_starting_at_vertex
(vertex)[source]¶ Get all the edge partitions that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
get_outgoing_edge_partitions_with_traffic_type
(traffic_type)[source]¶ Get the outgoing edge partitions with a given traffic type
Parameters: traffic_type ( pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The traffic type to look for
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_outgoing_edge_partitions
¶ The number of outgoing edge partitions in the graph
Return type: int
-
n_vertices
¶ The number of vertices in the graph
Return type: int
-
outgoing_edge_partitions
¶ The outgoing edge partitions in the graph
Return type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
vertices
¶ The vertices in the graph
Return type: iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
-
-
class
pacman.model.graphs.abstract_outgoing_edge_partition.
AbstractOutgoingEdgePartition
[source]¶ Bases:
object
A group of edges that start at the same vertex and share the same semantics; used to group edges that can use the same multicast key
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the partition
Parameters: edge ( pacman.model.graphs.abstract_edge.AbstractEdge
) – the edge to addRaises: pacman.exceptions.PacmanInvalidParameterException
if the starting vertex of the edge does not match that of the edges already in the partition
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
edges
¶ The edges in this outgoing edge partition
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
identifier
¶ The identifier of this outgoing edge partition
Return type: str
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the partition
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this partition start
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this partition
Return type: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this partition compared to other partitions
Return type: int
-
-
class
pacman.model.graphs.abstract_spinnaker_link_vertex.
AbstractSpiNNakerLinkVertex
[source]¶ Bases:
pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex
A vertex connected to a SpiNNaker Link
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to
-
-
class
pacman.model.graphs.abstract_vertex.
AbstractVertex
[source]¶ Bases:
object
A vertex in a graph
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
label
¶ The label of the vertex
Return type: str
-
-
class
pacman.model.graphs.abstract_virtual_vertex.
AbstractVirtualVertex
[source]¶ Bases:
pacman.model.graphs.abstract_vertex.AbstractVertex
A vertex which exists outside of the machine
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
-
class
pacman.model.graphs.
AbstractEdge
[source]¶ Bases:
object
A directed edge in a graph between two vertices
-
label
¶ The label of the edge
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
post_vertex
¶ The vertex at the end of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
pre_vertex
¶ The vertex at the start of the edge
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of the edge
Return type: py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
-
class
pacman.model.graphs.
AbstractFPGAVertex
[source]¶ Bases:
pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex
A vertex connected to an FPGA
-
fpga_id
¶ The id of the FPGA to which the vertex is connected
Return type: int
-
fpga_link_id
¶ The link of the FPGA to which the vertex is connected
Return type: int
-
-
class
pacman.model.graphs.
AbstractGraph
[source]¶ Bases:
object
A graph
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
add_edge
(edge, outgoing_edge_partition_name)[source]¶ Add an edge to the graph
Parameters: - edge (
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edge to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edge (
-
add_edges
(edges, outgoing_edge_partition_name)[source]¶ Add a collection of edges to the graph
Parameters: - edges (an iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
) – The edges to add - outgoing_edge_partition_name (str) – The name of the edge partition to add the edges to; each edge partition is the partition of edges that start at the same vertex
Raises: PacmanInvalidParameterException – If any edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one
- edges (an iterable of
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph
Parameters: outgoing_edge_partition ( pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
-
add_vertex
(vertex)[source]¶ Add a vertex to the graph
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex to addRaises: PacmanInvalidParameterException – If the vertex is not of a valid type
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (an iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertices to addRaises: PacmanInvalidParameterException – If any vertex is not of a valid type
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
edges
¶ The edges in the graph
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_ending_at_vertex_with_partition_name
(vertex, partition_name)[source]¶ - Get all the edges that end at the given vertex, and reside in the
- correct partition id
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable of
pacman.model.graphs.abstract_edge.AbstractEdge
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
get_outgoing_edge_partition_starting_at_vertex
(vertex, outgoing_edge_partition_name)[source]¶ Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists
Parameters: - vertex (
pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
- vertex (
-
get_outgoing_edge_partitions_starting_at_vertex
(vertex)[source]¶ Get all the edge partitions that start at the given vertex
Parameters: vertex ( pacman.model.graphs.abstract_vertex.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
get_outgoing_edge_partitions_with_traffic_type
(traffic_type)[source]¶ Get the outgoing edge partitions with a given traffic type
Parameters: traffic_type ( pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
) – The traffic type to look for
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_outgoing_edge_partitions
¶ The number of outgoing edge partitions in the graph
Return type: int
-
n_vertices
¶ The number of vertices in the graph
Return type: int
-
outgoing_edge_partitions
¶ The outgoing edge partitions in the graph
Return type: iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
-
vertices
¶ The vertices in the graph
Return type: iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
-
-
class
pacman.model.graphs.
AbstractOutgoingEdgePartition
[source]¶ Bases:
object
A group of edges that start at the same vertex and share the same semantics; used to group edges that can use the same multicast key
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the partition
Parameters: edge ( pacman.model.graphs.abstract_edge.AbstractEdge
) – the edge to addRaises: pacman.exceptions.PacmanInvalidParameterException
if the starting vertex of the edge does not match that of the edges already in the partition
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
edges
¶ The edges in this outgoing edge partition
Return type: iterable of pacman.model.graphs.abstract_edge.AbstractEdge
-
identifier
¶ The identifier of this outgoing edge partition
Return type: str
-
label
¶ The label of the item
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the partition
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this partition start
Return type: pacman.model.graphs.abstract_vertex.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this partition
Return type: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this partition compared to other partitions
Return type: int
-
-
class
pacman.model.graphs.
AbstractSpiNNakerLinkVertex
[source]¶ Bases:
pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex
A vertex connected to a SpiNNaker Link
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to
-
-
class
pacman.model.graphs.
AbstractVertex
[source]¶ Bases:
object
A vertex in a graph
-
add_constraint
(constraint)[source]¶ Add a constraint
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints
Parameters: constraints (list of AbstractConstraint
) – The list of constraints to add
-
constraints
¶ The constraints of the vertex
Return type: iterable of AbstractConstraint
-
label
¶ The label of the vertex
Return type: str
-
-
class
pacman.model.graphs.
AbstractVirtualVertex
[source]¶ Bases:
pacman.model.graphs.abstract_vertex.AbstractVertex
A vertex which exists outside of the machine
-
board_address
¶ The IP address of the board to which the device is connected, or None for the boot board
Return type: str
-
set_virtual_chip_coordinates
(virtual_chip_x, virtual_chip_y)[source]¶ Set the details of the virtual chip that has been added to the machine for this vertex
Parameters: - virtual_chip_x – The x-coordinate of the added chip
- virtual_chip_y – The y-coordinate of the added chip
-
virtual_chip_x
¶ The x-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
virtual_chip_y
¶ The y-coordinate of the virtual chip where this vertex is to be placed
Return type: int
-
pacman.model.placements package¶
-
class
pacman.model.placements.placement.
Placement
(vertex, x, y, p)[source]¶ Bases:
object
The placement of a vertex on to a machine chip and core
Parameters: - vertex (
pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex that has been placed - x (int) – the x-coordinate of the chip on which the vertex is placed
- y (int) – the y-coordinate of the chip on which the vertex is placed
- p (int or None) – the id of the processor on which the vertex is placed
-
p
¶ The id of the processor of the chip where the vertex is placed
Returns: The processor id Return type: int
-
vertex
¶ The vertex that was placed
Returns: a vertex Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip where the vertex is placed
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip where the vertex is placed
Returns: The y-coordinate Return type: int
- vertex (
-
class
pacman.model.placements.placements.
Placements
(placements=None)[source]¶ Bases:
object
The placements of vertices on the chips of the machine
Parameters: placements (iterable of
pacman.model.placements.placement.Placement
) – Any initial placementsRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placement
(placement)[source]¶ Add a placement
Parameters: placement (
pacman.model.placements.placement.Placement
) – The placement to addRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placements
(placements)[source]¶ Add some placements
Parameters: placements (iterable of pacman.model.placements.placement.Placement
) – The placements to add
-
get_placed_processors
()[source]¶ Return an iterable of processors with assigned vertices.
Returns: Iterable of (x, y, p) tuples Return type: iterable of (int, int, int)
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.placement.Placement
Raises: PacmanNotPlacedError – If the vertex has not been placed.
-
get_vertex_on_processor
(x, y, p)[source]¶ Return the vertex on a specific processor or None if the processor has not been allocated
Parameters: - x (int) – the x coordinate of the chip
- y (int) – the y coordinate of the chip
- p (int) – the processor on the chip
Returns: the vertex placed on the given processor
Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: PacmanProcessorNotOccupiedError – If the processor is not occupied
-
is_processor_occupied
(x, y, p)[source]¶ Determine if a processor has a vertex on it
Parameters: - x (int) – x coordinate of processor.
- y (int) – y coordinate of processor.
- p (int) – Index of processor.
Return bool: Whether the processor has an assigned vertex.
-
n_placements
¶ The number of placements
Return type: int
-
placements
¶ All of the placements
Returns: iterable of placements Return type: iterable of pacman.model.placements.placement.Placement
Raises: None – does not raise any known exceptions
-
class
pacman.model.placements.
Placement
(vertex, x, y, p)[source]¶ Bases:
object
The placement of a vertex on to a machine chip and core
Parameters: - vertex (
pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex that has been placed - x (int) – the x-coordinate of the chip on which the vertex is placed
- y (int) – the y-coordinate of the chip on which the vertex is placed
- p (int or None) – the id of the processor on which the vertex is placed
-
p
¶ The id of the processor of the chip where the vertex is placed
Returns: The processor id Return type: int
-
vertex
¶ The vertex that was placed
Returns: a vertex Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip where the vertex is placed
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip where the vertex is placed
Returns: The y-coordinate Return type: int
- vertex (
-
class
pacman.model.placements.
Placements
(placements=None)[source]¶ Bases:
object
The placements of vertices on the chips of the machine
Parameters: placements (iterable of
pacman.model.placements.placement.Placement
) – Any initial placementsRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placement
(placement)[source]¶ Add a placement
Parameters: placement (
pacman.model.placements.placement.Placement
) – The placement to addRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placements
(placements)[source]¶ Add some placements
Parameters: placements (iterable of pacman.model.placements.placement.Placement
) – The placements to add
-
get_placed_processors
()[source]¶ Return an iterable of processors with assigned vertices.
Returns: Iterable of (x, y, p) tuples Return type: iterable of (int, int, int)
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.placement.Placement
Raises: PacmanNotPlacedError – If the vertex has not been placed.
-
get_vertex_on_processor
(x, y, p)[source]¶ Return the vertex on a specific processor or None if the processor has not been allocated
Parameters: - x (int) – the x coordinate of the chip
- y (int) – the y coordinate of the chip
- p (int) – the processor on the chip
Returns: the vertex placed on the given processor
Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: PacmanProcessorNotOccupiedError – If the processor is not occupied
-
is_processor_occupied
(x, y, p)[source]¶ Determine if a processor has a vertex on it
Parameters: - x (int) – x coordinate of processor.
- y (int) – y coordinate of processor.
- p (int) – Index of processor.
Return bool: Whether the processor has an assigned vertex.
-
n_placements
¶ The number of placements
Return type: int
-
placements
¶ All of the placements
Returns: iterable of placements Return type: iterable of pacman.model.placements.placement.Placement
Raises: None – does not raise any known exceptions
pacman.model.resources package¶
-
class
pacman.model.resources.core_resource.
CoreResource
(chip, n_cores)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of cores that need to be allocated
Parameters: - n_cores (int) – The number of cores to allocate
- chip (SpiNNMachine.chip.Chip) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
n_cores
¶
-
class
pacman.model.resources.cpu_cycles_per_tick_resource.
CPUCyclesPerTickResource
(cycles)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of CPU clock cycles per tick used or available on a core of a chip in the machine
Parameters: cycles (int) – The number of CPU clock cycles Raises: None – No known exceptions are raised
-
class
pacman.model.resources.dtcm_resource.
DTCMResource
(dtcm)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: dtcm (int) – The amount of DTCM in bytes Raises: None – No known exceptions are raised
-
class
pacman.model.resources.iptag_resource.
IPtagResource
(ip_address, port, strip_sdp, tag=None, traffic_identifier='DEFAULT')[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: - ip_address (str) – The ip address of the host that will receive data from this tag
- port (int or None) – The port that will
- strip_sdp (bool) – Whether the tag requires that SDP headers are stripped before transmission of data
- tag (int) – A fixed tag id to assign, or None if any tag is OK
- traffic_identifier (str) – The traffic to be sent using this tag; traffic with the same traffic_identifier can be sent using the same tag
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
ip_address
¶ The ip address to assign to the tag
Returns: An ip address Return type: str
-
port
¶ The port of the tag
Returns: The port of the tag Return type: int
-
strip_sdp
¶ Whether SDP headers should be stripped for this tag
Returns: True if the headers should be stripped, False otherwise Return type: bool
-
tag
¶ The tag required, or None if any tag is OK
Returns: The tag or None Return type: int
-
traffic_identifier
¶ the traffic identifier for this iptag
-
class
pacman.model.resources.pre_allocated_resource_container.
PreAllocatedResourceContainer
(specific_sdram_usage=None, specific_core_resources=None, core_resources=None)[source]¶ Bases:
object
container object for pre-allocated resources
Container object for the types of resources
Parameters: - specific_sdram_usage (iterable of pacman.model.resources.SpecificSDRAMResource) – iterable of SpecificSDRAMResource which states that specific chips have missing SDRAM
- specific_core_resources (iterable of pacman.model.resources.SpecificCoreResource) – states which cores have been preallocated
- core_resources (pacman.model.resources.CoreResource) – states a number of cores have been pre allocated but don’t care which ones they are
-
core_resources
¶
-
specific_core_resources
¶
-
specific_sdram_usage
¶
-
class
pacman.model.resources.resource_container.
ResourceContainer
(dtcm=None, sdram=None, cpu_cycles=None, iptags=None, reverse_iptags=None)[source]¶ Bases:
object
container object for the types of resources so that ordering is no longer a risk
Container object for the types of resources
Parameters: - dtcm (None or
pacman.models.resources.dtcm_resource.DTCMResource
) – the amount of dtcm used - sdram (None or
pacman.models.resources.sdram_resource.SDRAMResource
) – the amount of sdram used - cpu_cycles (None or
pacman.models.resources.cpu_cycles_per_tick_resource.CPUCyclesPerTickResource
) – the amount of cpu used - iptags (None or list of
pacman.models.resources.iptag_resource.IPtagResource
) – the iptags required - reverse_iptags (None or list of
pacman.models.resources.reverse_iptag_resource.ReverseIPtagResource
) – the reverse iptags required
Return type: pacman.models.resources.resource_container.ResourceContainer
Raises: None – does not raise any known exception
-
cpu_cycles
¶
-
dtcm
¶
-
sdram
¶
- dtcm (None or
-
class
pacman.model.resources.reverse_iptag_resource.
ReverseIPtagResource
(port=None, sdp_port=1, tag=None)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: - port (int) – The target port of the tag or None to assign elsewhere
- port – The UDP port to listen to on the board for this tag
- sdp_port (int) – The SDP port number to be used when constructing SDP packets from the received UDP packets for this tag
- tag (int or None) – A fixed tag id to assign, or None if any tag is OK
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
port
¶ The port of the tag
Returns: The port of the tag Return type: int
-
sdp_port
¶ The SDP port to use when constructing the SDP message from the received UDP message
-
tag
¶ The tag required, or None if any tag is OK
Returns: The tag or None Return type: int
-
class
pacman.model.resources.sdram_resource.
SDRAMResource
(sdram)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents an amount of SDRAM used or available on a chip in the machine
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised
-
class
pacman.model.resources.specific_chip_sdram_resource.
SpecificChipSDRAMResource
(chip, sdram_usage)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of cores that need to be allocated
Parameters: - sdram_usage (int) – The amount of SDRAM in bytes needed to be pre-allocated
- chip (SpiNNMachine.chip.Chip) – chip of where the SDRAM is to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
sdram_usage
¶
-
class
pacman.model.resources.specific_core_resource.
SpecificCoreResource
(chip, cores)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents specific cores that need to be allocated
Parameters: - cores (iterable of int) – The specific cores that need to be allocated (list of processor ids)
- chip (SpiNNMachine.chip.Chip) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
cores
¶
-
class
pacman.model.resources.
AbstractResource
[source]¶ Bases:
object
Represents some finite resource
-
class
pacman.model.resources.
CPUCyclesPerTickResource
(cycles)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of CPU clock cycles per tick used or available on a core of a chip in the machine
Parameters: cycles (int) – The number of CPU clock cycles Raises: None – No known exceptions are raised
-
class
pacman.model.resources.
DTCMResource
(dtcm)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: dtcm (int) – The amount of DTCM in bytes Raises: None – No known exceptions are raised
-
class
pacman.model.resources.
ElementFreeSpace
(start_address, size)[source]¶ Bases:
object
-
size
¶
-
start_address
¶
-
-
class
pacman.model.resources.
IPtagResource
(ip_address, port, strip_sdp, tag=None, traffic_identifier='DEFAULT')[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: - ip_address (str) – The ip address of the host that will receive data from this tag
- port (int or None) – The port that will
- strip_sdp (bool) – Whether the tag requires that SDP headers are stripped before transmission of data
- tag (int) – A fixed tag id to assign, or None if any tag is OK
- traffic_identifier (str) – The traffic to be sent using this tag; traffic with the same traffic_identifier can be sent using the same tag
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
ip_address
¶ The ip address to assign to the tag
Returns: An ip address Return type: str
-
port
¶ The port of the tag
Returns: The port of the tag Return type: int
-
strip_sdp
¶ Whether SDP headers should be stripped for this tag
Returns: True if the headers should be stripped, False otherwise Return type: bool
-
tag
¶ The tag required, or None if any tag is OK
Returns: The tag or None Return type: int
-
traffic_identifier
¶ the traffic identifier for this iptag
-
class
pacman.model.resources.
ResourceContainer
(dtcm=None, sdram=None, cpu_cycles=None, iptags=None, reverse_iptags=None)[source]¶ Bases:
object
container object for the types of resources so that ordering is no longer a risk
Container object for the types of resources
Parameters: - dtcm (None or
pacman.models.resources.dtcm_resource.DTCMResource
) – the amount of dtcm used - sdram (None or
pacman.models.resources.sdram_resource.SDRAMResource
) – the amount of sdram used - cpu_cycles (None or
pacman.models.resources.cpu_cycles_per_tick_resource.CPUCyclesPerTickResource
) – the amount of cpu used - iptags (None or list of
pacman.models.resources.iptag_resource.IPtagResource
) – the iptags required - reverse_iptags (None or list of
pacman.models.resources.reverse_iptag_resource.ReverseIPtagResource
) – the reverse iptags required
Return type: pacman.models.resources.resource_container.ResourceContainer
Raises: None – does not raise any known exception
-
cpu_cycles
¶
-
dtcm
¶
-
sdram
¶
- dtcm (None or
-
class
pacman.model.resources.
ReverseIPtagResource
(port=None, sdp_port=1, tag=None)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the amount of local core memory available or used on a core on a chip of the machine
Parameters: - port (int) – The target port of the tag or None to assign elsewhere
- port – The UDP port to listen to on the board for this tag
- sdp_port (int) – The SDP port number to be used when constructing SDP packets from the received UDP packets for this tag
- tag (int or None) – A fixed tag id to assign, or None if any tag is OK
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
port
¶ The port of the tag
Returns: The port of the tag Return type: int
-
sdp_port
¶ The SDP port to use when constructing the SDP message from the received UDP message
-
tag
¶ The tag required, or None if any tag is OK
Returns: The tag or None Return type: int
-
class
pacman.model.resources.
SDRAMResource
(sdram)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents an amount of SDRAM used or available on a chip in the machine
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised
-
class
pacman.model.resources.
CoreResource
(chip, n_cores)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of cores that need to be allocated
Parameters: - n_cores (int) – The number of cores to allocate
- chip (SpiNNMachine.chip.Chip) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
n_cores
¶
-
class
pacman.model.resources.
PreAllocatedResourceContainer
(specific_sdram_usage=None, specific_core_resources=None, core_resources=None)[source]¶ Bases:
object
container object for pre-allocated resources
Container object for the types of resources
Parameters: - specific_sdram_usage (iterable of pacman.model.resources.SpecificSDRAMResource) – iterable of SpecificSDRAMResource which states that specific chips have missing SDRAM
- specific_core_resources (iterable of pacman.model.resources.SpecificCoreResource) – states which cores have been preallocated
- core_resources (pacman.model.resources.CoreResource) – states a number of cores have been pre allocated but don’t care which ones they are
-
core_resources
¶
-
specific_core_resources
¶
-
specific_sdram_usage
¶
-
class
pacman.model.resources.
SpecificChipSDRAMResource
(chip, sdram_usage)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents the number of cores that need to be allocated
Parameters: - sdram_usage (int) – The amount of SDRAM in bytes needed to be pre-allocated
- chip (SpiNNMachine.chip.Chip) – chip of where the SDRAM is to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Get the amount of the resource used or available
Returns: The amount of the resource Return type: int
-
sdram_usage
¶
-
class
pacman.model.resources.
SpecificCoreResource
(chip, cores)[source]¶ Bases:
pacman.model.resources.abstract_resource.AbstractResource
Represents specific cores that need to be allocated
Parameters: - cores (iterable of int) – The specific cores that need to be allocated (list of processor ids)
- chip (SpiNNMachine.chip.Chip) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
cores
¶
pacman.model.routing_info package¶
-
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 forReturns: The number of keys required by the partition Return type: int
-
-
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
-
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
- partition (
-
-
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
¶
- keys_and_masks (iterable of
-
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 addRaises: 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 addReturn 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 ofReturns: 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
-
-
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 forReturns: 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
- partition (
-
-
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
¶
- keys_and_masks (iterable of
-
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 addRaises: 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 addReturn 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 ofReturns: 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
-
pacman.model.routing_table_by_partition package¶
-
class
pacman.model.routing_table_by_partition.multicast_routing_table_by_partition.
MulticastRoutingTableByPartition
[source]¶ Bases:
object
A set of multicast routing path objects
-
add_path_entry
(entry, router_x, router_y, partition)[source]¶ Adds a multicast routing path entry
Parameters: - entry – the entry to add
- router_x – the x coord of the router
- router_y – the y coord of the router
- partition (
pacman.model.graphs.AbstractOutgoingEdgePartition
) – the partition containing the machine edge
-
get_entries_for_router
(router_x, router_y)[source]¶ Get the set of multicast path entries assigned to this router
Parameters: - router_x – the x coord of the router
- router_y – the y coord of the router
Returns: return all router_path_entries for the router.
-
-
class
pacman.model.routing_table_by_partition.multicast_routing_table_by_partition_entry.
MulticastRoutingTableByPartitionEntry
(out_going_links, outgoing_processors, incoming_processor=None, incoming_link=None)[source]¶ Bases:
object
An entry in a path of a multicast route
Parameters: - out_going_links (iterable of ints between 0 and 5) – the edges this path entry goes down
- outgoing_processors (iterable of ints between 0 and 17) – the processors this path entry goes to
- incoming_processor (int between 0 and 17) – the direction this entry came from
- incoming_link (int between 0 and 5) – the direction this entry came from in link
-
defaultable
¶ The defaultable status of the entry
-
incoming_link
¶ The source link for this path entry
-
incoming_processor
¶ The source processor
-
merge_entry
(other)[source]¶ Merges the another entry with this one and returns a new MulticastRoutingTableByPartitionEntry
Parameters: other – the MulticastRoutingTableByPartitionEntry to merge into this one Returns: a merged MulticastRoutingTableByPartitionEntry
-
out_going_links
¶ The destination links of the entry
-
out_going_processors
¶ The destination processors of the entry
-
class
pacman.model.routing_table_by_partition.
MulticastRoutingTableByPartition
[source]¶ Bases:
object
A set of multicast routing path objects
-
add_path_entry
(entry, router_x, router_y, partition)[source]¶ Adds a multicast routing path entry
Parameters: - entry – the entry to add
- router_x – the x coord of the router
- router_y – the y coord of the router
- partition (
pacman.model.graphs.AbstractOutgoingEdgePartition
) – the partition containing the machine edge
-
get_entries_for_router
(router_x, router_y)[source]¶ Get the set of multicast path entries assigned to this router
Parameters: - router_x – the x coord of the router
- router_y – the y coord of the router
Returns: return all router_path_entries for the router.
-
-
class
pacman.model.routing_table_by_partition.
MulticastRoutingTableByPartitionEntry
(out_going_links, outgoing_processors, incoming_processor=None, incoming_link=None)[source]¶ Bases:
object
An entry in a path of a multicast route
Parameters: - out_going_links (iterable of ints between 0 and 5) – the edges this path entry goes down
- outgoing_processors (iterable of ints between 0 and 17) – the processors this path entry goes to
- incoming_processor (int between 0 and 17) – the direction this entry came from
- incoming_link (int between 0 and 5) – the direction this entry came from in link
-
defaultable
¶ The defaultable status of the entry
-
incoming_link
¶ The source link for this path entry
-
incoming_processor
¶ The source processor
-
merge_entry
(other)[source]¶ Merges the another entry with this one and returns a new MulticastRoutingTableByPartitionEntry
Parameters: other – the MulticastRoutingTableByPartitionEntry to merge into this one Returns: a merged MulticastRoutingTableByPartitionEntry
-
out_going_links
¶ The destination links of the entry
-
out_going_processors
¶ The destination processors of the entry
pacman.model.routing_tables package¶
-
class
pacman.model.routing_tables.multicast_routing_table.
MulticastRoutingTable
(x, y, multicast_routing_entries=None)[source]¶ Bases:
object
Represents a routing table for a chip
Parameters: - x (int) – The x-coordinate of the chip for which this is the routing table
- y (int) – The y-coordinate of the chip for which this is the routing tables
- multicast_routing_entries (iterable of
spinn_machine.MulticastRoutingEntry
) – An iterable of routing entries to add to the table
Raises: pacman.exceptions.PacmanAlreadyExistsException – If any two routing entries contain the same key-mask combination
-
add_multicast_routing_entry
(multicast_routing_entry)[source]¶ Adds a routing entry to this table
Parameters: multicast_routing_entry ( spinn_machine.MulticastRoutingEntry
) – The route to addReturn type: None Raises: pacman.exceptions.PacmanAlreadyExistsException – If a routing entry with the same key-mask combination already exists
-
get_multicast_routing_entry_by_routing_entry_key
(routing_entry_key, mask)[source]¶ Get the routing entry associated with the specified key_combo-mask combination or None if the routing table does not match the key_combo
Parameters: - routing_entry_key (int) – the routing key to be searched
- mask (int) – the routing mask to be searched
Returns: the routing entry associated with the routing key_combo or None if no such entry exists
Return type:
-
multicast_routing_entries
¶ The multicast routing entries in the table
Returns: an iterable of multicast routing entries Return type: iterable of spinn_machine.MulticastRoutingEntry
Raises: None – does not raise any known exceptions
-
number_of_defaultable_entries
¶ The number of multi-cast routing entries that are set to be defaultable within this multicast routing table
Returns: int
-
number_of_entries
¶ The number of multi-cast routing entries there are in the multicast routing table
-
x
¶ The x-coordinate of the chip of this table
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip of this table
Returns: The y-coordinate Return type: int
-
class
pacman.model.routing_tables.multicast_routing_tables.
MulticastRoutingTables
(routing_tables=None)[source]¶ Bases:
object
Represents the multicast routing tables for a number of chips
Parameters: routing_tables (iterable of pacman.model.routing_tables.MulticastRoutingTable
) – The routing tables to addRaises: pacman.exceptions.PacmanAlreadyExistsException – If any two routing tables are for the same chip -
add_routing_table
(routing_table)[source]¶ Add a routing table
Parameters: routing_table ( pacman.model.routing_tables.MulticastRoutingTable
) – a routing table to addReturn type: None Raises: pacman.exceptions.PacmanAlreadyExistsException – If a routing table already exists for the chip
-
get_routing_table_for_chip
(x, y)[source]¶ Get a routing table for a particular chip
Parameters: - x (int) – The x-coordinate of the chip
- y (int) – The y-coordinate of the chip
Returns: The routing table, or None if no such table exists
Return type: Raises: None – No known exceptions are raised
-
routing_tables
¶ The routing tables stored within
Returns: an iterable of routing tables Return type: iterable of pacman.model.routing_tables.MulticastRoutingTable
Raises: None – does not raise any known exceptions
-
-
class
pacman.model.routing_tables.
MulticastRoutingTable
(x, y, multicast_routing_entries=None)[source]¶ Bases:
object
Represents a routing table for a chip
Parameters: - x (int) – The x-coordinate of the chip for which this is the routing table
- y (int) – The y-coordinate of the chip for which this is the routing tables
- multicast_routing_entries (iterable of
spinn_machine.MulticastRoutingEntry
) – An iterable of routing entries to add to the table
Raises: pacman.exceptions.PacmanAlreadyExistsException – If any two routing entries contain the same key-mask combination
-
add_multicast_routing_entry
(multicast_routing_entry)[source]¶ Adds a routing entry to this table
Parameters: multicast_routing_entry ( spinn_machine.MulticastRoutingEntry
) – The route to addReturn type: None Raises: pacman.exceptions.PacmanAlreadyExistsException – If a routing entry with the same key-mask combination already exists
-
get_multicast_routing_entry_by_routing_entry_key
(routing_entry_key, mask)[source]¶ Get the routing entry associated with the specified key_combo-mask combination or None if the routing table does not match the key_combo
Parameters: - routing_entry_key (int) – the routing key to be searched
- mask (int) – the routing mask to be searched
Returns: the routing entry associated with the routing key_combo or None if no such entry exists
Return type:
-
multicast_routing_entries
¶ The multicast routing entries in the table
Returns: an iterable of multicast routing entries Return type: iterable of spinn_machine.MulticastRoutingEntry
Raises: None – does not raise any known exceptions
-
number_of_defaultable_entries
¶ The number of multi-cast routing entries that are set to be defaultable within this multicast routing table
Returns: int
-
number_of_entries
¶ The number of multi-cast routing entries there are in the multicast routing table
-
x
¶ The x-coordinate of the chip of this table
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip of this table
Returns: The y-coordinate Return type: int
-
class
pacman.model.routing_tables.
MulticastRoutingTables
(routing_tables=None)[source]¶ Bases:
object
Represents the multicast routing tables for a number of chips
Parameters: routing_tables (iterable of pacman.model.routing_tables.MulticastRoutingTable
) – The routing tables to addRaises: pacman.exceptions.PacmanAlreadyExistsException – If any two routing tables are for the same chip -
add_routing_table
(routing_table)[source]¶ Add a routing table
Parameters: routing_table ( pacman.model.routing_tables.MulticastRoutingTable
) – a routing table to addReturn type: None Raises: pacman.exceptions.PacmanAlreadyExistsException – If a routing table already exists for the chip
-
get_routing_table_for_chip
(x, y)[source]¶ Get a routing table for a particular chip
Parameters: - x (int) – The x-coordinate of the chip
- y (int) – The y-coordinate of the chip
Returns: The routing table, or None if no such table exists
Return type: Raises: None – No known exceptions are raised
-
routing_tables
¶ The routing tables stored within
Returns: an iterable of routing tables Return type: iterable of pacman.model.routing_tables.MulticastRoutingTable
Raises: None – does not raise any known exceptions
-
pacman.model.tags package¶
Bases:
object
Represents assigned IP Tag and Reverse IP Tags
Add an IP tag
Parameters: - ip_tag (
spinn_machine.tags.IPTag
) – The tag to add - vertex (
pacman.model.graph.machine.MachineVertex
) – The machine vertex by which the tag is to be used
Raises: PacmanInvalidParameterException –
- If the combination of (board-address, tag) has already been assigned to an IP tag with different properties
- If the combination of (board-address, tag) has already been assigned to a reverse IP tag
- ip_tag (
Add a reverse iptag
Parameters: - reverse_ip_tag (
spinn_machine.tags.ReverseIPTag
) – The tag to add - vertex (
pacman.model.graph.machine.MachineVertex
) – The vertex by which the tag is to be used
Raises: PacmanInvalidParameterException –
- If the combination of (board-address, tag) has already been assigned to an IP tag or Reverse IP tag
- If the port of the tag has already been assigned on the given board-address
- reverse_ip_tag (
Get the IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graph.machine.MachineVertex
) – The vertex to get the tags forReturns: An iterable of IPTag or None if the vertex has no tags Return type: iterable of spinn_machine.tags.IPTag
or None
Get the Reverse IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graph.AbstractVertex
) – The vertex to get the tags forReturns: An iterable of ReverseIPTag or None if the vertex has no tags Return type: iterable of spinn_machine.tags.ReverseIPTag
or None
The IPTags assigned
Returns: iterable of IPTag Return type: iterable of spinn_machine.tags.IPTag
The ReverseIPTags assigned
Returns: iterable of ReverseIPTag Return type: iterable of spinn_machine.tags.ReverseIPTag
Bases:
object
Represents assigned IP Tag and Reverse IP Tags
Add an IP tag
Parameters: - ip_tag (
spinn_machine.tags.IPTag
) – The tag to add - vertex (
pacman.model.graph.machine.MachineVertex
) – The machine vertex by which the tag is to be used
Raises: PacmanInvalidParameterException –
- If the combination of (board-address, tag) has already been assigned to an IP tag with different properties
- If the combination of (board-address, tag) has already been assigned to a reverse IP tag
- ip_tag (
Add a reverse iptag
Parameters: - reverse_ip_tag (
spinn_machine.tags.ReverseIPTag
) – The tag to add - vertex (
pacman.model.graph.machine.MachineVertex
) – The vertex by which the tag is to be used
Raises: PacmanInvalidParameterException –
- If the combination of (board-address, tag) has already been assigned to an IP tag or Reverse IP tag
- If the port of the tag has already been assigned on the given board-address
- reverse_ip_tag (
Get the IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graph.machine.MachineVertex
) – The vertex to get the tags forReturns: An iterable of IPTag or None if the vertex has no tags Return type: iterable of spinn_machine.tags.IPTag
or None
Get the Reverse IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graph.AbstractVertex
) – The vertex to get the tags forReturns: An iterable of ReverseIPTag or None if the vertex has no tags Return type: iterable of spinn_machine.tags.ReverseIPTag
or None
The IPTags assigned
Returns: iterable of IPTag Return type: iterable of spinn_machine.tags.IPTag
The ReverseIPTags assigned
Returns: iterable of ReverseIPTag Return type: iterable of spinn_machine.tags.ReverseIPTag
Module contents¶
pacman.operations package¶
Subpackages¶
pacman.operations.algorithm_reports package¶
-
pacman.operations.algorithm_reports.reports.
generate_comparison_router_report
(report_folder, routing_tables, compressed_routing_tables)[source]¶ Make a report on comparison of the compressed and uncompressed routing tables
Parameters: - report_folder – the folder to store the resulting report
- routing_tables – the original routing tables
- compressed_routing_tables – the compressed routing tables
Return type: None
-
pacman.operations.algorithm_reports.reports.
partitioner_report
(report_folder, hostname, graph, graph_mapper)[source]¶ Generate report on the placement of vertices onto cores.
-
pacman.operations.algorithm_reports.reports.
placement_report_with_application_graph_by_core
(report_folder, hostname, placements, machine, graph_mapper)[source]¶ Generate report on the placement of vertices onto cores by core.
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- graph_mapper – the mapping between application and machine graphs
- machine – the spinnaker machine object
- placements – the placements objects built by the placer.
-
pacman.operations.algorithm_reports.reports.
placement_report_with_application_graph_by_vertex
(report_folder, hostname, graph, graph_mapper, placements)[source]¶ Generate report on the placement of vertices onto cores by vertex.
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- graph – the graph to which placements were built
- graph_mapper – the mapping between graphs
- placements – the placements objects built by the placer.
-
pacman.operations.algorithm_reports.reports.
placement_report_without_application_graph_by_core
(report_folder, hostname, placements, machine)[source]¶ Generate report on the placement of vertices onto cores by core.
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- machine – the spinnaker machine object
- placements – the placements objects built by the placer.
-
pacman.operations.algorithm_reports.reports.
placement_report_without_application_graph_by_vertex
(report_folder, hostname, placements, machine_graph)[source]¶ Generate report on the placement of vertices onto cores by vertex.
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- placements – the placements objects built by the placer.
- machine_graph – the machine graph generated by the end user
-
pacman.operations.algorithm_reports.reports.
placer_reports_with_application_graph
(report_folder, hostname, graph, graph_mapper, placements, machine)[source]¶ Reports that can be produced from placement given a application graph’s existence
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- graph – the application graph to which placements were built
- graph_mapper – the mapping between application and machine graphs
- placements – the placements objects built by the placer.
- machine – the python machine object
Return type: None
-
pacman.operations.algorithm_reports.reports.
placer_reports_without_application_graph
(report_folder, hostname, machine_graph, placements, machine)[source]¶ Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- placements – the placements objects built by the placer.
- machine – the python machine object
- machine_graph – the machine graph to which the reports are to operate on
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_report_from_compressed_router_tables
(report_folder, routing_tables)[source]¶ Parameters: - report_folder –
- routing_tables –
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_report_from_paths
(report_folder, routing_tables, routing_infos, hostname, machine_graph, placements, machine)[source]¶ Generates a text file of routing paths
Parameters: - routing_tables –
- report_folder –
- hostname –
- routing_infos –
- machine_graph –
- placements –
- machine –
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_report_from_router_tables
(report_folder, routing_tables)[source]¶ Parameters: - report_folder –
- routing_tables –
Return type: None
-
pacman.operations.algorithm_reports.reports.
routing_info_report
(report_folder, machine_graph, routing_infos)[source]¶ Generates a report which says which keys is being allocated to each vertex
Parameters: - report_folder – the report folder to store this value
- machine_graph –
- routing_infos –
-
pacman.operations.algorithm_reports.reports.
sdram_usage_report_per_chip
(report_folder, hostname, placements, machine)[source]¶ Reports the SDRAM used per chip
Parameters: - report_folder – the folder to which the reports are being written
- hostname – the machine’s hostname to which the placer worked on
- placements – the placements objects built by the placer.
- machine – the python machine object
Return type: None
-
pacman.operations.algorithm_reports.reports.
tag_allocator_report
(report_folder, tag_infos)[source]¶ Reports the tags that are being used by the tool chain for this simulation
Parameters: - report_folder – the folder to which the reports are being written
- tag_infos – the tags container generated by the tools.
Return type: None
pacman.operations.chip_id_allocator_algorithms package¶
-
class
pacman.operations.chip_id_allocator_algorithms.malloc_based_chip_id_allocator.
MallocBasedChipIdAllocator
[source]¶ Bases:
pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm
A Chip id Allocation Allocator algorithm that keeps track of chip ids and attempts to allocate them as requested
-
class
pacman.operations.chip_id_allocator_algorithms.
MallocBasedChipIdAllocator
[source]¶ Bases:
pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm
A Chip id Allocation Allocator algorithm that keeps track of chip ids and attempts to allocate them as requested
pacman.operations.fixed_route_router package¶
-
class
pacman.operations.fixed_route_router.fixed_route_router.
FixedRouteRouter
[source]¶ Bases:
object
fixed router that makes a mirror path on every board based off the below diagram. It assumed there’s a core on the ethernet connected chip that is of the destination class.
[] [] [] [] / / / /[] [] [] [] [] / / /
[] [] [] [] [] [] / / / / / /
[] [] [] [] [] [] [] / / / / / / /
[] [] [] [] [] [] [] [] | / / / / / / / [] [] [] [] [] [] [] | / / / / / / [] []-[] [] [] [] | / / / / []-[]-[]-[]-[]
-
joins
= {(0, 1): [5], (0, 2): [5], (0, 3): [5], (1, 0): [3], (2, 0): [3], (2, 1): [3], (3, 0): [3], (4, 0): [3], (5, 6): [5], (6, 6): [5]}¶
-
router_path_chips
= {0: [(1, 0), (2, 0), (3, 0), (4, 0), (3, 1), (4, 1), (5, 1), (4, 2), (5, 2), (6, 2), (5, 3), (6, 3), (7, 3), (6, 4), (7, 4), (7, 5)], 1: [(1, 1), (2, 1), (2, 2), (3, 2), (3, 3), (4, 3), (4, 4), (5, 4), (5, 5), (6, 5), (5, 6), (6, 6), (7, 6), (6, 7), (7, 7)], 2: [(0, 1), (0, 2), (1, 2), (0, 3), (1, 3), (2, 3), (1, 4), (2, 4), (3, 4), (2, 5), (3, 5), (4, 5), (3, 6), (4, 6), (4, 7), (5, 7)]}¶
-
pacman.operations.multi_cast_router_check_functionality package¶
pacman.operations.partition_algorithms package¶
pacman.operations.placer_algorithms package¶
-
class
pacman.operations.placer_algorithms.connective_based_placer.
ConnectiveBasedPlacer
[source]¶ Bases:
pacman.operations.placer_algorithms.radial_placer.RadialPlacer
A radial algorithm that can place a machine graph onto a machine using a circle out behaviour from a Ethernet at a given point and which will place things that are most connected closest to each other
-
class
pacman.operations.placer_algorithms.one_to_one_placer.
OneToOnePlacer
[source]¶ Bases:
pacman.operations.placer_algorithms.radial_placer.RadialPlacer
Placer that puts vertices which are directly connected to only its destination on the same chip
-
class
pacman.operations.placer_algorithms.
RadialPlacer
[source]¶ Bases:
object
A placement algorithm that can place a machine graph onto a machine choosing chips radiating in a circle from the boot chip
-
class
pacman.operations.placer_algorithms.
BasicPlacer
[source]¶ Bases:
object
A basic placement algorithm that can place a machine graph onto a machine using the chips as they appear in the machine
-
class
pacman.operations.placer_algorithms.
ConnectiveBasedPlacer
[source]¶ Bases:
pacman.operations.placer_algorithms.radial_placer.RadialPlacer
A radial algorithm that can place a machine graph onto a machine using a circle out behaviour from a Ethernet at a given point and which will place things that are most connected closest to each other
pacman.operations.rig_algorithms package¶
pacman.operations.rigged_algorithms package¶
-
class
pacman.operations.rigged_algorithms.hilbert_state.
HilbertState
(xpos=0, ypos=0, xchange=1, ychange=0)[source]¶ Bases:
object
A mutable self object for the hilbert placer algorithm.
Constructor :param xpos: the x coordinate on the generated curve :param ypos: the y coordinate on the generated curve :param xchange: the change in x coordinate on the generated curve :param ychange: the change in y coordinate on the generated curve :type xpos: int :type ypos: int :type xchange: int :type ychange: int
-
move_forward
()[source]¶ method to move forward in the generation of a hilbert curve :return: the x and y coordinates on the generated curve
-
turn_left
(angle)[source]¶ method to turn left in the generation of a hilbert curve :param angle: determines the direction in which the curve turns :type angle: int :return: the x and y coordinates on the generated curve
-
turn_right
(angle)[source]¶ method to turn right in the generation of a hilbert curve :param angle: determines the direction in which the curve turns :type angle: int :return: the x and y coordinates on the generated curve
-
x_pos
¶
-
y_pos
¶
-
-
class
pacman.operations.rigged_algorithms.isomorph_check.
IsomorphicChecker
[source]¶ Bases:
object
A short algorithm to check if there is an isomorphism of the placement of vertices by two separate placement algorithms. One of the algorithms must output to memory placements_copy in its method and <param_type>MemoryPlacements2</param_type> in algorithms_metadata.xml.
-
check
(placements, placements_copy)[source]¶ Checks if the placements on each processor are the same for two placement algorithms.
Parameters: placements – Placements of vertices on the machine :type
pacman.model.placements.placements.Placements
:param placements_copy: memory copy of placements of vertices on the machine :typepacman.model.placements.placements.Placements
:return True if the placements are the same :rtype bool
-
pacman.operations.router_algorithms package¶
-
class
pacman.operations.router_algorithms.basic_dijkstra_routing.
BasicDijkstraRouting
[source]¶ Bases:
object
An routing algorithm that can find routes for edges between vertices in a machine graph that have been placed on a machine by the use of a Dijkstra shortest path algorithm
-
BW_PER_ROUTE_ENTRY
= 0.01¶
-
MAX_BW
= 250¶
-
pacman.operations.router_compressors package¶
-
class
pacman.operations.router_compressors.mundys_router_compressor.routing_table_condenser.
MundyRouterCompressor
[source]¶ Bases:
object
compressor from rig which has been tied into the main tool chain stack.
-
class
KeyMask
(key, mask)¶ Bases:
tuple
Create new instance of KeyMask(key, mask)
-
key
¶ Alias for field number 0
-
mask
¶ Alias for field number 1
-
-
class
RoutingEntry
(key, mask, route, defaultable)¶ Bases:
tuple
Create new instance of RoutingEntry(key, mask, route, defaultable)
-
defaultable
¶ Alias for field number 3
-
key
¶ Alias for field number 0
-
mask
¶ Alias for field number 1
-
route
¶ Alias for field number 2
-
-
max_supported_length
= 1023¶
-
class
pacman.operations.routing_info_allocator_algorithms package¶
-
class
pacman.operations.routing_info_allocator_algorithms.malloc_based_routing_allocator.compressible_malloc_based_routing_info_allocator.
CompressibleMallocBasedRoutingInfoAllocator
[source]¶ Bases:
pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm
A Routing Info Allocation Allocator algorithm that keeps track of free keys and attempts to allocate them as requested, but that also looks at routing tables in an attempt to make things more compressible
-
class
pacman.operations.routing_info_allocator_algorithms.malloc_based_routing_allocator.malloc_based_routing_info_allocator.
MallocBasedRoutingInfoAllocator
[source]¶ Bases:
pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm
A Routing Info Allocation Allocator algorithm that keeps track of free keys and attempts to allocate them as requested
-
class
pacman.operations.routing_info_allocator_algorithms.basic_routing_info_allocator.
BasicRoutingInfoAllocator
[source]¶ Bases:
object
An basic algorithm that can produce routing keys and masks for edges in a graph based on the x,y,p of the placement of the preceding vertex. Note that no constraints are supported, and that the number of keys required by each edge must be 2048 or less, and that all edges coming out of a vertex will be given the same key/mask assignment.
-
class
pacman.operations.routing_info_allocator_algorithms.destination_based_key_allocator.
DestinationBasedRoutingInfoAllocator
[source]¶ Bases:
object
A routing key allocator that operates for people who wish to have a separate key for each destination (making a mc into a point-to-point cast.
-
MASK
= 4294965248¶
-
MAX_KEYS_SUPPORTED
= 2048¶
-
-
class
pacman.operations.routing_info_allocator_algorithms.
BasicRoutingInfoAllocator
[source]¶ Bases:
object
An basic algorithm that can produce routing keys and masks for edges in a graph based on the x,y,p of the placement of the preceding vertex. Note that no constraints are supported, and that the number of keys required by each edge must be 2048 or less, and that all edges coming out of a vertex will be given the same key/mask assignment.
-
class
pacman.operations.routing_info_allocator_algorithms.
MallocBasedRoutingInfoAllocator
[source]¶ Bases:
pacman.utilities.algorithm_utilities.element_allocator_algorithm.ElementAllocatorAlgorithm
A Routing Info Allocation Allocator algorithm that keeps track of free keys and attempts to allocate them as requested
pacman.operations.routing_table_generators package¶
Module contents¶
pacman.utilities package¶
Subpackages¶
pacman.utilities.algorithm_utilities package¶
-
class
pacman.utilities.algorithm_utilities.field_based_system_utilities.
TYPES_OF_FIELDS
¶ Bases:
enum.Enum
An enumeration.
-
FIXED_FIELD
= 2¶
-
FIXED_KEY
= 1¶
-
FIXED_MASK
= 0¶
-
-
pacman.utilities.algorithm_utilities.field_based_system_utilities.
convert_mask_into_fields
(entity)[source]¶ Parameters: entity –
A collection of methods which support partitioning algorithms.
-
pacman.utilities.algorithm_utilities.partition_algorithm_utilities.
generate_machine_edges
(machine_graph, graph_mapper, application_graph)[source]¶ Generate the machine edges for the vertices in the graph
Parameters: - machine_graph (
pacman.model.graph.machine.MachineGraph
) – the machine graph to add edges to - graph_mapper (
pacman.model.GraphMapper
) – the mapper graphs - application_graph (
pacman.model.graph.application.ApplicationGraph
) – the application graph to work with
- machine_graph (
-
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 – the graph to search through Return type: None:
-
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.
get_edge_groups
(machine_graph)[source]¶ Utility method to get groups of edges using any
pacman.model.constraints.key_allocator_constraints.KeyAllocatorSameKeyConstraint
constraints. Note that no checking is done here about conflicts related to other constraints.Parameters: machine_graph – the machine graph
-
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
pacman.model.constraints.key_allocator_constraints.FixedMaskConstraint
constraint exists in any of the edges in the group.Parameters: same_key_group (iterable of pacman.model.graph.machine.MachineEdge
) – Set of edges that are to be assigned the same keys and masksReturns: The fixed mask if found, or None Raises: PacmanValueError – If two edges conflict in their requirements
pacman.utilities.file_format_converters package¶
-
class
pacman.utilities.file_format_converters.convert_to_memory_multi_cast_routes.
ConvertToMemoryMultiCastRoutes
[source]¶ Bases:
object
Converts between file routing paths and the pacman representation of the routes
-
route_translation
= {'CORE_0': (True, 0), 'CORE_1': (True, 1), 'CORE_10': (True, 10), 'CORE_11': (True, 11), 'CORE_12': (True, 12), 'CORE_13': (True, 13), 'CORE_14': (True, 14), 'CORE_15': (True, 15), 'CORE_16': (True, 16), 'CORE_17': (True, 17), 'CORE_2': (True, 2), 'CORE_3': (True, 3), 'CORE_4': (True, 4), 'CORE_5': (True, 5), 'CORE_6': (True, 6), 'CORE_7': (True, 7), 'CORE_8': (True, 8), 'CORE_9': (True, 9), 'EAST': (False, 0), 'NORTH': (False, 2), 'NORTH_EAST': (False, 1), 'SOUTH': (False, 5), 'SOUTH_WEST': (False, 4), 'WEST': (False, 3)}¶
-
pacman.utilities.utility_objs package¶
-
class
pacman.utilities.utility_objs.resource_tracker.
ResourceTracker
(machine, chips=None, preallocated_resources=None)[source]¶ Bases:
object
Tracks the usage of resources of a machine
Parameters: - machine (
spinn_machine.Machine
) – The machine to track the usage of - chips (iterable of (int, int) tuples of coordinates of chips) – If specified, this list of chips will be used instead of the list from the machine. Note that the order will be maintained, so this can be used either to reduce the set of chips used, or to re-order the chips. Note also that on deallocation, the order is no longer guaranteed.
-
allocate_constrained_group_resources
(resource_and_constraint_list, chips=None)[source]¶ Allocates a group of cores on the same chip for these resources
Parameters: - resource_and_constraint_list – A list of tuples of (resources, list of constraints) to allocate
- chips – a list of chips that can be used
Returns: list of The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: iterable of (int, int, int, list((int, int)), list((int, int)))
-
allocate_constrained_resources
(resources, constraints, chips=None)[source]¶ Attempts to use the given resources of the machine, constrained by the given placement constraints.
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to be allocated - constraints (list of
pacman.model.constraints.AbstractConstraint
) – the constraints to consider - chips (iterable of (int, int)) – The optional list of (x, y) tuples of chip coordinates of chips that can be used. Note that any chips passed in previously will be ignored
Returns: The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: (int, int, int, list((int, int)), list((int, int)))
Raises: PacmanValueError – If the constraints cannot be met given the current allocation of resources
- resources (
-
allocate_group_resources
(group_resources, chips=None, processor_ids=None, board_address=None, group_ip_tags=None, group_reverse_ip_tags=None)[source]¶ Attempts to use the given group of resources on a single chip of the machine. Can be given specific place to use the resources, or else it will allocate them on the first place that the resources of the group fit together.
Parameters: - group_resources (list of
pacman.model.resources.ResourceContainer
) – The resources to be allocated - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_ids (list of (int or None)) – The specific processor to use on any chip for each resource of the group
- board_address (str) – the board address to allocate resources of a chip
- group_ip_tags (list of lists of
pacman.model.resources.IptagResource
) – list of lists of ip tag resources - group_reverse_ip_tags (list of lists of
pacman.model.resources.ReverseIptagResource
) – list of lists of reverse ip tag resources
Returns: An iterable of tuples of the x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: iterable of (int, int, int, list((int, int)), list((int, int)))
- group_resources (list of
-
allocate_resources
(resources, chips=None, processor_id=None, board_address=None, ip_tags=None, reverse_ip_tags=None)[source]¶ Attempts to use the given resources of the machine. Can be given specific place to use the resources, or else it will allocate them on the first place that the resources fit.
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to be allocated - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_id (int) – The specific processor to use on any chip.
- board_address (str) – the board address to allocate resources of a chip
- ip_tags (iterable of
pacman.model.resources.IptagResource
) – iterable of ip tag resources - reverse_ip_tags (iterable of
pacman.model.resources.ReverseIPtagResource
) – iterable of reverse ip tag resources
Returns: The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: (int, int, int, list((int, int, int, int)), list((int, int)))
- resources (
-
static
check_constraints
(vertices, additional_placement_constraints=None)[source]¶ Check that the constraints on the given vertices are supported by the resource tracker
Parameters: - vertices – The vertices to check the constraints of
- additional_placement_constraints – Additional placement constraints supported by the algorithm doing this check
-
chips_available
¶ The chips currently available
-
chips_used
¶ deduce the number of chips used in this allocation
Returns: the number of chips used during the allocation.
-
static
get_chip_and_core
(constraints, chips=None)[source]¶ Get an assigned chip and core from a set of constraints
Parameters: - constraints (iterable of
pacman.model.constraints.AbstractConstraint
) – The set of constraints to get the values from. Note that any type of constraint can be in the list but only those relevant will be used - chips (iterable of (int, int)) – Optional list of tuples of (x, y) coordinates of chips, restricting the allowed chips
Returns: tuple of a chip x and y coordinates, and processor id, any of which might be None
Return type: (tuple of (int, int, int)
- constraints (iterable of
-
static
get_ip_tag_info
(resources, constraints)[source]¶ Get the ip tag resource information
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to get the values from - constraints (list of
pacman.model.constraints.AbstractConstraint
) – A list of constraints
Returns: A tuple of board address, iterable of ip tag resources and iterable of reverse ip tag resources
Return type: (str, iterable of
pacman.model.resources.IptagResource
, iterable ofpacman.model.resources.ReverseIPtabResource
)- resources (
-
get_maximum_constrained_resources_available
(resources, constraints, chips=None)[source]¶ Get the maximum resources available given the constraints
Parameters: - resources (
pacman.model.resources.AbstractResource
) – The resources of the item to check - chips (iterable of spinn_machine.Chip) – the chips to locate the max available resources of
- resources (
-
get_maximum_resources_available
(chips=None, processor_id=None, board_address=None, ip_tags=None, reverse_ip_tags=None)[source]¶ Get the maximum resources available
Parameters: - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_id (int) – the processor id
- board_address (str) – the board address for locating max resources from
- ip_tags (iterable of
pacman.model.resources.IptagResource
) – iterable of ip tag resources - reverse_ip_tags (iterable of
pacman.model.resources.ReverseIptagResource
) – iterable of reverse ip tag resources
Returns: a resource which shows max resources available
Return type:
-
is_chip_available
(chip_x, chip_y)[source]¶ Check if a given chip is available
Parameters: - chip_x (int) – the x coord of the chip
- chip_y (int) – the y coord of the chip
Returns: True if the chip is available, False otherwise
Return type: bool
-
keys
¶ The chip coordinates assigned
-
sdram_avilable_on_chip
(chip_x, chip_y)[source]¶ Get the available SDRAM on the chip at coordinates chip_x, chip_y
Parameters: - chip_x – x coord of the chip in question
- chip_y – y coord of the chip in question
Returns: the SDRAM remaining
-
unallocate_resources
(chip_x, chip_y, processor_id, resources, ip_tags, reverse_ip_tags)[source]¶ Undo the allocation of resources
Parameters: - chip_x (int) – the x coord of the chip allocated
- chip_y (int) – the y coord of the chip allocated
- processor_id (int) – the processor id
- resources (
pacman.model.resources.ResourceContainer
) – The resources to be unallocated - ip_tags (iterable of (str, int) or None) – the details of the ip tags allocated
- reverse_ip_tags (iterable of (str, int) or None) – the details of the reverse ip tags allocated
Return type: None
- machine (
-
class
pacman.utilities.utility_objs.
Field
(lo, hi, value, tag=<SUPPORTED_TAGS.ROUTING: 1>, name=None)[source]¶ Bases:
object
Field object used in a field constraint for key allocation
-
hi
¶
-
lo
¶
-
name
¶
-
tag
¶
-
value
¶
-
-
class
pacman.utilities.utility_objs.
FlexiField
(flexi_field_name, value=None, instance_n_keys=None, tag=None, nested_level=0)[source]¶ Bases:
object
field who’s location is not fixed in key allocation
-
instance_n_keys
¶
-
name
¶ The name for this Flexible field
-
tag
¶
-
value
¶
-
-
class
pacman.utilities.utility_objs.
ResourceTracker
(machine, chips=None, preallocated_resources=None)[source]¶ Bases:
object
Tracks the usage of resources of a machine
Parameters: - machine (
spinn_machine.Machine
) – The machine to track the usage of - chips (iterable of (int, int) tuples of coordinates of chips) – If specified, this list of chips will be used instead of the list from the machine. Note that the order will be maintained, so this can be used either to reduce the set of chips used, or to re-order the chips. Note also that on deallocation, the order is no longer guaranteed.
-
allocate_constrained_group_resources
(resource_and_constraint_list, chips=None)[source]¶ Allocates a group of cores on the same chip for these resources
Parameters: - resource_and_constraint_list – A list of tuples of (resources, list of constraints) to allocate
- chips – a list of chips that can be used
Returns: list of The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: iterable of (int, int, int, list((int, int)), list((int, int)))
-
allocate_constrained_resources
(resources, constraints, chips=None)[source]¶ Attempts to use the given resources of the machine, constrained by the given placement constraints.
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to be allocated - constraints (list of
pacman.model.constraints.AbstractConstraint
) – the constraints to consider - chips (iterable of (int, int)) – The optional list of (x, y) tuples of chip coordinates of chips that can be used. Note that any chips passed in previously will be ignored
Returns: The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: (int, int, int, list((int, int)), list((int, int)))
Raises: PacmanValueError – If the constraints cannot be met given the current allocation of resources
- resources (
-
allocate_group_resources
(group_resources, chips=None, processor_ids=None, board_address=None, group_ip_tags=None, group_reverse_ip_tags=None)[source]¶ Attempts to use the given group of resources on a single chip of the machine. Can be given specific place to use the resources, or else it will allocate them on the first place that the resources of the group fit together.
Parameters: - group_resources (list of
pacman.model.resources.ResourceContainer
) – The resources to be allocated - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_ids (list of (int or None)) – The specific processor to use on any chip for each resource of the group
- board_address (str) – the board address to allocate resources of a chip
- group_ip_tags (list of lists of
pacman.model.resources.IptagResource
) – list of lists of ip tag resources - group_reverse_ip_tags (list of lists of
pacman.model.resources.ReverseIptagResource
) – list of lists of reverse ip tag resources
Returns: An iterable of tuples of the x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: iterable of (int, int, int, list((int, int)), list((int, int)))
- group_resources (list of
-
allocate_resources
(resources, chips=None, processor_id=None, board_address=None, ip_tags=None, reverse_ip_tags=None)[source]¶ Attempts to use the given resources of the machine. Can be given specific place to use the resources, or else it will allocate them on the first place that the resources fit.
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to be allocated - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_id (int) – The specific processor to use on any chip.
- board_address (str) – the board address to allocate resources of a chip
- ip_tags (iterable of
pacman.model.resources.IptagResource
) – iterable of ip tag resources - reverse_ip_tags (iterable of
pacman.model.resources.ReverseIPtagResource
) – iterable of reverse ip tag resources
Returns: The x and y coordinates of the used chip, the processor_id, and the ip tag and reverse ip tag allocation tuples
Return type: (int, int, int, list((int, int, int, int)), list((int, int)))
- resources (
-
static
check_constraints
(vertices, additional_placement_constraints=None)[source]¶ Check that the constraints on the given vertices are supported by the resource tracker
Parameters: - vertices – The vertices to check the constraints of
- additional_placement_constraints – Additional placement constraints supported by the algorithm doing this check
-
chips_available
¶ The chips currently available
-
chips_used
¶ deduce the number of chips used in this allocation
Returns: the number of chips used during the allocation.
-
static
get_chip_and_core
(constraints, chips=None)[source]¶ Get an assigned chip and core from a set of constraints
Parameters: - constraints (iterable of
pacman.model.constraints.AbstractConstraint
) – The set of constraints to get the values from. Note that any type of constraint can be in the list but only those relevant will be used - chips (iterable of (int, int)) – Optional list of tuples of (x, y) coordinates of chips, restricting the allowed chips
Returns: tuple of a chip x and y coordinates, and processor id, any of which might be None
Return type: (tuple of (int, int, int)
- constraints (iterable of
-
static
get_ip_tag_info
(resources, constraints)[source]¶ Get the ip tag resource information
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources to get the values from - constraints (list of
pacman.model.constraints.AbstractConstraint
) – A list of constraints
Returns: A tuple of board address, iterable of ip tag resources and iterable of reverse ip tag resources
Return type: (str, iterable of
pacman.model.resources.IptagResource
, iterable ofpacman.model.resources.ReverseIPtabResource
)- resources (
-
get_maximum_constrained_resources_available
(resources, constraints, chips=None)[source]¶ Get the maximum resources available given the constraints
Parameters: - resources (
pacman.model.resources.AbstractResource
) – The resources of the item to check - chips (iterable of spinn_machine.Chip) – the chips to locate the max available resources of
- resources (
-
get_maximum_resources_available
(chips=None, processor_id=None, board_address=None, ip_tags=None, reverse_ip_tags=None)[source]¶ Get the maximum resources available
Parameters: - chips (iterable of (int, int)) – An iterable of (x, y) tuples of chips that are to be used
- processor_id (int) – the processor id
- board_address (str) – the board address for locating max resources from
- ip_tags (iterable of
pacman.model.resources.IptagResource
) – iterable of ip tag resources - reverse_ip_tags (iterable of
pacman.model.resources.ReverseIptagResource
) – iterable of reverse ip tag resources
Returns: a resource which shows max resources available
Return type:
-
is_chip_available
(chip_x, chip_y)[source]¶ Check if a given chip is available
Parameters: - chip_x (int) – the x coord of the chip
- chip_y (int) – the y coord of the chip
Returns: True if the chip is available, False otherwise
Return type: bool
-
keys
¶ The chip coordinates assigned
-
sdram_avilable_on_chip
(chip_x, chip_y)[source]¶ Get the available SDRAM on the chip at coordinates chip_x, chip_y
Parameters: - chip_x – x coord of the chip in question
- chip_y – y coord of the chip in question
Returns: the SDRAM remaining
-
unallocate_resources
(chip_x, chip_y, processor_id, resources, ip_tags, reverse_ip_tags)[source]¶ Undo the allocation of resources
Parameters: - chip_x (int) – the x coord of the chip allocated
- chip_y (int) – the y coord of the chip allocated
- processor_id (int) – the processor id
- resources (
pacman.model.resources.ResourceContainer
) – The resources to be unallocated - ip_tags (iterable of (str, int) or None) – the details of the ip tags allocated
- reverse_ip_tags (iterable of (str, int) or None) – the details of the reverse ip tags allocated
Return type: None
- machine (
Submodules¶
pacman.utilities.constants module¶
pacman.utilities.rig_converters module¶
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 of
pacman.model.constraints.AbstractConstraint
) – a list of constrained vertices which each has constraints given to the algorithm - supported_constraints (iterable of
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 of
-
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 ([uint8]) – The array to extract the value from
- bit_positions ([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 ([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: [uint8]
-
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 of
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: iterable of
pacman.model.constraints.AbstractConstraint
Raises: None – no known exceptions
- constraints (iterable of
-
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 of
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 of
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
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
Submodules¶
pacman.exceptions module¶
-
exception
pacman.exceptions.
PacmanAlgorithmFailedToCompleteException
(algorithm, exception, tb)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that a pacman algorithm ran from inside the software stack has failed to complete for some unknown reason.
-
algorithm
¶ The algorithm that raised the exception
-
exception
¶ The exception that caused this exception
-
traceback
¶ The traceback of the exception that caused this exception
-
-
exception
pacman.exceptions.
PacmanAlgorithmFailedToGenerateOutputsException
(*args, **kwargs)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that an algorithm has not generated the correct outputs for some unknown reason
-
exception
pacman.exceptions.
PacmanAlreadyExistsException
(item_type, item_id)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something already exists and that adding another would be a conflict
Parameters: - item_type (str) – The type of the item that already exists
- item_id (str) – The id of the item which is in conflict
-
exception
pacman.exceptions.
PacmanAlreadyPlacedError
[source]¶ Bases:
ValueError
Indicates multiple placements are being made for a vertex.
-
exception
pacman.exceptions.
PacmanConfigurationException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with configuring some part of pacman
Parameters: problem (str) – The problem with the routing
-
exception
pacman.exceptions.
PacmanElementAllocationException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with element allocation
Parameters: problem (str) – The problem with the allocation
-
exception
pacman.exceptions.
PacmanException
(*args, **kwargs)[source]¶ Bases:
Exception
Indicates a general exception from Pacman
-
exception
pacman.exceptions.
PacmanExternalAlgorithmFailedToCompleteException
(*args, **kwargs)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that an algorithm ran from outside the software stack has failed to complete for some unknown reason.
-
exception
pacman.exceptions.
PacmanInvalidParameterException
(parameter, value, problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception which indicates that a parameter has an invalid value
Parameters: - parameter (str) – The name of the parameter
- value (str) – The value of the parameter
- problem (str) – The problem with the value of the parameter
-
exception
pacman.exceptions.
PacmanNoMergeException
(*args, **kwargs)[source]¶ Bases:
pacman.exceptions.PacmanException
Exception to indicate that there are no merges worth performing.
-
exception
pacman.exceptions.
PacmanNotExistException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that a routing table entry was attempted to be removed from a routing table which didn’t have such an entry
Parameters: problem (str) – The problem with the routing
-
exception
pacman.exceptions.
PacmanNotFoundError
[source]¶ Bases:
KeyError
,pacman.exceptions.PacmanException
Indicates that some object has not been found when requested.
-
exception
pacman.exceptions.
PacmanNotPlacedError
[source]¶ Bases:
KeyError
Indicates no placements are made for a vertex.
-
exception
pacman.exceptions.
PacmanPartitionException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with partitioning
Parameters: problem (str) – The problem with the partitioning
-
exception
pacman.exceptions.
PacmanPlaceException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with placement
Parameters: problem (str) – The problem with the placement
-
exception
pacman.exceptions.
PacmanProcessorAlreadyOccupiedError
[source]¶ Bases:
ValueError
Indicates multiple placements are being made to a processor.
-
exception
pacman.exceptions.
PacmanProcessorNotOccupiedError
[source]¶ Bases:
KeyError
Indicates that no placement has been made to a processor.
-
exception
pacman.exceptions.
PacmanPruneException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with pruning
Parameters: problem (str) – The problem with the pruning
-
exception
pacman.exceptions.
PacmanRouteInfoAllocationException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with route info allocation
Parameters: problem (str) – The problem with the allocation
-
exception
pacman.exceptions.
PacmanRoutingException
(problem)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with routing
Parameters: problem (str) – The problem with the routing
-
exception
pacman.exceptions.
PacmanTypeError
[source]¶ Bases:
TypeError
,pacman.exceptions.PacmanException
Indicates that an object is of incorrect type.
-
exception
pacman.exceptions.
PacmanValueError
[source]¶ Bases:
ValueError
,pacman.exceptions.PacmanException
Indicates that a value is invalid for some reason.
Module contents¶
Provides various functions which together can be used to take a graph and split it into pieces that can be loaded on to a machine, along with routes between the pieces.
Functional Requirements¶
Creation of an Application Graph of Vertices indicating points of computation within the graph and Edges between the vertices indicating a directional communication between the vertices; and a similar Machine Graph.
Vertices in the Application Graph will have a number of atoms - an atom cannot be broken down in to anything smaller.
Vertices in the Application Graph must be able to indicate what machine resources are required by any given subset of the atoms.
Vertices in the Machine Graph must be able to fit on a single chip of the machine in terms of resource usage.
A Vertex can have a number of constraints which must be respected by any algorithm which uses the graph. Algorithms must check that they can support the given constraints and must fail if they cannot. Provided constraints include support for:
- The maximum number of atoms which any Machine Graph Vertex can contain for a given Application Graph vertex
- The chip and/or processor on to which a Machine Graph Vertex should be placed.
- A set of Application Graph Vertices whose corresponding Machine Graph vertices should contain the same number of atoms.
- A set of Application Graph Vertices whose corresponding Machine Graph vertices should be placed on the same chip if they contain the same atom.
It should be possible to create new constraints as the need arises.
Multiple edges can exist between the same two vertices.
It must be possible to build the Machine Graph directly without requiring that it is created by one of the other modules.
It is not required that there is a Machine Graph Edge between every pair of Machine Graph Vertex from the same Application Graph Vertex.
Where a Machine Graph is created from an Application Graph, it should be possible to find the corresponding Vertices and Edges from one graph to the other.
Creation of multicast routing info consisting of key/mask combinations assigned to Edges of the Machine Graph.
- It must be possible to build this information directly without requiring that it is created by one of the other modules.
- There should be exactly one key/mask combination for each Edge in the Machine Graph, which will represent all the keys which will be sent in all packets from the Vertex at the start of the Edge down that Edge.
- It is possible for a Vertex to send several different keys down several different Edges, but only one per Edge (but note that it is acceptable for different keys to be assigned to different Edges between the same two Vertices).
- There should be no overlap between the key/mask combinations of Edges which come from different Vertices i.e. no two Edges which start at different Vertices should have the same key/mask combination.
Partitioning of an Application graph with respect to a machine, such that the resources consumed by each Vertex does not exceed those provided by each chip on the machine.
- It should be possible to select from a range of partitioning algorithms or provide one, although a default should be provided in the absence of such a choice .
- Any partitioning constraints should be met; if there are any that cannot, or that are not understood by the algorithm in use an exception should be thrown. Non-partitioning constraints can be ignored, although these can be used if it makes sense for the given algorithm.
- It must be possible to create at least one grouping of the generated Vertices so that each group fits within the resources provided by a single chip on the machine.
- It should not be assumed that a given grouping of Vertices will be the final grouping on the machine, although it is acceptable to make hints through additional constraints about what is likely to work.
- The machine itself must not be altered by the partitioning, so that it can be used in further processing.
- The graph itself must not be altered by the partitioning, so that it can be used in further processing.
- No two Machine Graph Vertices created from a single Application Graph Vertex can contain the same atom.
- Any Edges in the Application Graph must be split with the Vertices to create a number of Machine Graph edges, such that where there was a vertex v connected to a vertex w by a single edge in the Application Graph, there should be an Edge in the Machine Graph between every Vertex of Application Graph Vertex v and every Vertex of Application Graph Vertex w; for example, if there are 2 Machine Graph Vertices for each of v and w, and one Edge between them in the Application Graph, then there will be 4 new Edges in the Machine Graph for this Edge.
Placement of a Machine Graph on a given machine, such that the resources required by any combination of Vertices placed on any chip in the machine does not exceed the resources provided by that chip.
- It should be possible to choose from a range of placement algorithms or provide one, although a default should be provided in the absence of such a choice.
- Any placement constraints should be met; if there are any that cannot, or that are not understood by placement algorithm, an exception should be thrown. Non-placement constraints can be ignored, although these can be used if it makes sense for the given algorithm.
- The machine itself should not be altered by placement so that it can be used in further processing.
- The graph itself should not be altered by placement so that it can be used in further processing.
- The returned placements should only contain a single placement for each vertex.
- The placements should be such that the vertices with edges between them must be able to communicate with each other.
Allocation of multicast routing keys and masks to a Machine Graph such that each vertex sends out packets with a different key/mask combination.
- This can use the placement information if required. If an algorithm requires placement information but none is provided an exception is thrown.
Routing of edges between vertices with a given allocation of routing keys and masks with respect to a given machine.
- It should be possible to choose from a range of routing algorithms, or provide one, although a default should be provided in the absence of such a choice
- For any vertex, following the routes from the placement of the vertex should result exactly in the set of placements of the destination vertices described by all the edges which start at that vertex. No additional destination should be reached, and no fewer than this set of destinations should be reached.
It should be possible to call each of the modules independently. There should be no assumption that one of the other modules has produced the data input for any other module.
There should be no assumption about how the inputs and outputs are stored.
Any utility functions that provide access to internal structures within a data structure should operate in approximately O(1) time; for example, where an object of type obj holds a number of objects of type subobj with property prop, requesting a list of subobj objects contained within obj with property value prop = value should not iterate through a list of such objects, but should instead maintain a mapping that allows access to such objects in O(1) time. If this is not possible, obj should only provide access to a list of subobj objects, allowing the caller to filter these themselves. This will ensure that no misunderstanding can be made about the speed of operation of a function.