pacman.model.placements package¶
Submodules¶
pacman.model.placements.placement module¶
-
class
pacman.model.placements.placement.
Placement
(vertex, x, y, p)[source]¶ Bases:
object
The placement of a vertex on to a machine chip and core
Parameters: - vertex (
pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex that has been placed - x (int) – the x-coordinate of the chip on which the vertex is placed
- y (int) – the y-coordinate of the chip on which the vertex is placed
- p (int or None) – the id of the processor on which the vertex is placed
-
p
¶ The id of the processor of the chip where the vertex is placed
Returns: The processor id Return type: int
-
vertex
¶ The vertex that was placed
Returns: a vertex Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip where the vertex is placed
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip where the vertex is placed
Returns: The y-coordinate Return type: int
- vertex (
pacman.model.placements.placements module¶
-
class
pacman.model.placements.placements.
Placements
(placements=None)[source]¶ Bases:
object
The placements of vertices on the chips of the machine
Parameters: placements (iterable of
pacman.model.placements.placement.Placement
) – Any initial placementsRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placement
(placement)[source]¶ Add a placement
Parameters: placement (
pacman.model.placements.placement.Placement
) – The placement to addRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placements
(placements)[source]¶ Add some placements
Parameters: placements (iterable of pacman.model.placements.placement.Placement
) – The placements to add
-
get_placed_processors
()[source]¶ Return an iterable of processors with assigned vertices.
Returns: Iterable of (x, y, p) tuples Return type: iterable of (int, int, int)
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.placement.Placement
Raises: PacmanNotPlacedError – If the vertex has not been placed.
-
get_vertex_on_processor
(x, y, p)[source]¶ Return the vertex on a specific processor or None if the processor has not been allocated
Parameters: - x (int) – the x coordinate of the chip
- y (int) – the y coordinate of the chip
- p (int) – the processor on the chip
Returns: the vertex placed on the given processor
Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: PacmanProcessorNotOccupiedError – If the processor is not occupied
-
is_processor_occupied
(x, y, p)[source]¶ Determine if a processor has a vertex on it
Parameters: - x (int) – x coordinate of processor.
- y (int) – y coordinate of processor.
- p (int) – Index of processor.
Return bool: Whether the processor has an assigned vertex.
-
n_placements
¶ The number of placements
Return type: int
-
placements
¶ All of the placements
Returns: iterable of placements Return type: iterable of pacman.model.placements.placement.Placement
Raises: None – does not raise any known exceptions
Module contents¶
-
class
pacman.model.placements.
Placement
(vertex, x, y, p)[source]¶ Bases:
object
The placement of a vertex on to a machine chip and core
Parameters: - vertex (
pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex that has been placed - x (int) – the x-coordinate of the chip on which the vertex is placed
- y (int) – the y-coordinate of the chip on which the vertex is placed
- p (int or None) – the id of the processor on which the vertex is placed
-
p
¶ The id of the processor of the chip where the vertex is placed
Returns: The processor id Return type: int
-
vertex
¶ The vertex that was placed
Returns: a vertex Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: None – does not raise any known exceptions
-
x
¶ The x-coordinate of the chip where the vertex is placed
Returns: The x-coordinate Return type: int
-
y
¶ The y-coordinate of the chip where the vertex is placed
Returns: The y-coordinate Return type: int
- vertex (
-
class
pacman.model.placements.
Placements
(placements=None)[source]¶ Bases:
object
The placements of vertices on the chips of the machine
Parameters: placements (iterable of
pacman.model.placements.placement.Placement
) – Any initial placementsRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placement
(placement)[source]¶ Add a placement
Parameters: placement (
pacman.model.placements.placement.Placement
) – The placement to addRaises: - PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
- PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
-
add_placements
(placements)[source]¶ Add some placements
Parameters: placements (iterable of pacman.model.placements.placement.Placement
) – The placements to add
-
get_placed_processors
()[source]¶ Return an iterable of processors with assigned vertices.
Returns: Iterable of (x, y, p) tuples Return type: iterable of (int, int, int)
-
get_placement_of_vertex
(vertex)[source]¶ Return the placement information for a vertex
Parameters: vertex ( pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
) – The vertex to find the placement ofReturns: The placement Return type: pacman.model.placements.placement.Placement
Raises: PacmanNotPlacedError – If the vertex has not been placed.
-
get_vertex_on_processor
(x, y, p)[source]¶ Return the vertex on a specific processor or None if the processor has not been allocated
Parameters: - x (int) – the x coordinate of the chip
- y (int) – the y coordinate of the chip
- p (int) – the processor on the chip
Returns: the vertex placed on the given processor
Return type: pacman.model.graph.machine.abstract_machine_vertex.impl.MachineVertex
Raises: PacmanProcessorNotOccupiedError – If the processor is not occupied
-
is_processor_occupied
(x, y, p)[source]¶ Determine if a processor has a vertex on it
Parameters: - x (int) – x coordinate of processor.
- y (int) – y coordinate of processor.
- p (int) – Index of processor.
Return bool: Whether the processor has an assigned vertex.
-
n_placements
¶ The number of placements
Return type: int
-
placements
¶ All of the placements
Returns: iterable of placements Return type: iterable of pacman.model.placements.placement.Placement
Raises: None – does not raise any known exceptions