pacman.model.graphs.common package¶
Submodules¶
pacman.model.graphs.common.edge_traffic_type module¶
- class pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType(value)[source]¶
Bases:
IntEnumIndicates the traffic type of an Edge in a graph.
- FIXED_ROUTE = 2¶
Edge communicates using fixed route packets
- MULTICAST = 1¶
Edge communicates using multicast packets
- SDRAM = 3¶
Edge communicates using shared memory
Module contents¶
- class pacman.model.graphs.common.ChipAndCore(x: int, y: int, p: int | None = None)¶
Bases:
objectA constraint to place a vertex on a specific chip and, optionally, a specific core on that chip.
- Parameters:
x – the x-coordinate of the chip
y – the y-coordinate of the chip
p – the processor (if any) of the chip
- class pacman.model.graphs.common.MDSlice(lo_atom: int, hi_atom: int, shape: Tuple[int, ...], start: Tuple[int, ...], atoms_shape: Tuple[int, ...])¶
Bases:
SliceRepresents a multi-dimensional slice of a vertex.
- Parameters:
lo_atom – Index of the lowest atom to represent.
hi_atom – Index of the highest atom to represent.
shape – The size of each dimension in the slice.
start – The offset to the start index along each dimension.
atoms_shape – The shape of atoms (?)
- Raises:
PacmanValueError – If the bounds of the slice are invalid.
- as_slice() slice[source]¶
The Slice to a standard slice object if possible.
Note
Use of this method is not recommended. It fails for multi-dimensional slices and may be removed.
- Returns:
A standard python slice
- Raises:
NotImplementedError – If called on a multi-dimensional slice
- property dimension: Tuple[slice, ...]¶
Get directions or edges as slices for every dimension
This is the width and if available height, depth, etc., of the Slice/Grid as represented as slices form the origin along in that direction.
- classmethod from_string(as_str: str) MDSlice | Slice[source]¶
Convert the string form of a
MDSliceinto an object instance.- Parameters:
as_str – The string to parse
- Returns:
Slice described by the string
- get_ids_as_slice_or_list() ndarray[source]¶
Returns the IDs as a built-in slice if possible, otherwise as a list of IDs.
- Returns:
a slice or list of IDs
- get_raster_ids() ndarray[tuple[Any, ...], dtype[integer]][source]¶
Get the IDs of the atoms in the slice as they would appear in a “raster scan” of the atoms over the whole shape.
- Returns:
A list of the global raster IDs of the atoms in this slice
- get_raster_indices(relative_indices: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]¶
Convert from slice-level indices to raster indices.
Note that no checking is done on the given indices; they should be within this slice!
- Parameters:
relative_indices – The local core-level indices relative to this slice
- Returns:
The raster application vertex indices
- get_relative_indices(app_vertex_indices: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]¶
Convert from raster indices to slice-level indices.
Note that no checking is done on the given indices; they should be within this slice!
- Parameters:
app_vertex_indices – The raster application vertex indices to convert
- Returns:
The local core-level indices relative to this slice
- get_slice(n: int) slice[source]¶
Get a slice in the n’Th dimension
- Parameters:
n – The 0-indexed dimension to get the shape of
- Returns:
A 1D slice
- property hi_atom: int¶
The highest atom represented in the slice.
Note
Use of this method is not recommended. It fails for multi-dimensional slices and may be removed
- class pacman.model.graphs.common.Slice(lo_atom: int, hi_atom: int)¶
Bases:
objectRepresents a simple single-dimensional slice of a vertex.
Note
Multi-dimensional slices are supported by
MDSlice.- Parameters:
lo_atom – Index of the lowest atom to represent.
hi_atom – Index of the highest atom to represent.
- Raises:
PacmanTypeError – If non-integer arguments are used.
PacmanValueError – If the bounds of the slice are invalid.
- as_slice() slice[source]¶
The Slice to a standard slice object if possible.
Note
Use of this method is not recommended. It fails for multi-dimensional slices and may be removed.
- Returns:
A standard python slice
- Raises:
NotImplementedError – If called on a multi-dimensional slice
- property dimension: Tuple[slice, ...]¶
Get directions or edges as slices for every dimension
This is the width and if available height, depth, etc., of the Slice/Grid as represented as slices form the origin along in that direction.
- classmethod from_string(as_str: str) Slice[source]¶
Convert the string form of a
Sliceinto an object instance.- Parameters:
as_str – The string to parse
- Returns:
Slice described by the string
- get_ids_as_slice_or_list() slice | ndarray[source]¶
Returns the IDs as a built-in slice if possible, otherwise as a list of IDs.
- Returns:
a slice or list of IDs
- get_raster_ids() ndarray[tuple[Any, ...], dtype[integer]][source]¶
Get the IDs of the atoms in the slice as they would appear in a “raster scan” of the atoms over the whole shape.
- Returns:
A list of the global raster IDs of the atoms in this slice
- get_raster_indices(relative_indices: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]¶
Convert from slice-level indices to raster indices.
Note that no checking is done on the given indices; they should be within this slice!
- Parameters:
relative_indices – The local core-level indices relative to this slice
- Returns:
The raster application vertex indices
- get_relative_indices(app_vertex_indices: ndarray[tuple[Any, ...], dtype[integer]]) ndarray[tuple[Any, ...], dtype[integer]][source]¶
Convert from raster indices to slice-level indices.
Note that no checking is done on the given indices; they should be within this slice!
- Parameters:
app_vertex_indices – The raster application vertex indices to convert
- Returns:
The local core-level indices relative to this slice
- get_slice(n: int) slice[source]¶
Get a slice in the n’Th dimension.
- Parameters:
n – The dimension (0 based) of interest. In 1D slices this must be 0
- Returns:
A 1D slice
- property hi_atom: int¶
The highest atom represented in the slice.
Note
Use of this method is not recommended. It fails for multi-dimensional slices and may be removed