pacman.model.placements package¶
Module contents¶
- class pacman.model.placements.Placement(vertex: MachineVertex, x: int, y: int, p: int)¶
Bases:
object
The placement of a vertex on to a machine chip and core.
- Parameters:
vertex (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) – the ID of the processor on which the vertex is placed
- property location: Tuple[int, int, int]¶
The (x,y,p) tuple that represents the location of this placement.
- property vertex: MachineVertex¶
The vertex that was placed.
- Return type:
- class pacman.model.placements.Placements(placements: Iterable[Placement] = ())¶
Bases:
object
The placements of vertices on the chips of the machine.
- Parameters:
placements (iterable(Placement)) – Any initial placements
- Raises:
PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
- add_placement(placement: Placement)[source]¶
Add a placement.
- Parameters:
placement (Placement) – The placement to add
- Raises:
PacmanAlreadyPlacedError – If there is any vertex with more than one placement.
PacmanProcessorAlreadyOccupiedError – If two placements are made to the same processor.
- add_placements(placements: Iterable[Placement])[source]¶
Add some placements.
- Parameters:
placements (iterable(Placement)) – The placements to add
- get_placement_of_vertex(vertex: MachineVertex) Placement [source]¶
Return the placement information for a vertex.
- Parameters:
vertex (MachineVertex) – The vertex to find the placement of
- Returns:
The placement
- Return type:
- Raises:
PacmanNotPlacedError – If the vertex has not been placed.
- get_placement_on_processor(x: int, y: int, p: int) Placement [source]¶
Get the placement on a specific processor, or raises an exception if the processor has not been allocated.
- Parameters:
- Returns:
the placement on the given processor
- Return type:
- Raises:
PacmanProcessorNotOccupiedError – If the processor is not occupied
- is_processor_occupied(x: int, y: int, p: int) bool [source]¶
Determine if a processor has a vertex on it.
- is_vertex_placed(vertex: MachineVertex) bool [source]¶
Determine if a vertex has been placed.
- Parameters:
vertex (MachineVertex) – The vertex to determine the status of
- Return type:
- iterate_placements_by_vertex_type(vertex_type: type | Tuple[type, ...]) Iterable[Placement] [source]¶
Iterate over placements on any chip with this vertex_type.
- iterate_placements_by_xy_and_type(xy: Tuple[int, int], vertex_type: type | Tuple[type, ...]) Iterable[Placement] [source]¶
Iterate over placements with this x, y and this vertex_type.
- iterate_placements_on_core(xy: Tuple[int, int]) Iterable[Placement] [source]¶
Iterate over placements with this x and y.