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¶
pacman package¶
Subpackages¶
pacman.executor package¶
Subpackages¶
-
class
pacman.executor.algorithm_classes.abstract_algorithm.
AbstractAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens)[source]¶ Bases:
object
Represents the metadata for an algorithm.
Parameters: - algorithm_id (str) – The unique ID of the algorithm
- required_inputs (list(
AbstractInput
)) – The inputs required by the algorithm - optional_inputs (list(
AbstractInput
)) – The optional inputs for the algorithm, which will be provided when available - outputs (list(
Output
)) – The output types of the algorithm - required_input_tokens (list(
Token
)) – Tokens required to have been generated before this algorithm can start - optional_input_tokens (list(
Token
)) – Tokens required to have been generated before this algorithm can start if and only if at least one algorithm generates the token - generated_output_tokens (list(
Token
)) – Tokens generated by this 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
-
generated_output_tokens
¶ The generated output tokens of the algorithm
-
optional_input_tokens
¶ The optional input tokens of the algorithm
-
optional_inputs
¶ The optional inputs of the algorithm
-
outputs
¶ The outputs of the algorithm
-
required_input_tokens
¶ The required input tokens 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, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
An algorithm written in Python.
Parameters: 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, required_input_tokens, optional_input_tokens, generated_output_tokens, command_line_arguments)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
An algorithm which is external to the SpiNNaker software, or rather its wrapper into PACMAN.
-
class
pacman.executor.algorithm_classes.python_class_algorithm.
PythonClassAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_class, python_method=None)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm
An algorithm that is a class.
Parameters: - python_class – The class of the algorithm
- python_method – The method of the algorithm, or None if the class is callable
-
class
pacman.executor.algorithm_classes.python_function_algorithm.
PythonFunctionAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_function)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm
An algorithm that is a function.
Parameters: python_function – The name of the function to call
-
class
pacman.executor.algorithm_classes.
AbstractAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens)[source]¶ Bases:
object
Represents the metadata for an algorithm.
Parameters: - algorithm_id (str) – The unique ID of the algorithm
- required_inputs (list(
AbstractInput
)) – The inputs required by the algorithm - optional_inputs (list(
AbstractInput
)) – The optional inputs for the algorithm, which will be provided when available - outputs (list(
Output
)) – The output types of the algorithm - required_input_tokens (list(
Token
)) – Tokens required to have been generated before this algorithm can start - optional_input_tokens (list(
Token
)) – Tokens required to have been generated before this algorithm can start if and only if at least one algorithm generates the token - generated_output_tokens (list(
Token
)) – Tokens generated by this 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
-
generated_output_tokens
¶ The generated output tokens of the algorithm
-
optional_input_tokens
¶ The optional input tokens of the algorithm
-
optional_inputs
¶ The optional inputs of the algorithm
-
outputs
¶ The outputs of the algorithm
-
required_input_tokens
¶ The required input tokens of the algorithm
-
required_inputs
¶ The required inputs of the algorithm
-
class
pacman.executor.algorithm_classes.
AbstractPythonAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
An algorithm written in Python.
Parameters: python_module – The module containing the python code to execute
-
class
pacman.executor.algorithm_classes.
ExternalAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, command_line_arguments)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_algorithm.AbstractAlgorithm
An algorithm which is external to the SpiNNaker software, or rather its wrapper into PACMAN.
-
class
pacman.executor.algorithm_classes.
PythonClassAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_class, python_method=None)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm
An algorithm that is a class.
Parameters: - python_class – The class of the algorithm
- python_method – The method of the algorithm, or None if the class is callable
-
class
pacman.executor.algorithm_classes.
PythonFunctionAlgorithm
(algorithm_id, required_inputs, optional_inputs, outputs, required_input_tokens, optional_input_tokens, generated_output_tokens, python_module, python_function)[source]¶ Bases:
pacman.executor.algorithm_classes.abstract_python_algorithm.AbstractPythonAlgorithm
An algorithm that is a function.
Parameters: python_function – The name of the function to call
-
class
pacman.executor.algorithm_decorators.abstract_input.
AbstractInput
[source]¶ Bases:
object
An abstract input to an algorithm
-
get_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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.algorithm_decorator.
AllOf
(*items)[source]¶ Bases:
object
Indicates that all of the items specified are required.
Parameters: items (str, pacman.executor.algorithm_decorators.AllOf, pacman.executor.algorithm_decorators.OneOf) – The items required -
items
¶ The items specified
-
real_class
¶ The AbstractInput class to use for this input
-
-
class
pacman.executor.algorithm_decorators.algorithm_decorator.
OneOf
(*items)[source]¶ Bases:
object
Indicates that one of the items specified is required.
Parameters: items (str, pacman.executor.algorithm_decorators.AllOf, pacman.executor.algorithm_decorators.OneOf) – The items required -
items
¶ The items specified
-
real_class
¶ The AbstractInput class to use for this input
-
-
pacman.executor.algorithm_decorators.algorithm_decorator.
algorithm
(input_definitions, outputs, algorithm_id=None, required_inputs=None, optional_inputs=None, method=None, required_input_tokens=None, optional_input_tokens=None, generated_output_tokens=None)[source]¶ Define an object to be a PACMAN algorithm that can be executed by the
pacman.executor.pacman_algorithm_executor.PACMANAlgorithmExecutor
.Can be used to decorate either a class or a function (not a method). If this decorates a class, the class must be callable (i.e., have a __call__ method), or else a method must be specified to call to run the algorithm.
The inputs and outputs referenced below refer to the parameters of the method or function.
Parameters: - input_definitions (dict(str, str or list(str))) – dict of algorithm parameter name to list of types, one for each required algorithm parameter, and one for each optional parameter that is used in this algorithm call
- outputs (list(str)) – A list of types output from the algorithm that must match the order in which they are returned.
- algorithm_id (str) – Optional unique ID of the algorithm; if not specified, the name of the class or function is used.
- required_inputs (list(str or
pacman.executor.algorithm_decorators.OneOf
orpacman.executor.algorithm_decorators.AllOf
)) – Optional list of required algorithm parameter names; if not specified those parameters which have no default values are used. - optional_inputs (list(str or
pacman.executor.algorithm_decorators.OneOf
orpacman.executor.algorithm_decorators.AllOf
)) – Optional list of optional algorithm parameter names; if not specified those parameters which have default values are used. - method – The optional name of the method to call if decorating a class; if not specified, __call__ is used (i.e. it is assumed to be callable). Must not be used if decorating a function
- required_input_tokens – A list of tokens required to have been generated before this algorithm runs
- optional_input_tokens – A list of tokens that if generated by any algorithm, must have been generated before this algorithm runs
- generated_output_tokens – A list of tokens generated by running this algorithm
-
pacman.executor.algorithm_decorators.algorithm_decorator.
algorithms
(algorithms)[source]¶ Specify multiple algorithms for a single class or function
Parameters: algorithms – A list of algorithm definitions
-
pacman.executor.algorithm_decorators.algorithm_decorator.
get_algorithms
()[source]¶ Get the dict of known algorithm ID -> algorithm data
-
pacman.executor.algorithm_decorators.algorithm_decorator.
reset_algorithms
()[source]¶ Reset the known algorithms
-
pacman.executor.algorithm_decorators.algorithm_decorator.
scan_packages
(packages, recursive=True)[source]¶ Scan packages for algorithms
Parameters: - packages – The names of the packages to scan (using dotted notation), or the actual package modules
- recursive – True if sub-packages should be examined
Returns: A dict of algorithm name -> algorithm data
-
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_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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(str)) – The ordered possible types of the input parameter
-
get_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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.
AbstractInput
[source]¶ Bases:
object
An abstract input to an algorithm
-
get_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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.
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_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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.
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_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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_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.
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(str)) – The ordered possible types of the input parameter
-
get_fake_inputs
(inputs)[source]¶ Get input types that are not in inputs but which satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are not available in inputs
-
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
-
get_matching_inputs
(inputs)[source]¶ Get input types that are in inputs and satisfy this input
Parameters: inputs – A set of input types Returns: A set of input parameter names that are available in inputs
-
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.
AllOf
(*items)[source]¶ Bases:
object
Indicates that all of the items specified are required.
Parameters: items (str, pacman.executor.algorithm_decorators.AllOf, pacman.executor.algorithm_decorators.OneOf) – The items required -
items
¶ The items specified
-
real_class
¶ The AbstractInput class to use for this input
-
-
class
pacman.executor.algorithm_decorators.
OneOf
(*items)[source]¶ Bases:
object
Indicates that one of the items specified is required.
Parameters: items (str, pacman.executor.algorithm_decorators.AllOf, pacman.executor.algorithm_decorators.OneOf) – The items required -
items
¶ The items specified
-
real_class
¶ The AbstractInput class to use for this input
-
-
pacman.executor.algorithm_decorators.
algorithm
(input_definitions, outputs, algorithm_id=None, required_inputs=None, optional_inputs=None, method=None, required_input_tokens=None, optional_input_tokens=None, generated_output_tokens=None)[source]¶ Define an object to be a PACMAN algorithm that can be executed by the
pacman.executor.pacman_algorithm_executor.PACMANAlgorithmExecutor
.Can be used to decorate either a class or a function (not a method). If this decorates a class, the class must be callable (i.e., have a __call__ method), or else a method must be specified to call to run the algorithm.
The inputs and outputs referenced below refer to the parameters of the method or function.
Parameters: - input_definitions (dict(str, str or list(str))) – dict of algorithm parameter name to list of types, one for each required algorithm parameter, and one for each optional parameter that is used in this algorithm call
- outputs (list(str)) – A list of types output from the algorithm that must match the order in which they are returned.
- algorithm_id (str) – Optional unique ID of the algorithm; if not specified, the name of the class or function is used.
- required_inputs (list(str or
pacman.executor.algorithm_decorators.OneOf
orpacman.executor.algorithm_decorators.AllOf
)) – Optional list of required algorithm parameter names; if not specified those parameters which have no default values are used. - optional_inputs (list(str or
pacman.executor.algorithm_decorators.OneOf
orpacman.executor.algorithm_decorators.AllOf
)) – Optional list of optional algorithm parameter names; if not specified those parameters which have default values are used. - method – The optional name of the method to call if decorating a class; if not specified, __call__ is used (i.e. it is assumed to be callable). Must not be used if decorating a function
- required_input_tokens – A list of tokens required to have been generated before this algorithm runs
- optional_input_tokens – A list of tokens that if generated by any algorithm, must have been generated before this algorithm runs
- generated_output_tokens – A list of tokens generated by running this algorithm
-
pacman.executor.algorithm_decorators.
algorithms
(algorithms)[source]¶ Specify multiple algorithms for a single class or function
Parameters: algorithms – A list of algorithm definitions
-
pacman.executor.algorithm_decorators.
get_algorithms
()[source]¶ Get the dict of known algorithm ID -> algorithm data
-
pacman.executor.algorithm_decorators.
scan_packages
(packages, recursive=True)[source]¶ Scan packages for algorithms
Parameters: - packages – The names of the packages to scan (using dotted notation), or the actual package modules
- recursive – True if sub-packages should be examined
Returns: A dict of algorithm name -> algorithm data
Submodules¶
pacman.executor.algorithm_metadata_xml_reader module¶
pacman.executor.injection_decorator module¶
-
exception
pacman.executor.injection_decorator.
InjectionException
[source]¶ Bases:
Exception
Raised when there is an error with injection.
-
pacman.executor.injection_decorator.
clear_injectables
()[source]¶ Clear the current set of injectables
-
pacman.executor.injection_decorator.
do_injection
(objects_to_inject, objects_to_inject_into=None)[source]¶ Perform the actual injection of objects.
Parameters: - objects_to_inject (dict(str)->object) – The objects to be injected as a dict of type name -> object of type
- objects_to_inject_into (list) – The objects whose classes support_injection, or None to use all instances that have been created
-
pacman.executor.injection_decorator.
inject
(type_to_inject)[source]¶ Marks a method as something to be called to inject an object of the given type. The type is just a name for the type, and should match up at some point with some generated data.
Parameters: type_to_inject – The type to be injected using this method
-
pacman.executor.injection_decorator.
inject_items
(types)[source]¶ Indicates values that need to be injected into the method
Parameters: types – A dict of method argument name to type name to be injected
-
class
pacman.executor.injection_decorator.
injection_context
(injection_dictionary)[source]¶ Bases:
object
Provides a context for injection to use with with.
Parameters: injection_dictionary – The dictionary of items to inject whilst in the context
-
pacman.executor.injection_decorator.
provide_injectables
(injectables)[source]¶ Set the objects from which values should be injected into methods
Parameters: injectables – A dict of type to value
-
pacman.executor.injection_decorator.
requires_injection
(types_required)[source]¶ Indicates that injection of the given types is required before this method is called; an Exception is raised if the types have not been injected.
Parameters: types_required (list(str)) – A list of types that must have been injected
pacman.executor.pacman_algorithm_executor module¶
-
class
pacman.executor.pacman_algorithm_executor.
PACMANAlgorithmExecutor
(algorithms, optional_algorithms, inputs, required_outputs, tokens, required_output_tokens, xml_paths=None, packages=None, do_timings=True, print_timings=False, do_immediate_injection=True, do_post_run_injection=False, inject_inputs=True, do_direct_injection=True, use_unscanned_annotated_algorithms=True, provenance_path=None, provenance_name=None)[source]¶ Bases:
object
An executor of PACMAN algorithms where the order is deduced from the input and outputs of the algorithm using an XML description of the algorithm.
Parameters: - algorithms – A list of algorithms that must all be run
- optional_algorithms – A list of algorithms that must be run if their inputs are available
- inputs – A dict of input type to value
- required_outputs – A list of output types that must be generated
- tokens – A list of tokens that should be considered to have been generated
- required_output_tokens – A list of tokens that should be generated by the end of the run
- xml_paths – An optional list of paths to XML files containing algorithm descriptions; if not specified, only detected algorithms will be used (or else those found in packages)
- packages – An optional list of packages to scan for decorated algorithms; if not specified, only detected algorithms will be used (or else those specified in packages
- do_timings – True if timing information should be printed after each algorithm, False otherwise
- do_immediate_injection – Perform injection with objects as they are created; can result in multiple calls to the same inject-annotated methods
- do_post_run_injection – Perform injection at the end of the run. This will only set the last object of any type created.
- inject_inputs – True if inputs should be injected; only active if one of do_immediate_injection or do_post_run_injection is True. These variables define when the injection of inputs is done; if immediate injection is True, injection of inputs is done at the start of the run, otherwise it is done at the end.
- do_direct_injection – True if direct injection into methods should be supported. This will allow any of the inputs or generated outputs to be injected into a method
- use_unscanned_annotated_algorithms – True if algorithms that have been detected outside of the packages argument specified above should be used
- provenance_path – Path to file to append full provenance data to If None no provenance is written
-
algorithm_timings
¶
-
get_completed_tokens
()[source]¶ Get all of the tokens that have completed as part of this execution
Returns: A list of tokens
pacman.executor.token_states module¶
Module contents¶
-
class
pacman.executor.
AlgorithmMetadataXmlReader
(xml_paths)[source]¶ Bases:
object
Converts an XML file into algorithm data.
Parameters: xml_paths – paths to extra metadata files Return type: None
-
class
pacman.executor.
PACMANAlgorithmExecutor
(algorithms, optional_algorithms, inputs, required_outputs, tokens, required_output_tokens, xml_paths=None, packages=None, do_timings=True, print_timings=False, do_immediate_injection=True, do_post_run_injection=False, inject_inputs=True, do_direct_injection=True, use_unscanned_annotated_algorithms=True, provenance_path=None, provenance_name=None)[source]¶ Bases:
object
An executor of PACMAN algorithms where the order is deduced from the input and outputs of the algorithm using an XML description of the algorithm.
Parameters: - algorithms – A list of algorithms that must all be run
- optional_algorithms – A list of algorithms that must be run if their inputs are available
- inputs – A dict of input type to value
- required_outputs – A list of output types that must be generated
- tokens – A list of tokens that should be considered to have been generated
- required_output_tokens – A list of tokens that should be generated by the end of the run
- xml_paths – An optional list of paths to XML files containing algorithm descriptions; if not specified, only detected algorithms will be used (or else those found in packages)
- packages – An optional list of packages to scan for decorated algorithms; if not specified, only detected algorithms will be used (or else those specified in packages
- do_timings – True if timing information should be printed after each algorithm, False otherwise
- do_immediate_injection – Perform injection with objects as they are created; can result in multiple calls to the same inject-annotated methods
- do_post_run_injection – Perform injection at the end of the run. This will only set the last object of any type created.
- inject_inputs – True if inputs should be injected; only active if one of do_immediate_injection or do_post_run_injection is True. These variables define when the injection of inputs is done; if immediate injection is True, injection of inputs is done at the start of the run, otherwise it is done at the end.
- do_direct_injection – True if direct injection into methods should be supported. This will allow any of the inputs or generated outputs to be injected into a method
- use_unscanned_annotated_algorithms – True if algorithms that have been detected outside of the packages argument specified above should be used
- provenance_path – Path to file to append full provenance data to If None no provenance is written
-
algorithm_timings
¶
-
get_completed_tokens
()[source]¶ Get all of the tokens that have completed as part of this execution
Returns: A list of tokens
pacman.model package¶
Subpackages¶
-
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(
pacman.model.routing_info.BaseKeyAndMask
)) – The key and mask combinations to fix - key_list_function (iterable(
pacman.model.routing_info.BaseKeyAndMask
,pacman.model.graphs.machine.MachineEdge
, int) -> iterable(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( pacman.model.routing_info.BaseKeyAndMask
)
- keys_and_masks (iterable(
-
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( pacman.utilities.utility_objs.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.value != field.value or if any of the field masks overlap i.e., field.value & other_field.value != 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( pacman.utilities.utility_objs.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( pacman.utilities.utility_objs.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.value != field.value or if any of the field masks overlap i.e., field.value & other_field.value != 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( pacman.utilities.utility_objs.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(
pacman.model.routing_info.BaseKeyAndMask
)) – The key and mask combinations to fix - key_list_function (iterable(
pacman.model.routing_info.BaseKeyAndMask
,pacman.model.graphs.machine.MachineEdge
, int) -> iterable(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( pacman.model.routing_info.BaseKeyAndMask
)
- keys_and_masks (iterable(
-
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.key_allocator_constraints.
FlexiKeyFieldConstraint
(fields)[source]¶ -
Constraint that indicates fields in the mask without a specific size or position.
-
fields
¶
-
-
Constraint to allow the same keys to be allocated to multiple edges via partitions.
Parameters: other_partitions – the other edges which keys are shared with.
-
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.fixed_vertex_atoms_constraint.
FixedVertexAtomsConstraint
(size)[source]¶ -
A constraint which specifies the exact number of atoms on each division of a vertex.
Parameters: size (int) – The exact number of atoms to split the vertex into -
size
¶ The exact number of atoms to split the vertex into
Return type: int
-
-
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.graphs.application.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.graphs.application.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.
FixedVertexAtomsConstraint
(size)[source]¶ -
A constraint which specifies the exact number of atoms on each division of a vertex.
Parameters: size (int) – The exact number of atoms to split the vertex into -
size
¶ The exact number of atoms to split the vertex into
Return type: int
-
-
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.graphs.application.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.graphs.application.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 if that is not constrained Return type: int or None 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 if that is not constrained Return type: int or None 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.graphs.application.application_edge.
ApplicationEdge
(pre_vertex, post_vertex, traffic_type=<EdgeTrafficType.MULTICAST: 1>, label=None, machine_edge_type=<class 'pacman.model.graphs.machine.machine_edge.MachineEdge'>)[source]¶ Bases:
pacman.model.graphs.abstract_edge.AbstractEdge
A simple implementation of an application edge.
Parameters: - pre_vertex (
pacman.model.graphs.application.ApplicationVertex
) – the application vertex at the start of the edge - post_vertex (
pacman.model.graphs.application.ApplicationVertex
) – the application vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.EdgeTrafficType
) – The type of the traffic on the edge - label (str) – The name of the edge
-
create_machine_edge
(pre_vertex, post_vertex, label)[source]¶ Create a machine edge between two machine vertices
Parameters: - pre_vertex (
pacman.model.graphs.machine.MachineVertex
) – The machine vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.MachineVertex
) – The machine vertex at the end of the edge - label (str) – label of the edge
Returns: The created machine edge
Return type: - pre_vertex (
-
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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
- pre_vertex (
-
class
pacman.model.graphs.application.application_fpga_vertex.
ApplicationFPGAVertex
(n_atoms, fpga_id, fpga_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_fpga.AbstractFPGA
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
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
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
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
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.application.application_graph.
ApplicationGraph
(label)[source]¶ Bases:
pacman.model.graphs.impl.graph.Graph
An application-level abstraction of a graph.
-
class
pacman.model.graphs.application.application_outgoing_edge_partition.
ApplicationOutgoingEdgePartition
(identifier, constraints=None, label=None)[source]¶ Bases:
pacman.model.graphs.impl.outgoing_edge_partition.OutgoingEdgePartition
Edge partition for the application graph.
-
class
pacman.model.graphs.application.application_spinnaker_link_vertex.
ApplicationSpiNNakerLinkVertex
(n_atoms, spinnaker_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_spinnaker_link.AbstractSpiNNakerLink
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
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
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.application.application_vertex.
ApplicationVertex
(label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.abstract_vertex.AbstractVertex
A vertex that can be broken down into a number of smaller vertices based on the resources that the vertex requires.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex
- max_atoms_per_core (int) – the max number of atoms that can be placed on a core, used in partitioning
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
class
pacman.model.graphs.application.
ApplicationEdge
(pre_vertex, post_vertex, traffic_type=<EdgeTrafficType.MULTICAST: 1>, label=None, machine_edge_type=<class 'pacman.model.graphs.machine.machine_edge.MachineEdge'>)[source]¶ Bases:
pacman.model.graphs.abstract_edge.AbstractEdge
A simple implementation of an application edge.
Parameters: - pre_vertex (
pacman.model.graphs.application.ApplicationVertex
) – the application vertex at the start of the edge - post_vertex (
pacman.model.graphs.application.ApplicationVertex
) – the application vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.EdgeTrafficType
) – The type of the traffic on the edge - label (str) – The name of the edge
-
create_machine_edge
(pre_vertex, post_vertex, label)[source]¶ Create a machine edge between two machine vertices
Parameters: - pre_vertex (
pacman.model.graphs.machine.MachineVertex
) – The machine vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.MachineVertex
) – The machine vertex at the end of the edge - label (str) – label of the edge
Returns: The created machine edge
Return type: - pre_vertex (
-
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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
- pre_vertex (
-
class
pacman.model.graphs.application.
ApplicationFPGAVertex
(n_atoms, fpga_id, fpga_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_fpga.AbstractFPGA
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
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
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
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
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.application.
ApplicationGraph
(label)[source]¶ Bases:
pacman.model.graphs.impl.graph.Graph
An application-level abstraction of a graph.
-
class
pacman.model.graphs.application.
ApplicationOutgoingEdgePartition
(identifier, constraints=None, label=None)[source]¶ Bases:
pacman.model.graphs.impl.outgoing_edge_partition.OutgoingEdgePartition
Edge partition for the application graph.
-
class
pacman.model.graphs.application.
ApplicationVertex
(label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.abstract_vertex.AbstractVertex
A vertex that can be broken down into a number of smaller vertices based on the resources that the vertex requires.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex
- max_atoms_per_core (int) – the max number of atoms that can be placed on a core, used in partitioning
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
class
pacman.model.graphs.application.
ApplicationSpiNNakerLinkVertex
(n_atoms, spinnaker_link_id, board_address=None, label=None, constraints=None, max_atoms_per_core=9223372036854775807)[source]¶ Bases:
pacman.model.graphs.application.application_vertex.ApplicationVertex
,pacman.model.graphs.abstract_spinnaker_link.AbstractSpiNNakerLink
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
-
create_machine_vertex
(vertex_slice, resources_required, label=None, constraints=None)[source]¶ Create a machine vertex from this application vertex
Parameters: - vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
- resources_required (ResourceContainer) – the resources used by the machine vertex
- label (str or None) – human readable label for the machine vertex
- constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
-
get_resources_used_by_atoms
(vertex_slice)[source]¶ Get the separate resource requirements for a range of atoms
Parameters: vertex_slice (Slice) – the low value of atoms to calculate resources from Returns: a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource Return type: ResourceContainer Raises: None – this method does not raise any known exception
-
n_atoms
¶ The number of atoms in the vertex
Return type: int
-
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.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.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( pacman.model.constraints.AbstractConstraint
)) – the constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: the constraints Return type: iterable( pacman.model.constraints.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
) – 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.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( pacman.model.constraints.AbstractConstraint
)) – the constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: the constraints Return type: iterable( pacman.model.constraints.AbstractConstraint
)Raises: None – Raises no known exceptions
-
-
class
pacman.model.graphs.common.
EdgeTrafficType
[source]¶ Bases:
enum.IntEnum
Indicates the traffic type of an Edge in a graph
-
FIXED_ROUTE
= 2¶
-
MULTICAST
= 1¶
-
SDRAM
= 3¶
-
-
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
) – 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.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.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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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.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: - 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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 outgoing edge partition.
Parameters: edge ( pacman.model.graphs.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( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge 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.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.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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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.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: - 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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 outgoing edge partition.
Parameters: edge ( pacman.model.graphs.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( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge 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.MachineVertex
) – the vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.MachineVertex
) – the vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.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: 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.AbstractFPGA
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: 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.AbstractSpiNNakerLink
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: 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.abstract_vertex.AbstractVertex
A machine graph vertex.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
resources_required
¶ The resources required by the vertex
Return type: 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: 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.MachineVertex
) – the vertex at the start of the edge - post_vertex (
pacman.model.graphs.machine.MachineVertex
) – the vertex at the end of the edge - traffic_type (
pacman.model.graphs.common.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: 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.AbstractFPGA
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: 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.AbstractSpiNNakerLink
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: 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.abstract_vertex.AbstractVertex
A machine graph vertex.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
resources_required
¶ The resources required by the vertex
Return type: 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: 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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
-
class
pacman.model.graphs.abstract_fpga.
AbstractFPGA
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to an FPGA.
Note: It is expected that everything that is an instance of AbstractFPGA is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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 to the graph.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the graph.
Parameters: constraints (list( 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.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 (iterable(
pacman.model.graphs.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 (iterable(
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph.
Parameters: outgoing_edge_partition ( pacman.model.graphs.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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (iterable(
pacman.model.graphs.AbstractVertex
)) – The vertices to addRaises: - PacmanInvalidParameterException – If any vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
constraints
¶ The constraints of the graph.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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.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: - 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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 to the outgoing edge partition.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the outgoing edge partition.
Parameters: constraints (iterable( AbstractConstraint
)) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the outgoing edge partition.
Parameters: edge ( pacman.model.graphs.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 outgoing edge partition.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in this outgoing edge partition.
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge partition compared to other partitions.
Return type: int
-
-
class
pacman.model.graphs.abstract_spinnaker_link.
AbstractSpiNNakerLink
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to a SpiNNaker Link.
Note: It is expected that everything that is an instance of AbstractSpiNNakerLink is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to.
-
-
class
pacman.model.graphs.abstract_vertex.
AbstractVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
A vertex in a graph.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
addedToGraph
()[source]¶ Records that the vertex has been added to a graph
Raises: PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
label
¶ Returns the current label to the vertex.
This label could change when the vertex is added to the graph. :return: The label :rtype: str
-
set_label
(label)[source]¶ Changes the label for a vertex NOT yet ADDED to a graph
Parameters: label – new value for the label Raises: PacmanConfigurationException – If there is an attempt to change the label once the vertex has been added to a graph
-
class
pacman.model.graphs.abstract_virtual.
AbstractVirtual
[source]¶ Bases:
object
An Object (most likely a vertex) which exists outside of the machine, allowing a graph to formally participate in I/O.
Note: It is expected that everything that is an instance of AbstractVirtual is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
-
class
pacman.model.graphs.
AbstractFPGA
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to an FPGA.
Note: It is expected that everything that is an instance of AbstractFPGA is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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 to the graph.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the graph.
Parameters: constraints (list( 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.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 (iterable(
pacman.model.graphs.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 (iterable(
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph.
Parameters: outgoing_edge_partition ( pacman.model.graphs.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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (iterable(
pacman.model.graphs.AbstractVertex
)) – The vertices to addRaises: - PacmanInvalidParameterException – If any vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
constraints
¶ The constraints of the graph.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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.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: - 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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 to the outgoing edge partition.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the outgoing edge partition.
Parameters: constraints (iterable( AbstractConstraint
)) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the outgoing edge partition.
Parameters: edge ( pacman.model.graphs.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 outgoing edge partition.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in this outgoing edge partition.
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge partition compared to other partitions.
Return type: int
-
-
class
pacman.model.graphs.
AbstractSpiNNakerLink
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to a SpiNNaker Link.
Note: It is expected that everything that is an instance of AbstractSpiNNakerLink is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to.
-
-
class
pacman.model.graphs.
AbstractVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
A vertex in a graph.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.PacmanInvalidParameterException –
- If one of the constraints is not valid
-
addedToGraph
()[source]¶ Records that the vertex has been added to a graph
Raises: PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
label
¶ Returns the current label to the vertex.
This label could change when the vertex is added to the graph. :return: The label :rtype: str
-
set_label
(label)[source]¶ Changes the label for a vertex NOT yet ADDED to a graph
Parameters: label – new value for the label Raises: PacmanConfigurationException – If there is an attempt to change the label once the vertex has been added to a graph
-
class
pacman.model.graphs.
AbstractVirtual
[source]¶ Bases:
object
An Object (most likely a vertex) which exists outside of the machine, allowing a graph to formally participate in I/O.
Note: It is expected that everything that is an instance of AbstractVirtual is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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.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.graphs.machine.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.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(
pacman.model.placements.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( pacman.model.placements.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(tuple(int, int, int))
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graphs.machine.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.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: 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( pacman.model.placements.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.graphs.machine.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.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(
pacman.model.placements.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( pacman.model.placements.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(tuple(int, int, int))
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graphs.machine.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.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: 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( pacman.model.placements.Placement
)Raises: None – does not raise any known exceptions
-
class
pacman.model.resources.abstract_sdram.
AbstractSDRAM
[source]¶ Bases:
object
Represents an amount of SDRAM used on a chip in the machine.
-
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
class
pacman.model.resources.constant_sdram.
ConstantSDRAM
(sdram)[source]¶ Bases:
pacman.model.resources.abstract_sdram.AbstractSDRAM
Represents an amount of SDRAM used on a chip in the machine.
This is used when the amount of SDRAM needed is not effected by runtime
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised -
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
class
pacman.model.resources.core_resource.
CoreResource
(chip, n_cores)[source]¶ Bases:
object
Represents the number of cores that need to be allocated.
Parameters: - n_cores (int) – The number of cores to allocate
- chip (
spinn_machine.Chip
) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
n_cores
¶
-
class
pacman.model.resources.cpu_cycles_per_tick_resource.
CPUCyclesPerTickResource
(cycles)[source]¶ Bases:
object
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.iptag_resource.
IPtagResource
(ip_address, port, strip_sdp, tag=None, traffic_identifier='DEFAULT')[source]¶ Bases:
object
Represents the ability to have a SpiNNaker machine send messages to you during execution.
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 or None) – 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
-
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 IP tag
-
class
pacman.model.resources.pre_allocated_resource_container.
PreAllocatedResourceContainer
(specific_sdram_usage=None, specific_core_resources=None, core_resources=None, specific_iptag_resources=None, specific_reverse_iptag_resources=None)[source]¶ Bases:
object
Container object for preallocated resources
Parameters: - specific_sdram_usage (iterable(
pacman.model.resources.SpecificChipSDRAMResource
)) – iterable of SpecificSDRAMResource which states that specific chips have missing SDRAM - specific_core_resources (iterable(
pacman.model.resources.SpecificCoreResource
)) – states which cores have been preallocated - core_resources (iterable(
pacman.model.resources.CoreResource
)) – states a number of cores have been preallocated but don’t care which ones they are
-
core_resources
¶
-
specific_core_resources
¶
-
specific_iptag_resources
¶
-
specific_reverse_iptag_resources
¶
-
specific_sdram_usage
¶
- specific_sdram_usage (iterable(
-
class
pacman.model.resources.resource_container.
ResourceContainer
(dtcm=None, sdram=None, cpu_cycles=None, iptags=None, reverse_iptags=None)[source]¶ Bases:
object
Container for the types of resources so that ordering is no longer a problem.
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(
pacman.models.resources.iptag_resource.IPtagResource
)) – the IP tags required - reverse_iptags (None or list(
pacman.models.resources.reverse_iptag_resource.ReverseIPtagResource
)) – the reverse IP tags 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:
object
Represents the ability to talk to a SpiNNaker machine by sending UDP packets to it during execution.
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
-
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.specific_board_iptag_resource.
SpecificBoardTagResource
(board, ip_address, port, strip_sdp, tag=None, traffic_identifier='DEFAULT')[source]¶ Bases:
object
A resource that allocates a tag on a specific board before the class needing it has been built.
Parameters: - board (str) – The IP address of the board to which this tag is to be associated with
- 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
-
board
¶ The board IP address that this tag is to reside on
Returns: IP address
-
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 IP tag
-
class
pacman.model.resources.specific_board_reverse_iptag_resource.
ReverseIPtagResource
(board, port=None, sdp_port=1, tag=None)[source]¶ Bases:
object
Represents the ability to talk to a specific board of a SpiNNaker machine by sending UDP packets to it during execution.
Parameters: - board (str) – A board IP address which is where this reverse IP tag is to be placed
- 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
-
board
¶ A board IP address which is where this reverse IP tag is to be placed.
Returns: str
-
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.specific_chip_sdram_resource.
SpecificChipSDRAMResource
(chip, sdram_usage)[source]¶ Bases:
object
Represents the SDRAM required for this Chip
Parameters: - sdram_usage (AbstractSDRAM The amount of SDRAM in bytes needed to be preallocated) – The amount of SDRAM in bytes needed to be pre-allocated
- chip (
spinn_machine.Chip
) – chip of where the SDRAM is to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Returns: The chip for which it is required, and the amount of SDRAM required thereon, in bytes.
-
sdram_usage
¶
-
class
pacman.model.resources.specific_core_resource.
SpecificCoreResource
(chip, cores)[source]¶ Bases:
object
Represents specific cores that need to be allocated.
Parameters: - cores (iterable(int)) – The specific cores that need to be allocated (list of processor IDs)
- chip (
spinn_machine.Chip
) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
cores
¶
-
class
pacman.model.resources.variable_sdram.
VariableSDRAM
(fixed_sdram, per_timestep_sdram)[source]¶ Bases:
pacman.model.resources.abstract_sdram.AbstractSDRAM
Represents an amount of SDRAM used on a chip in the machine.
This is where the usage increase as the run time increases
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised -
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
class
pacman.model.resources.
AbstractSDRAM
[source]¶ Bases:
object
Represents an amount of SDRAM used on a chip in the machine.
-
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
class
pacman.model.resources.
ConstantSDRAM
(sdram)[source]¶ Bases:
pacman.model.resources.abstract_sdram.AbstractSDRAM
Represents an amount of SDRAM used on a chip in the machine.
This is used when the amount of SDRAM needed is not effected by runtime
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised -
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
class
pacman.model.resources.
CoreResource
(chip, n_cores)[source]¶ Bases:
object
Represents the number of cores that need to be allocated.
Parameters: - n_cores (int) – The number of cores to allocate
- chip (
spinn_machine.Chip
) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
n_cores
¶
-
class
pacman.model.resources.
CPUCyclesPerTickResource
(cycles)[source]¶ Bases:
object
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:
object
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:
object
Represents the ability to have a SpiNNaker machine send messages to you during execution.
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 or None) – 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
-
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 IP tag
-
class
pacman.model.resources.
ResourceContainer
(dtcm=None, sdram=None, cpu_cycles=None, iptags=None, reverse_iptags=None)[source]¶ Bases:
object
Container for the types of resources so that ordering is no longer a problem.
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(
pacman.models.resources.iptag_resource.IPtagResource
)) – the IP tags required - reverse_iptags (None or list(
pacman.models.resources.reverse_iptag_resource.ReverseIPtagResource
)) – the reverse IP tags 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:
object
Represents the ability to talk to a SpiNNaker machine by sending UDP packets to it during execution.
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
-
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.
PreAllocatedResourceContainer
(specific_sdram_usage=None, specific_core_resources=None, core_resources=None, specific_iptag_resources=None, specific_reverse_iptag_resources=None)[source]¶ Bases:
object
Container object for preallocated resources
Parameters: - specific_sdram_usage (iterable(
pacman.model.resources.SpecificChipSDRAMResource
)) – iterable of SpecificSDRAMResource which states that specific chips have missing SDRAM - specific_core_resources (iterable(
pacman.model.resources.SpecificCoreResource
)) – states which cores have been preallocated - core_resources (iterable(
pacman.model.resources.CoreResource
)) – states a number of cores have been preallocated but don’t care which ones they are
-
core_resources
¶
-
specific_core_resources
¶
-
specific_iptag_resources
¶
-
specific_reverse_iptag_resources
¶
-
specific_sdram_usage
¶
- specific_sdram_usage (iterable(
-
class
pacman.model.resources.
SpecificChipSDRAMResource
(chip, sdram_usage)[source]¶ Bases:
object
Represents the SDRAM required for this Chip
Parameters: - sdram_usage (AbstractSDRAM The amount of SDRAM in bytes needed to be preallocated) – The amount of SDRAM in bytes needed to be pre-allocated
- chip (
spinn_machine.Chip
) – chip of where the SDRAM is to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
get_value
()[source]¶ Returns: The chip for which it is required, and the amount of SDRAM required thereon, in bytes.
-
sdram_usage
¶
-
class
pacman.model.resources.
SpecificCoreResource
(chip, cores)[source]¶ Bases:
object
Represents specific cores that need to be allocated.
Parameters: - cores (iterable(int)) – The specific cores that need to be allocated (list of processor IDs)
- chip (
spinn_machine.Chip
) – chip of where these cores are to be allocated
Raises: None – No known exceptions are raised
-
chip
¶
-
cores
¶
-
pacman.model.resources.
SpecificBoardIPtagResource
¶ alias of
pacman.model.resources.specific_board_iptag_resource.SpecificBoardTagResource
-
pacman.model.resources.
SpecificBoardReverseIPtagResource
¶ alias of
pacman.model.resources.specific_board_reverse_iptag_resource.ReverseIPtagResource
-
class
pacman.model.resources.
VariableSDRAM
(fixed_sdram, per_timestep_sdram)[source]¶ Bases:
pacman.model.resources.abstract_sdram.AbstractSDRAM
Represents an amount of SDRAM used on a chip in the machine.
This is where the usage increase as the run time increases
Parameters: sdram (int) – The amount of SDRAM in bytes Raises: None – No known exceptions are raised -
fixed
¶ Returns the fixed SDRAM cost
-
get_total_sdram
(n_timesteps)[source]¶ The total SDRAM.
Parameters: n_timesteps (int) – number of timesteps to cost for Returns:
-
per_timestep
¶ Returns extra SDRAM cost for each additional timestep
Warning may well be zero
-
-
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.graphs.impl.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: tuple(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
pacman.model.routing_info.AbstractMachinePartitionNKeysMap
-
n_keys_for_partition
(partition)[source]¶ The number of keys required by the given partition
Parameters: partition ( pacman.model.graphs.impl.OutgoingEdgePartition
) – The partition to set the number of keys forReturns: The number of keys required by the partition Return type: int
-
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.graphs.impl.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(
pacman.model.routing_info.BaseKeyAndMask
)) – The keys allocated to the machine partition - partition (
pacman.model.graphs.impl.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(
-
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( 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.graphs.impl.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 (pre)vertex
Parameters: - vertex – The vertex which the partition starts at
- partition_id – The ID of the partition for which to get the routing information
Returns: The routing key of the partition
Return type: int
-
get_routing_info_for_edge
(edge)[source]¶ Get routing information for an edge
Parameters: edge – The edge to search for
-
get_routing_info_from_partition
(partition)[source]¶ Get the routing information for a given partition.
Parameters: partition ( pacman.model.graphs.impl.OutgoingEdgePartition
) – The partition to obtain routing informaton about.Returns: the partition_routing_info for the partition, if any exists Return type: pacman.model.routing_info.PartitionRoutingInfo
or None
-
-
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.graphs.impl.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: tuple(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
pacman.model.routing_info.AbstractMachinePartitionNKeysMap
-
n_keys_for_partition
(partition)[source]¶ The number of keys required by the given partition
Parameters: partition ( pacman.model.graphs.impl.OutgoingEdgePartition
) – The partition to set the number of keys forReturns: The number of keys required by the partition Return type: int
-
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.graphs.impl.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(
pacman.model.routing_info.BaseKeyAndMask
)) – The keys allocated to the machine partition - partition (
pacman.model.graphs.impl.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(
-
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( 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.graphs.impl.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 (pre)vertex
Parameters: - vertex – The vertex which the partition starts at
- partition_id – The ID of the partition for which to get the routing information
Returns: The routing key of the partition
Return type: int
-
get_routing_info_for_edge
(edge)[source]¶ Get routing information for an edge
Parameters: edge – The edge to search for
-
get_routing_info_from_partition
(partition)[source]¶ Get the routing information for a given partition.
Parameters: partition ( pacman.model.graphs.impl.OutgoingEdgePartition
) – The partition to obtain routing informaton about.Returns: the partition_routing_info for the partition, if any exists Return type: pacman.model.routing_info.PartitionRoutingInfo
or None
-
-
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 (
pacman.model.routing_table_by_partition.MulticastRoutingTableByPartitionEntry
) – 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
- entry (
-
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(int)) – the edges this path entry goes down, each of which is between 0 and 5
- outgoing_processors (iterable(int)) – the processors this path entry goes to, each of which is between 0 and 17
- incoming_processor (int) – the direction this entry came from (between 0 and 17)
- incoming_link (int) – the direction this entry came from in link (between 0 and 5)
-
defaultable
¶ The defaultable status of the entry
-
incoming_link
¶ The source link for this path entry
Return type: int or None
-
incoming_processor
¶ The source processor
Return type: int or Non
-
link_ids
¶ The destination links of the entry
Return type: set(int)
-
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
-
processor_ids
¶ The destination processors of the entry
Return type: set(int)
-
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 (
pacman.model.routing_table_by_partition.MulticastRoutingTableByPartitionEntry
) – 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
- entry (
-
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(int)) – the edges this path entry goes down, each of which is between 0 and 5
- outgoing_processors (iterable(int)) – the processors this path entry goes to, each of which is between 0 and 17
- incoming_processor (int) – the direction this entry came from (between 0 and 17)
- incoming_link (int) – the direction this entry came from in link (between 0 and 5)
-
defaultable
¶ The defaultable status of the entry
-
incoming_link
¶ The source link for this path entry
Return type: int or None
-
incoming_processor
¶ The source processor
Return type: int or Non
-
link_ids
¶ The destination links of the entry
Return type: set(int)
-
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
-
processor_ids
¶ The destination processors of the entry
Return type: set(int)
-
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(
spinn_machine.MulticastRoutingEntry
)) – The 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( 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( 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( 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(
spinn_machine.MulticastRoutingEntry
)) – The 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( 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( 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( pacman.model.routing_tables.MulticastRoutingTable
)Raises: None – does not raise any known exceptions
-
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.graphs.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 IP tag
Parameters: - reverse_ip_tag (
spinn_machine.tags.ReverseIPTag
) – The tag to add - vertex (
pacman.model.graphs.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.graphs.machine.MachineVertex
) – The vertex to get the tags forReturns: An iterable of IPTag, or None if the vertex has no tags Return type: iterable( spinn_machine.tags.IPTag
) or None
Get the Reverse IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex to get the tags forReturns: An iterable of ReverseIPTag, or None if the vertex has no tags Return type: iterable( spinn_machine.tags.ReverseIPTag
) or None
The IP tags assigned
Returns: iterable of IPTag Return type: iterable( spinn_machine.tags.IPTag
)
The reverse IP tags assigned
Returns: iterable of ReverseIPTag Return type: iterable( 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.graphs.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 IP tag
Parameters: - reverse_ip_tag (
spinn_machine.tags.ReverseIPTag
) – The tag to add - vertex (
pacman.model.graphs.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.graphs.machine.MachineVertex
) – The vertex to get the tags forReturns: An iterable of IPTag, or None if the vertex has no tags Return type: iterable( spinn_machine.tags.IPTag
) or None
Get the Reverse IP Tags assigned to a given machine vertex
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex to get the tags forReturns: An iterable of ReverseIPTag, or None if the vertex has no tags Return type: iterable( spinn_machine.tags.ReverseIPTag
) or None
The IP tags assigned
Returns: iterable of IPTag Return type: iterable( spinn_machine.tags.IPTag
)
The reverse IP tags assigned
Returns: iterable of ReverseIPTag Return type: iterable( spinn_machine.tags.ReverseIPTag
)
Module contents¶
pacman.operations package¶
Subpackages¶
-
class
pacman.operations.algorithm_reports.convert_to_json_machine_graph.
ConvertToJsonMachineGraph
[source]¶ Bases:
object
Converter from MulticastRoutingTables to json
-
static
do_convert
(machine_graph, file_path, progress=None)[source]¶ Runs the code to write the machine in Java readable JSON.
Parameters: - machine_graph (
pacman.model.graphs.machine.MachineGraph
) – The machine_graph to place - file_path (str) – Location to write file to. Warning will overwrite!
- machine_graph (
-
static
-
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. :param report_folder: the folder to which the reports are being written :param hostname: the machine’s hostname to which the placer worked on
-
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_compressed_summary_report
(report_folder, routing_tables, hostname, machine)[source]¶ Generates a text file of routing summaries
Parameters: - report_folder – the report folder to store this value
- routing_tables – the original routing tables
- hostname – the machine’s hostname to which the placer worked on
- machine – the python machine object
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_report_from_compressed_router_tables
(report_folder, routing_tables)[source]¶ Parameters: - report_folder – the report folder to store this value
- routing_tables – the original 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: - report_folder – the report folder to store this value
- routing_tables – the original routing tables
- hostname – the machine’s hostname to which the placer worked on
- routing_infos –
- machine_graph –
- placements –
- machine – the python machine object
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_report_from_router_tables
(report_folder, routing_tables)[source]¶ Parameters: - report_folder – the report folder to store this value
- routing_tables – the original routing tables
Return type: None
-
pacman.operations.algorithm_reports.reports.
router_summary_report
(report_folder, routing_tables, hostname, machine)[source]¶ Generates a text file of routing summaries
Parameters: - report_folder – the report folder to store this value
- routing_tables – the original routing tables
- hostname – the machine’s hostname to which the placer worked on
- machine – the python machine object
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, plan_n_timesteps, data_n_timesteps)[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
- plan_n_timesteps – The number of timesteps for which placer reserved space.
- data_n_timesteps – The number of timesteps for which data can be saved on the machine.
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.algorithm_reports.routing_compression_checker_report.
calc_remainders
(o_code, c_code)[source]¶
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
codify
(route, length=32)[source]¶ This method discovers all the routing keys covered by this route.
Starts of with the assumption that the key is always covered.
Whenever a mask bit is zero the list of covered keys is doubled to include both the key with a zero and a one at that place.
Parameters: - route (
spinn_machine.MulticastRoutingEntry
) – single routing Entry - length (int) – length in bits of the key and mask (defaults to 32)
Returns: set of routing_keys covered by this route
Return type: str
- route (
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
codify_table
(table, length=32)[source]¶
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
compare_route
(o_route, compressed_dict, o_code=None, start=0, f=None)[source]¶
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
compare_tables
(original, compressed)[source]¶ Compares the two tables without generating any out
Parameters: - original – The orginal routing tables
- compressed – The compressed routing tables. Which will be considered in order.
Raises: PacmanRoutingException if there is any error
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
covers
(o_code, c_code)[source]¶
-
pacman.operations.algorithm_reports.routing_compression_checker_report.
generate_routing_compression_checker_report
(report_folder, routing_tables, compressed_routing_tables)[source]¶ Make a full report of how the compressed covers all routes in the and uncompressed routing table
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
-
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
-
exception
pacman.operations.chip_id_allocator_algorithms.malloc_based_chip_id_allocator.
NoFPGALink
(vertex)[source]¶
-
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
Collection of functions which together validate routes.
-
class
pacman.operations.multi_cast_router_check_functionality.valid_routes_checker.
PlacementTuple
(x, y, p)¶ Bases:
tuple
Create new instance of PlacementTuple(x, y, p)
-
p
¶ Alias for field number 2
-
x
¶ Alias for field number 0
-
y
¶ Alias for field number 1
-
-
pacman.operations.multi_cast_router_check_functionality.valid_routes_checker.
validate_routes
(machine_graph, placements, routing_infos, routing_tables, machine, graph_mapper=None)[source]¶ Go though the placements given and check that the routing entries within the routing tables support reach the correction destinations as well as not producing any cycles.
Parameters: - machine_graph – the graph
- placements – the placements container
- routing_infos – the routing info container
- routing_tables – the routing tables generated by the routing algorithm
- graph_mapper – the mapping between graphs or none if only using a machine graph
- machine (spinn_machine.Machine object) – the python machine object
Return type: None
Raises: PacmanRoutingException – when either no routing table entry is found by the search on a given router, or a cycle is detected
-
pacman.operations.multi_cast_router_check_functionality.
validate_routes
(machine_graph, placements, routing_infos, routing_tables, machine, graph_mapper=None)[source]¶ Go though the placements given and check that the routing entries within the routing tables support reach the correction destinations as well as not producing any cycles.
Parameters: - machine_graph – the graph
- placements – the placements container
- routing_infos – the routing info container
- routing_tables – the routing tables generated by the routing algorithm
- graph_mapper – the mapping between graphs or none if only using a machine graph
- machine (spinn_machine.Machine object) – the python machine object
Return type: None
Raises: PacmanRoutingException – when either no routing table entry is found by the search on a given router, or a cycle is detected
-
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.spreader_placer.
SpreaderPlacer
[source]¶ Bases:
pacman.operations.placer_algorithms.one_to_one_placer.OneToOnePlacer
-
ITERATIONS
= 4¶
-
STEPS
= 4¶
-
-
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.
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.
SpreaderPlacer
[source]¶ Bases:
pacman.operations.placer_algorithms.one_to_one_placer.OneToOnePlacer
-
ITERATIONS
= 4¶
-
STEPS
= 4¶
-
-
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.
Parameters: - xpos (int) – the x coordinate on the generated curve
- ypos (int) – the y coordinate on the generated curve
- xchange (int) – the change in x coordinate on the generated curve
- ychange (int) – the change in y coordinate on the generated curve
-
move_forward
()[source]¶ Move forward in the generation of a Hilbert curve
Returns: the x,y coordinates on the generated curve
-
turn_left
(angle)[source]¶ Turn left in the generation of a Hilbert curve
Parameters: angle (int) – determines the direction in which the curve turns Returns: the x,y coordinates on the generated curve
-
turn_right
(angle)[source]¶ Turn right in the generation of a Hilbert curve
Parameters: angle (int) – determines the direction in which the curve turns Returns: the x,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 (
pacman.model.placements.Placements
) – Placements of vertices on the machine - placements_copy (
pacman.model.placements.Placements
) – memory copy of placements of vertices on the machine
Returns: True if the placements are the same
Return type: bool
- placements (
-
-
class
pacman.operations.rigged_algorithms.
HilbertPlacer
[source]¶ Bases:
object
A simple placing algorithm using the Hilbert space-filling curve, translated from RIG.
-
class
pacman.operations.rigged_algorithms.
HilbertState
(xpos=0, ypos=0, xchange=1, ychange=0)[source]¶ Bases:
object
A mutable self object for the Hilbert placer algorithm.
Parameters: - xpos (int) – the x coordinate on the generated curve
- ypos (int) – the y coordinate on the generated curve
- xchange (int) – the change in x coordinate on the generated curve
- ychange (int) – the change in y coordinate on the generated curve
-
move_forward
()[source]¶ Move forward in the generation of a Hilbert curve
Returns: the x,y coordinates on the generated curve
-
turn_left
(angle)[source]¶ Turn left in the generation of a Hilbert curve
Parameters: angle (int) – determines the direction in which the curve turns Returns: the x,y coordinates on the generated curve
-
turn_right
(angle)[source]¶ Turn right in the generation of a Hilbert curve
Parameters: angle (int) – determines the direction in which the curve turns Returns: the x,y coordinates on the generated curve
-
x_pos
¶
-
y_pos
¶
-
class
pacman.operations.rigged_algorithms.
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 (
pacman.model.placements.Placements
) – Placements of vertices on the machine - placements_copy (
pacman.model.placements.Placements
) – memory copy of placements of vertices on the machine
Returns: True if the placements are the same
Return type: bool
- placements (
-
-
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¶
-
Neighbour Exploring Routing (NER) algorithm from J. Navaridas et al.
Algorithm refrence: J. Navaridas et al. SpiNNaker: Enhanced multicast routing, Parallel Computing (2014).
http://dx.doi.org/10.1016/j.parco.2015.01.002
Based on https://github.com/project-rig/rig/blob/master/rig/place_and_route/route/ner.py https://github.com/project-rig/rig/blob/master/rig/geometry.py https://github.com/project-rig/rig/blob/master/rig/place_and_route/route/utils.py
An explicit representation of a routing tree in a machine.
This representation of a route explicitly describes a tree-structure and the complete path taken by a route. This is used during place and route in preference to a set of RoutingTableEntry tuples since it is more easily verified and more accurately represents the problem at hand.
Based on https://github.com/project-rig/rig/blob/master/rig/place_and_route/routing_tree.py
-
class
pacman.operations.router_algorithms.routing_tree.
RoutingTree
(chip)[source]¶ Bases:
object
Explicitly defines a multicast route through a SpiNNaker machine.
Each instance represents a single hop in a route and recursively refers to following steps.
Parameters: chip (tuple(int,int)) – The chip the route is currently passing through. -
children
¶ A
iterable
of the next steps in the route represented by a (route, object) tuple.Note
Up until Rig 1.5.1, this structure used
set
s to store children. This was changed tolist
s since sets incur a large memory overhead and in practice the set-like behaviour of the list of children is not useful.The object indicates the intended destination of this step in the route. It may be one of:
RoutingTree
representing the continuation of the routing tree after following a given link.- A vertex (i.e. some other Python object) when the route terminates at the supplied vertex. Note that the direction may be None and so additional logic may be required to determine what core to target to reach the vertex.
Return type: iterable
-
chip
¶ The chip the route is currently passing through.
Return type: tuple(int,int)
-
traverse
()[source]¶ Traverse the tree yielding the direction taken to a node, the coordinates of that node and the directions leading from the Node.
Returns: (direction, (x, y), set(route)) Direction taken to reach a Node in the tree, the (x, y) coordinate of that Node and routes leading to children of the Node.
-
An novel algorithm for the minimisation of SpiNNaker’s multicast routing tables devised by Andrew Mundy.
SpiNNaker routing tables consist of entries made up of a 32-bit key, a 32-bit mask and a 24-bit route value. The key and mask of every entry act as a sieve for the keys found on incoming multicast packets. Each bit of the key-mask pair can be considered as matching 0, 1 or 2 values in the same bit of a multicast packet key:
Key Mask Matches Key Values Written 0
0
0
or1
X
0
1
0
0
1
1
1
1
1
0
Nothing !
If a packet matches the key-mask of an entry then the packet is transmitted to the cores and links indicated by the route field.
For example, if the table were:
Key Mask Route 0000
1111
North, North East 0111
0111
South
Which, from now on, will be written as:
0000 -> N NE
X111 -> S
Then any packets with the key 0000
would be sent out of the north and
north-east links. Any packets with the keys 0111
or 1111
would be sent
out of the south link only.
Entries in table are ordered, with entries at the top of the table having higher priority than those lower down the table. Only the highest priority entry which matches a packet is used. If, for example, the table were:
0000 -> N NE
1111 -> 1 2
X111 -> S
Then packets with the keys 0000
and 0111
would be treated as before.
However, packets with the key 1111
would be sent to cores 1 and 2 as only
the higher priority entry has effect.
Routing tables can be minimised by merging together entries with equivalent
routes. This is done by creating a new key-mask pair with an X
wherever the
key-mask pairs of any of the original entries differed.
For example, merging of the entries:
0000 -> N
0001 -> N
Would lead to the new entry:
000X -> N
Which would match any of the keys matched by the original entries but no more.
In contrast the merge of 0001
and 0010
would generate the new entry
00XX
which would match keys matched by either of the original entries but
also 0000
and 0011
.
Clearly, if we are to attempt to minimise tables such as:
0001 -> N
0010 -> N
0000 -> S, SE
0011 -> SE
We need a set of rules for:
- Where merged entries are to be inserted into the table
- Which merges are allowed
The algorithm implemented here, “Ordered Covering”, provides the following rule:
- The only merges allowed are those which:
- would not cause one of the entries in the merge to be “hidden” below an entry of lesser generality than the merged entry but which matched any of the same keys. For example, merging
0010
and0001
would not be allowed if the new entry would be placed below the existing entry000X
as this would “hide”0001
.- would not cause an entry “contained” within an entry of higher generality to be hidden by the insertion of a new entry. For example, if the entry
XXXX
had been formed by merging the entries0011
and1100
then merging of the entries1101
and1110
would not be allowed as it would cause the entry11XX
to be inserted aboveXXXX
in the table and would hide1100
.
Following these rules ensures that the minimised table will be functionally equivalent to the original table provided that the original table was invariant under reordering OR was provided in increasing order of generality.
As a heuristic:
- Routing tables are to be kept sorted in increasing order of “generality”, that is the number of
X``s in the entry. An entry with the key-mask pair ``00XX
must be placed below any entries with fewerX``s in their key-mask pairs (e.g., below ``0000
and000X
).
- New entries must also be inserted below any entries of the same generality. If
XX00
were already present in the table the new entry0XX0
must be inserted below it.
based on https://github.com/project-rig/rig/blob/master/rig/routing_table/ordered_covering.py
-
pacman.operations.router_compressors.mundys_router_compressor.ordered_covering.
minimise
(routing_table, target_length)[source]¶ Reduce the size of a routing table by merging together entries where possible and by removing any remaining default routes.
Warning
The input routing table must also include entries which could be removed and replaced by default routing.
Warning
It is assumed that the input routing table is not in any particular order and may be reordered into ascending order of generality (number of don’t cares/Xs in the key-mask) without affecting routing correctness. It is also assumed that if this table is unordered it is at least orthogonal (i.e., there are no two entries which would match the same key) and reorderable.
Parameters: - routing_table (Entry) – Routing entries to be merged.
- target_length (int or None) – Target length of the routing table; the minimisation procedure will halt once either this target is reached or no further minimisation is possible. If None then the table will be made as small as possible.
Returns: list(RoutingTableEntry)
Raises: MinimisationFailedError – If the smallest table that can be produced is larger than target_length.
-
pacman.operations.router_compressors.mundys_router_compressor.ordered_covering.
ordered_covering
(routing_table, target_length, aliases=None, no_raise=False)[source]¶ Reduce the size of a routing table by merging together entries where possible.
Warning
The input routing table must also include entries which could be removed and replaced by default routing.
Warning
It is assumed that the input routing table is not in any particular order and may be reordered into ascending order of generality (number of don’t cares/Xs in the key-mask) without affecting routing correctness. It is also assumed that if this table is unordered it is at least orthogonal (i.e., there are no two entries which would match the same key) and reorderable.
Parameters: - routing_table (Entry) – Routing entries to be merged.
- target_length (int or None) – Target length of the routing table; the minimisation procedure will halt once either this target is reached or no further minimisation is possible. If None then the table will be made as small as possible.
- aliases (dict((int, int): set((int, int))) – Dictionary of which keys and masks in the routing table are combinations of other (now removed) keys and masks; this allows us to consider only the keys and masks the user actually cares about when determining if inserting a new entry will break the correctness of the table. This should be supplied when using this method to update an already minimised table.
- no_raise (bool) – If False (the default) then an error will be raised if the table cannot be minimised to be smaller than target_length and target_length is not None. If True then a table will be returned regardless of the size of the final table.
Returns: list(RoutingTableEntry) , {(key, mask): {(key, mask), …}, …} new routing table, A new aliases dictionary.
Raises: MinimisationFailedError – If the smallest table that can be produced is larger than target_length.
based on https://github.com/project-rig/rig/blob/master/rig/routing_table/remove_default_routes.py
-
pacman.operations.router_compressors.mundys_router_compressor.remove_default_routes.
minimise
(table, target_length, check_for_aliases=True)[source]¶ Remove from the routing table any entries which could be replaced by default routing.
Parameters: - routing_table (RoutingTableEntry) – Routing entries to be merged.
- target_length – Target length of the routing table; the minimisation procedure will halt once either this target is reached or no further minimisation is possible. If None then the table will be made as small as possible. :type target_length: int or None
- check_for_aliases –
If True (the default), default-route candidates are checked for aliased entries before suggesting a route may be default routed. This check is required to ensure correctness in the general case but has a runtime complexity of O(N^2) in the worst case for N-entry tables.
If False, the alias-check is skipped resulting in O(N) runtime. This option should only be used if the supplied table is guaranteed not to contain any aliased entries.
Return type: list(RoutingTableEntry)
Raises: MinimisationFailedError – If the smallest table that can be produced is larger than target_length.
-
class
pacman.operations.router_compressors.mundys_router_compressor.routing_table_condenser.
MundyRouterCompressor
[source]¶ Bases:
pacman.operations.router_compressors.abstract_compressor.AbstractCompressor
Compressor from rig that has been tied into the main tool chain stack.
based on https://github.com/project-rig/rig/blob/master/rig/routing_table/utils.py
-
pacman.operations.router_compressors.mundys_router_compressor.utils.
intersect
(key_a, mask_a, key_b, mask_b)[source]¶ Return if key-mask pairs intersect (i.e., would both match some of the same keys).
For example, the key-mask pairs
00XX
and001X
both match the keys0010
and0011
(i.e., they do intersect):>>> intersect(0b0000, 0b1100, 0b0010, 0b1110) True
But the key-mask pairs
00XX
and11XX
do not match any of the same keys (i.e., they do not intersect):>>> intersect(0b0000, 0b1100, 0b1100, 0b1100) False
Parameters: - key_a –
- mask_a – The first key-mask pair
- key_b –
- mask_b – The second key-mask pair
Return type: bool
Returns: True if the two key-mask pairs intersect, otherwise False.
based on https://github.com/project-rig/
-
class
pacman.operations.router_compressors.abstract_compressor.
AbstractCompressor
(ordered=True)[source]¶ Bases:
object
-
MAX_SUPPORTED_LENGTH
= 1023¶
-
compress_tables
(router_tables, progress)[source]¶ Compress all the unordered routing tables
Tables who start of smaller than target_length are not compressed
Parameters: - router_tables (MulticastRoutingTable) – Routing tables
- progress – Progress bar to show while working
Tpye progress: ProgressBar
Returns: The compressed but still unordered routing tables
-
static
intersect
(key_a, mask_a, key_b, mask_b)[source]¶ Return if key-mask pairs intersect (i.e., would both match some of the same keys).
For example, the key-mask pairs
00XX
and001X
both match the keys``0010`` and0011
(i.e., they do intersect):>>> intersect(0b0000, 0b1100, 0b0010, 0b1110) True
But the key-mask pairs
00XX
and11XX
do not match any of the same keys (i.e., they do not intersect):>>> intersect(0b0000, 0b1100, 0b1100, 0b1100) False
Parameters: - key_a (int) – The key of first key-mask pair
- mask_a – The mask of first key-mask pair
- key_b (int) – The key of second key-mask pair
- mask_b – The mask of second key-mask pair
Returns: True if the two key-mask pairs intersect otherwise False.
Return type: bool
-
merge
(entry1, entry2)[source]¶ Merges two entries/triples into one that covers both
The assumption is that they both have the same known spinnaker_route
Parameters: Returns: Key, Mask, defaultable from merged entry
Return type: (int, int, bool)
-
ordered
¶
-
-
class
pacman.operations.router_compressors.checked_unordered_compressor.
CheckedUnorderedCompressor
[source]¶ Bases:
pacman.operations.router_compressors.unordered_compressor.UnorderedCompressor
-
class
pacman.operations.router_compressors.clash_compressor.
ClashCompressor
(ordered=True)[source]¶ Bases:
pacman.operations.router_compressors.abstract_compressor.AbstractCompressor
-
class
pacman.operations.router_compressors.pair_compressor.
PairCompressor
(ordered=True)[source]¶ Bases:
pacman.operations.router_compressors.abstract_compressor.AbstractCompressor
Routing Table compressor based on brute force. Finds mergable pairs to replace.
This algorithm assumes unordered routing tables and returns a possibly ordered routing tables. If unordered it can be used as a precompressor for another that makes use of order.
In the simplest format the algorithm is:
- For every pair of entries in the table
- If they have the same spinnaker_route
- Create a merged entry
- Check that does not intersect any entry with a different route
- Remove the two original entries
- Add the merged entry
- Start over
- If they have the same spinnaker_route
A slightly optimised algorithm is:
- Split the entries into buckets based on spinnaker route
- Process the buckets one at a time
- For each entry in the buckets
- For each other entry in the bucket
- Create a merge entry
- Make sure there is no clash with an entry in another bucket
- Replace the two entries and add the merge
- Start the bucket over
- If no merge found move the entry from the bucket to the result list
- For each other entry in the bucket
- When the bucket is empty the result list becomes the bucket
- For each entry in the buckets
A farther optimisation is to do the whole thing in place in a single list:
- Step 1 is sort the list by route in place
- Step 2 do the compression route by route using indexes into the array
- The array is split into 6 parts.
- 0 to _previous_pointer(-1): Entries in buckets that have already been compressed
- _previous_pointer to _write_pointer(-1): Finished entries for the current bucket
- _write_pointer to left(-1): Unused space due to previous merges
- left to right: Not yet finished entries from the current bucket
- right(+ 1) to _remaining_index(-1): Unused space due to previous merges
- _remaining_index to max_index(-1): Entries in buckets not yet compressed
- The array is split into 6 parts.
- Step 3 use only the entries up to _write_pointer(-1)
A farther optimisation is to uses order. The entries are sorted by route frequency from low to high. The results are considered ordered so previous routes are not considered.
The advantage is this allows all the entries from the most frequent route to be merged into a single entry. And the second most frequent only has to consider the most frequent routes.
Step 1 requires the counting of the frequency of routes and the sorting the routes based on this frequency. The current tie break between routes with the same frequency is the route but this is arbitrary at the algorithm level. This code does not use a dictionary to keep the code the same as the C.
Step 2 is change in that the previous entries (0 to _previous_pointer(-1)) are not considered for clash checking
-
compress_table
(router_table)[source]¶ Compresses all the entries for a single table.
Compressed the entries for this unordered table returning a new table with possibly fewer entries but still unordered
Parameters: router_table (MulticastRoutingTable) – Original Routing table for a single chip Returns: Compressed routing table for the same chip Return type: MulticastRoutingTable
- For every pair of entries in the table
-
class
pacman.operations.router_compressors.unordered_compressor.
UnorderedCompressor
[source]¶ Bases:
pacman.operations.router_compressors.pair_compressor.PairCompressor
-
class
pacman.operations.router_compressors.
AbstractCompressor
(ordered=True)[source]¶ Bases:
object
-
MAX_SUPPORTED_LENGTH
= 1023¶
-
compress_tables
(router_tables, progress)[source]¶ Compress all the unordered routing tables
Tables who start of smaller than target_length are not compressed
Parameters: - router_tables (MulticastRoutingTable) – Routing tables
- progress – Progress bar to show while working
Tpye progress: ProgressBar
Returns: The compressed but still unordered routing tables
-
static
intersect
(key_a, mask_a, key_b, mask_b)[source]¶ Return if key-mask pairs intersect (i.e., would both match some of the same keys).
For example, the key-mask pairs
00XX
and001X
both match the keys``0010`` and0011
(i.e., they do intersect):>>> intersect(0b0000, 0b1100, 0b0010, 0b1110) True
But the key-mask pairs
00XX
and11XX
do not match any of the same keys (i.e., they do not intersect):>>> intersect(0b0000, 0b1100, 0b1100, 0b1100) False
Parameters: - key_a (int) – The key of first key-mask pair
- mask_a – The mask of first key-mask pair
- key_b (int) – The key of second key-mask pair
- mask_b – The mask of second key-mask pair
Returns: True if the two key-mask pairs intersect otherwise False.
Return type: bool
-
merge
(entry1, entry2)[source]¶ Merges two entries/triples into one that covers both
The assumption is that they both have the same known spinnaker_route
Parameters: Returns: Key, Mask, defaultable from merged entry
Return type: (int, int, bool)
-
ordered
¶
-
-
class
pacman.operations.router_compressors.
CheckedUnorderedCompressor
[source]¶ Bases:
pacman.operations.router_compressors.unordered_compressor.UnorderedCompressor
-
class
pacman.operations.router_compressors.
Entry
(key, mask, defaultable, spinnaker_route)[source]¶ Bases:
object
-
defaultable
¶
-
key
¶
-
mask
¶
-
spinnaker_route
¶
-
-
class
pacman.operations.router_compressors.
PairCompressor
(ordered=True)[source]¶ Bases:
pacman.operations.router_compressors.abstract_compressor.AbstractCompressor
Routing Table compressor based on brute force. Finds mergable pairs to replace.
This algorithm assumes unordered routing tables and returns a possibly ordered routing tables. If unordered it can be used as a precompressor for another that makes use of order.
In the simplest format the algorithm is:
- For every pair of entries in the table
- If they have the same spinnaker_route
- Create a merged entry
- Check that does not intersect any entry with a different route
- Remove the two original entries
- Add the merged entry
- Start over
- If they have the same spinnaker_route
A slightly optimised algorithm is:
- Split the entries into buckets based on spinnaker route
- Process the buckets one at a time
- For each entry in the buckets
- For each other entry in the bucket
- Create a merge entry
- Make sure there is no clash with an entry in another bucket
- Replace the two entries and add the merge
- Start the bucket over
- If no merge found move the entry from the bucket to the result list
- For each other entry in the bucket
- When the bucket is empty the result list becomes the bucket
- For each entry in the buckets
A farther optimisation is to do the whole thing in place in a single list:
- Step 1 is sort the list by route in place
- Step 2 do the compression route by route using indexes into the array
- The array is split into 6 parts.
- 0 to _previous_pointer(-1): Entries in buckets that have already been compressed
- _previous_pointer to _write_pointer(-1): Finished entries for the current bucket
- _write_pointer to left(-1): Unused space due to previous merges
- left to right: Not yet finished entries from the current bucket
- right(+ 1) to _remaining_index(-1): Unused space due to previous merges
- _remaining_index to max_index(-1): Entries in buckets not yet compressed
- The array is split into 6 parts.
- Step 3 use only the entries up to _write_pointer(-1)
A farther optimisation is to uses order. The entries are sorted by route frequency from low to high. The results are considered ordered so previous routes are not considered.
The advantage is this allows all the entries from the most frequent route to be merged into a single entry. And the second most frequent only has to consider the most frequent routes.
Step 1 requires the counting of the frequency of routes and the sorting the routes based on this frequency. The current tie break between routes with the same frequency is the route but this is arbitrary at the algorithm level. This code does not use a dictionary to keep the code the same as the C.
Step 2 is change in that the previous entries (0 to _previous_pointer(-1)) are not considered for clash checking
-
compress_table
(router_table)[source]¶ Compresses all the entries for a single table.
Compressed the entries for this unordered table returning a new table with possibly fewer entries but still unordered
Parameters: router_table (MulticastRoutingTable) – Original Routing table for a single chip Returns: Compressed routing table for the same chip Return type: MulticastRoutingTable
- For every pair of entries in the table
-
class
pacman.operations.router_compressors.
UnorderedCompressor
[source]¶ Bases:
pacman.operations.router_compressors.pair_compressor.PairCompressor
-
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
-
pacman.operations.routing_info_allocator_algorithms.malloc_based_routing_allocator.utils.
get_possible_masks
(n_keys, mask_width=32, contiguous_keys=True)[source]¶ Get the possible masks given the number of keys.
Parameters: - n_keys (int) – The number of keys to generate a mask for
- mask_width – Number of bits that are meaningful in the mask. 32 by default.
- mask_width – int
- contiguous_keys – True if the mask should only have zeros in the LSBs
Returns: A generator of all possible masks
Return type: iterable(int)
-
pacman.operations.routing_info_allocator_algorithms.malloc_based_routing_allocator.utils.
zero_out_bits
(all_ones_mask, bits_to_zero)[source]¶ Takes a mask (with all interesting bits set to 1) and zeroes out the bits at the given indices.
Parameters: - all_ones_mask (int) – Initial mask
- bits_to_zero (iterable(int)) – Which bits to clear. The LSB is zero.
Returns: A single mask, with zeroes in all required places
Return type: int
-
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
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 multicast into a point-to-point cast).
-
MASK
= 4294965248¶
-
MAX_KEYS_SUPPORTED
= 2048¶
-
-
class
pacman.operations.routing_info_allocator_algorithms.zoned_routing_info_allocator.
ZonedRoutingInfoAllocator
[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
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.
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
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.
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.
DestinationBasedRoutingInfoAllocator
[source]¶ Bases:
object
A routing key allocator that operates for people who wish to have a separate key for each destination (making a multicast into a point-to-point cast).
-
MASK
= 4294965248¶
-
MAX_KEYS_SUPPORTED
= 2048¶
-
-
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
Bases:
object
Module contents¶
pacman.utilities package¶
Subpackages¶
-
class
pacman.utilities.algorithm_utilities.field_based_system_utilities.
TYPES_OF_FIELDS
[source]¶ 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.graphs.machine.MachineGraph
) – the machine graph to add edges to - graph_mapper (
pacman.model.graphs.common.GraphMapper
) – the mapper graphs - application_graph (
pacman.model.graphs.application.ApplicationGraph
) – the application graph to work with
- machine_graph (
-
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.
add_set
(all_sets, new_set)[source]¶ Adds a new set into the list of sets, concatenating sets if required.
If the new set does not overlap any existing sets it is added.
However if the new sets overlaps one or more existing sets, a superset is created combining all the overlapping sets. Existing overlapping sets are removed and only the new superset is added.
Parameters: - all_sets – List of Non overlapping sets
- new_set – A new set which may or may not overlap the previous sets.
-
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.
create_vertices_groups
(vertices, same_group_as_function)[source]¶
-
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.
get_same_chip_vertex_groups
(graph)[source]¶ Get a dictionary of vertex to list of vertices that must be placed on the same chip
Parameters: graph – The graph containing the vertices
-
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.
get_vertices_on_same_chip
(vertex, graph)[source]¶ Get the vertices that must be on the same chip as the given vertex
Parameters: - vertex – The vertex to search with
- graph – The graph containing the vertex
-
pacman.utilities.algorithm_utilities.placer_algorithm_utilities.
group_vertices
(vertices, same_group_as_function)[source]¶ Group vertices according to some function that can indicate the groups that any vertex can be contained within
Parameters: - vertices – The vertices to group
- same_group_as_function – A function which takes a vertex and returns vertices that should be in the same group (excluding the original vertex)
Returns: A dictionary of vertex to list of vertices that are grouped with it
-
class
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.
ConstraintGroup
(values)[source]¶ Bases:
list
-
constraint
¶
-
-
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, traffic_type)[source]¶ Utility method to get groups of edges using any
KeyAllocatorSameKeyConstraint
constraints. Note that no checking is done here about conflicts related to other constraints.Parameters: - machine_graph – the machine graph
- traffic_type – the traffic type to group
-
pacman.utilities.algorithm_utilities.routing_info_allocator_utilities.
get_fixed_mask
(same_key_group)[source]¶ Get a fixed mask from a group of edges if a
FixedMaskConstraint
constraint exists in any of the edges in the group.Parameters: same_key_group (iterable( pacman.model.graphs.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
A simple bit of support code for validation.
-
pacman.utilities.file_format_schemas.
validate
(json_obj, schema_filename)[source]¶ Check that the given JSON object (or array) is valid against the given schema. The schema is given by filename relative to this package.
Parameters: - json_obj (dict or list) – The entity to validate
- schema_filename (str) – The name of the file containing the schema (e.g., “routes.json”)
Return type: None
Raises: - IOError – If the schema file doesn’t exist.
- ValidationError – If the JSON object isn’t valid.
-
class
pacman.utilities.utility_objs.resource_tracker.
ResourceTracker
(machine, plan_n_timesteps, 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 - plan_n_timesteps (int) – number of timesteps to plan for
- chips (iterable(tuple(int, int))) – 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(tuple(int, int, int, list(tuple(int, int)), list(tuple(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(
pacman.model.constraints.AbstractConstraint
)) – the constraints to consider - chips (iterable(tuple(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: tuple(int, int, int, list(tuple(int, int)), list(tuple(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(
pacman.model.resources.ResourceContainer
)) – The resources to be allocated - chips (iterable(tuple(int, int))) – An iterable of (x, y) tuples of chips that are to be used
- processor_ids (list(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(list(
pacman.model.resources.IptagResource
))) – list of lists of IP tag resources - group_reverse_ip_tags (list(list(
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(tuple(int, int, int, list(tuple(int, int)), list(tuple(int, int))))
Raises: pacman.exceptions.PacmanValueError – If there aren’t chips available that can take the allocation.
- group_resources (list(
-
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(tuple(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(
pacman.model.resources.IptagResource
)) – iterable of IP tag resources - reverse_ip_tags (iterable(
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: tuple(int, int, int, list(tuple(int, int, int, int)), list(tuple(int, int)))
Raises: pacman.exceptions.PacmanValueError – If there isn’t a chip available that can take the allocation.
- 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
¶ The number of chips used in this allocation.
-
static
get_chip_and_core
(constraints, chips=None)[source]¶ Get an assigned chip and core from a set of constraints
Parameters: - constraints (iterable(
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(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(int or None, int or None, int or None)
- constraints (iterable(
-
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(
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: tuple(str, iterable(
pacman.model.resources.IptagResource
), iterable(pacman.model.resources.ReverseIPtabResource
))- resources (
-
get_maximum_constrained_resources_available
(resources, constraints)[source]¶ Get the maximum resources available given the constraints
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources of the item to check - chips (iterable(
spinn_machine.Chip
)) – the chips to locate the max available resources of
- resources (
-
get_maximum_cores_available_on_a_chip
()[source]¶ returns the number of available cores of a real chip with the maximum number of available cores
Returns: the max cores available on the best real chip Return type: int
-
get_maximum_cores_available_on_a_virtual_chip
()[source]¶ returns the number of available cores of a virtual chip with the maximum number of available cores :return: the max cores available on the best real chip :rtype: int
-
get_maximum_resources_available
(area_code=None)[source]¶ Get the maximum resources available
Parameters: area_code – A set of valid (x, y) coordinates to choose from Returns: a resource which shows max resources available Return type: pacman.model.resources.ResourceContainer
-
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(tuple(str, int)) or None) – the details of the IP tags allocated
- reverse_ip_tags (iterable(tuple(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, plan_n_timesteps, 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 - plan_n_timesteps (int) – number of timesteps to plan for
- chips (iterable(tuple(int, int))) – 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(tuple(int, int, int, list(tuple(int, int)), list(tuple(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(
pacman.model.constraints.AbstractConstraint
)) – the constraints to consider - chips (iterable(tuple(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: tuple(int, int, int, list(tuple(int, int)), list(tuple(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(
pacman.model.resources.ResourceContainer
)) – The resources to be allocated - chips (iterable(tuple(int, int))) – An iterable of (x, y) tuples of chips that are to be used
- processor_ids (list(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(list(
pacman.model.resources.IptagResource
))) – list of lists of IP tag resources - group_reverse_ip_tags (list(list(
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(tuple(int, int, int, list(tuple(int, int)), list(tuple(int, int))))
Raises: pacman.exceptions.PacmanValueError – If there aren’t chips available that can take the allocation.
- group_resources (list(
-
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(tuple(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(
pacman.model.resources.IptagResource
)) – iterable of IP tag resources - reverse_ip_tags (iterable(
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: tuple(int, int, int, list(tuple(int, int, int, int)), list(tuple(int, int)))
Raises: pacman.exceptions.PacmanValueError – If there isn’t a chip available that can take the allocation.
- 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
¶ The number of chips used in this allocation.
-
static
get_chip_and_core
(constraints, chips=None)[source]¶ Get an assigned chip and core from a set of constraints
Parameters: - constraints (iterable(
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(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(int or None, int or None, int or None)
- constraints (iterable(
-
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(
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: tuple(str, iterable(
pacman.model.resources.IptagResource
), iterable(pacman.model.resources.ReverseIPtabResource
))- resources (
-
get_maximum_constrained_resources_available
(resources, constraints)[source]¶ Get the maximum resources available given the constraints
Parameters: - resources (
pacman.model.resources.ResourceContainer
) – The resources of the item to check - chips (iterable(
spinn_machine.Chip
)) – the chips to locate the max available resources of
- resources (
-
get_maximum_cores_available_on_a_chip
()[source]¶ returns the number of available cores of a real chip with the maximum number of available cores
Returns: the max cores available on the best real chip Return type: int
-
get_maximum_cores_available_on_a_virtual_chip
()[source]¶ returns the number of available cores of a virtual chip with the maximum number of available cores :return: the max cores available on the best real chip :rtype: int
-
get_maximum_resources_available
(area_code=None)[source]¶ Get the maximum resources available
Parameters: area_code – A set of valid (x, y) coordinates to choose from Returns: a resource which shows max resources available Return type: pacman.model.resources.ResourceContainer
-
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(tuple(str, int)) or None) – the details of the IP tags allocated
- reverse_ip_tags (iterable(tuple(str, int)) or None) – the details of the reverse IP tags allocated
Return type: None
- machine (
Submodules¶
pacman.utilities.constants module¶
pacman.utilities.json_utils module¶
-
pacman.utilities.json_utils.
constraint_to_json
(constraint)[source]¶ Converts a constraint to JSON.
Note: Vertexes are represented by just their label.
Note: If an unexpected constraint is received, the str() and repr() values are saved
If an Exception occurs, that is caught and added to the JSON object.
Parameters: constraint – The constraint to describe Returns: A dict describing the constraint
pacman.utilities.utility_calls module¶
-
pacman.utilities.utility_calls.
check_algorithm_can_support_constraints
(constrained_vertices, supported_constraints, abstract_constraint_type)[source]¶ Helper method to find out if an algorithm can support all the constraints given the objects its expected to work on
Parameters: - constrained_vertices (iterable(
pacman.model.constraints.AbstractConstraint
)) – a list of constrained vertices which each has constraints given to the algorithm - supported_constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The constraints supported - abstract_constraint_type (
pacman.model.constraints.AbstractConstraint
) – The overall abstract c type supported
Returns: Nothing is returned
Return type: None
Raises: pacman.exceptions.PacmanInvalidParameterException – When the algorithm cannot support the constraints demanded of it
- constrained_vertices (iterable(
-
pacman.utilities.utility_calls.
check_constrained_value
(value, current_value)[source]¶ Checks that the current value and a new value match
Parameters: - value – The value to check
- current_value – The existing value
-
pacman.utilities.utility_calls.
compress_bits_from_bit_array
(bit_array, bit_positions)[source]¶ Compress specific positions from a bit array of 32 uint8 value, where is a 1 or 0, into a 32-bit value.
Parameters: - bit_array (numpy.array(uint8)) – The array to extract the value from
- bit_positions (numpy.array(int)) – The positions of the bits to extract, each value being between 0 and 31
Return type: int
-
pacman.utilities.utility_calls.
compress_from_bit_array
(bit_array)[source]¶ Compress a bit array of 32 uint8 values, where each is a 1 or 0, into a 32-bit value
Parameters: bit_array (numpy.array(uint8)) – The array to compress Return type: int
-
pacman.utilities.utility_calls.
expand_to_bit_array
(value)[source]¶ Expand a 32-bit value in to an array of length 32 of uint8 values, each of which is a 1 or 0
Parameters: value (int) – The value to expand Return type: numpy.array(uint8)
-
pacman.utilities.utility_calls.
ident
(object)[source]¶ Get the ID of the given object.
Return type: str
-
pacman.utilities.utility_calls.
is_equal_or_None
(a, b)[source]¶ If a and b are both not None, return True iff they are equal, otherwise return True
-
pacman.utilities.utility_calls.
is_single
(iterable)[source]¶ Test if there is exactly one item in the iterable
-
pacman.utilities.utility_calls.
locate_constraints_of_type
(constraints, constraint_type)[source]¶ Locates all constraints of a given type out of a list
Parameters: - constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The constraints to filter - constraint_type (
pacman.model.constraints.partitioner_constraints.AbstractPartitionConstraint
) – The type of constraints to return
Returns: The constraints of constraint_type that are found in the constraints given
Return type: Raises: None – no known exceptions
- constraints (iterable(
-
pacman.utilities.utility_calls.
locate_first_constraint_of_type
(constraints, constraint_type)[source]¶ Locates the first constraint of a given type out of a list
Parameters: - constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The constraints to select from - constraint_type (
pacman.model.constraints.partitioner_constraints.AbstractPartitionConstraint
) – The type of constraints to return
Returns: The first constraint of constraint_type that was found in the constraints given
Return type: Raises: pacman.exceptions.PacmanInvalidParameterException – If no such constraint is present
- constraints (iterable(
pacman.utilities.vertex_sorter module¶
-
class
pacman.utilities.vertex_sorter.
ConstraintOrder
(constraint_class, relative_order, required_optional_properties=None)[source]¶ Bases:
object
A constraint order definition for sorting.
Parameters: - constraint_class – The class of the constraint
- relative_order – The order of the constraint relative to other constraints to be sorted
- required_optional_properties – Properties of the constraint instances that must not be None for the constraint to match this ordering
-
constraint_class
¶ property method for the constraint class
-
relative_order
¶ property method for the relative order
-
required_optional_properties
¶ property method for the required optional properties
-
class
pacman.utilities.vertex_sorter.
VertexSorter
(constraint_order)[source]¶ Bases:
object
Sorts vertices based on constraints with given criteria.
Parameters: constraint_order (list( ConstraintOrder
)) – The order in which the constraints are to be sorted
Module contents¶
-
class
pacman.utilities.
ConstraintOrder
(constraint_class, relative_order, required_optional_properties=None)[source]¶ Bases:
object
A constraint order definition for sorting.
Parameters: - constraint_class – The class of the constraint
- relative_order – The order of the constraint relative to other constraints to be sorted
- required_optional_properties – Properties of the constraint instances that must not be None for the constraint to match this ordering
-
constraint_class
¶ property method for the constraint class
-
relative_order
¶ property method for the relative order
-
required_optional_properties
¶ property method for the required optional properties
-
class
pacman.utilities.
VertexSorter
(constraint_order)[source]¶ Bases:
object
Sorts vertices based on constraints with given criteria.
Parameters: constraint_order (list( ConstraintOrder
)) – The order in which the constraints are to be sorted
Submodules¶
pacman.exceptions module¶
-
exception
pacman.exceptions.
MachineHasDisconnectedSubRegion
[source]¶ Bases:
pacman.exceptions.PacmanException
Some part of the machine has no paths connecting it to the rest of the machine.
-
exception
pacman.exceptions.
MinimisationFailedError
(target_length, final_length=None, chip=None)[source]¶ Bases:
pacman.exceptions.PacmanException
Raised when a routing table could not be minimised to reach a specified target.
Parameters: - target_length (int) – The target number of routing entries.
- final_length (int or None) – The number of routing entries reached when the algorithm completed. (final_length > target_length)
- chip (tuple(int, int) or None) – The coordinates of the chip on which routing table minimisation first failed. Only set when minimisation is performed across many chips simultaneously.
-
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.
-
exception
pacman.exceptions.
PacmanAlgorithmFailedToGenerateOutputsException
[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
An exception that indicates multiple placements are being made for a vertex.
-
exception
pacman.exceptions.
PacmanCanNotFindChipException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates the chip was not in the list of chips.
-
exception
pacman.exceptions.
PacmanConfigurationException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with configuring some part of PACMAN.
-
exception
pacman.exceptions.
PacmanElementAllocationException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with element allocation.
-
exception
pacman.exceptions.
PacmanException
[source]¶ Bases:
Exception
Indicates a general exception from Pacman
-
exception
pacman.exceptions.
PacmanExternalAlgorithmFailedToCompleteException
[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 that 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
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates to indicate that there are no merges worth performing.
-
exception
pacman.exceptions.
PacmanNotExistException
[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.
-
exception
pacman.exceptions.
PacmanNotFoundError
[source]¶ Bases:
KeyError
,pacman.exceptions.PacmanException
An exception that indicates that some object has not been found when requested.
-
exception
pacman.exceptions.
PacmanNotPlacedError
[source]¶ Bases:
KeyError
An exception that indicates no placements are made for a vertex.
-
exception
pacman.exceptions.
PacmanPartitionException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with partitioning
-
exception
pacman.exceptions.
PacmanPlaceException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with placement
-
exception
pacman.exceptions.
PacmanProcessorAlreadyOccupiedError
[source]¶ Bases:
ValueError
An exception that indicates multiple placements are being made to a processor.
-
exception
pacman.exceptions.
PacmanProcessorNotAvailableError
(x, y, p)[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that a processor is unavailable for some reason.
-
exception
pacman.exceptions.
PacmanProcessorNotOccupiedError
[source]¶ Bases:
KeyError
An exception that indicates that no placement has been made to a processor.
-
exception
pacman.exceptions.
PacmanPruneException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with pruning
-
exception
pacman.exceptions.
PacmanRouteInfoAllocationException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with route info allocation.
-
exception
pacman.exceptions.
PacmanRoutingException
[source]¶ Bases:
pacman.exceptions.PacmanException
An exception that indicates that something went wrong with routing.
-
exception
pacman.exceptions.
PacmanTypeError
[source]¶ Bases:
TypeError
,pacman.exceptions.PacmanException
An exception that indicates that an object is of incorrect type.
-
exception
pacman.exceptions.
PacmanValueError
[source]¶ Bases:
ValueError
,pacman.exceptions.PacmanException
An exception that 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.