pacman.model.graphs.common package¶
Submodules¶
pacman.model.graphs.common.constrained_object module¶
-
class
pacman.model.graphs.common.constrained_object.
ConstrainedObject
(constraints=None)[source]¶ Bases:
object
An implementation of an object which holds constraints
Parameters: constraints – Any initial constraints -
add_constraint
(constraint)[source]¶ Add a new constraint to the collection of constraints
Parameters: constraint ( pacman.model.constraints.abstract_constraint.AbstractConstraint
) – constraint to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If the constraint is not valid
-
add_constraints
(constraints)[source]¶ Add an iterable of constraints to the collection of constraints
Parameters: constraints (iterable of pacman.model.constraints.abstract_constraint.AbstractConstraint
) – iterable of constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: iterable of constraints Return type: iterable of pacman.model.constraints.abstract_constraint .AbstractConstraint
Raises: None – Raises no known exceptions
-
pacman.model.graphs.common.edge_traffic_type module¶
pacman.model.graphs.common.graph_mapper module¶
-
class
pacman.model.graphs.common.graph_mapper.
GraphMapper
[source]¶ Bases:
object
A mapping between an Application Graph and a Machine Graph
-
add_edge_mapping
(machine_edge, application_edge)[source]¶ Add a mapping between a machine edge and an application edge
Parameters: - machine_edge – An edge from a Machine Graph
- application_edge – An edge from an Application Graph
-
add_vertex_mapping
(machine_vertex, vertex_slice, application_vertex)[source]¶ Add a mapping between application and machine vertices
Parameters: - machine_vertex – A vertex from a Machine Graph
- vertex_slice (
pacman.model.graphs.common.slice.Slice
) – The range of atoms from the application vertex that is going to be in the machine_vertex - application_vertex – A vertex from an Application Graph
Raises: pacman.exceptions.PacmanValueError – If atom selection is out of bounds.
-
get_application_edge
(machine_edge)[source]¶ Get the application edge mapped to a machine edge
Parameters: machine_edge – An edge from a Machine Graph Returns: A machine edge, or None if none
-
get_application_vertex
(machine_vertex)[source]¶ Get the application vertex mapped to a machine vertex
Parameters: machine_vertex – A vertex from a Machine Graph Returns: an application vertex, or None if none
-
get_machine_edges
(application_edge)[source]¶ Get all machine edges mapped to a given application edge
Parameters: application_edge – An edge from an Application Graph Returns: An iterable of machine edges or None if none
-
get_machine_vertex_index
(machine_vertex)[source]¶ Get the index of a machine vertex within the list of such vertices associated with an application vertex
-
get_machine_vertices
(application_vertex)[source]¶ Get all machine vertices mapped to a given application vertex
Parameters: application_vertex – A vertex from an Application Graph Returns: An iterable of machine vertices or None if none
-
pacman.model.graphs.common.slice module¶
-
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.
Module contents¶
-
class
pacman.model.graphs.common.
ConstrainedObject
(constraints=None)[source]¶ Bases:
object
An implementation of an object which holds constraints
Parameters: constraints – Any initial constraints -
add_constraint
(constraint)[source]¶ Add a new constraint to the collection of constraints
Parameters: constraint ( pacman.model.constraints.abstract_constraint.AbstractConstraint
) – constraint to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If the constraint is not valid
-
add_constraints
(constraints)[source]¶ Add an iterable of constraints to the collection of constraints
Parameters: constraints (iterable of pacman.model.constraints.abstract_constraint.AbstractConstraint
) – iterable of constraints to addReturn type: None Raises: pacman.exceptions.PacmanInvalidParameterException – If one of the constraints is not valid
-
constraints
¶ An iterable of constraints
Returns: iterable of constraints Return type: iterable of pacman.model.constraints.abstract_constraint .AbstractConstraint
Raises: None – Raises no known exceptions
-
-
class
pacman.model.graphs.common.
EdgeTrafficType
[source]¶ Bases:
enum.Enum
Indicates the traffic type of an Edge in a graph
-
FIXED_ROUTE
= 2¶
-
MULTICAST
= 1¶
-
-
class
pacman.model.graphs.common.
GraphMapper
[source]¶ Bases:
object
A mapping between an Application Graph and a Machine Graph
-
add_edge_mapping
(machine_edge, application_edge)[source]¶ Add a mapping between a machine edge and an application edge
Parameters: - machine_edge – An edge from a Machine Graph
- application_edge – An edge from an Application Graph
-
add_vertex_mapping
(machine_vertex, vertex_slice, application_vertex)[source]¶ Add a mapping between application and machine vertices
Parameters: - machine_vertex – A vertex from a Machine Graph
- vertex_slice (
pacman.model.graphs.common.slice.Slice
) – The range of atoms from the application vertex that is going to be in the machine_vertex - application_vertex – A vertex from an Application Graph
Raises: pacman.exceptions.PacmanValueError – If atom selection is out of bounds.
-
get_application_edge
(machine_edge)[source]¶ Get the application edge mapped to a machine edge
Parameters: machine_edge – An edge from a Machine Graph Returns: A machine edge, or None if none
-
get_application_vertex
(machine_vertex)[source]¶ Get the application vertex mapped to a machine vertex
Parameters: machine_vertex – A vertex from a Machine Graph Returns: an application vertex, or None if none
-
get_machine_edges
(application_edge)[source]¶ Get all machine edges mapped to a given application edge
Parameters: application_edge – An edge from an Application Graph Returns: An iterable of machine edges or None if none
-
get_machine_vertex_index
(machine_vertex)[source]¶ Get the index of a machine vertex within the list of such vertices associated with an application vertex
-
get_machine_vertices
(application_vertex)[source]¶ Get all machine vertices mapped to a given application vertex
Parameters: application_vertex – A vertex from an Application Graph Returns: An iterable of machine vertices or None if none
-
-
class
pacman.model.graphs.common.
Slice
[source]¶ Bases:
pacman.model.graphs.common.slice.Slice
Represents a slice of a vertex.
Attr int lo_atom: The lowest atom represented in the slice. Attr int hi_atom: The highest atom represented in the slice. Attr int n_atoms: The number of atoms represented by the slice. Attr as_slice: This slice represented as a slice()
object (for use in indexing lists, arrays, etc.)Create a new Slice object.
Parameters: - lo_atom (int) – Index of the lowest atom to represent.
- hi_atom (int) – Index of the highest atom to represent.
Raises: PacmanValueError – If the bounds of the slice are invalid.