pacman.data package¶
Submodules¶
pacman.data.pacman_data_writer module¶
- class pacman.data.pacman_data_writer.PacmanDataWriter(state: DataStatus)[source]¶
Bases:
MachineDataWriter
,PacmanDataView
See
spinn_utilities.data.UtilsDataWriter
.This class is designed to only be used directly within the PACMAN repository unit tests as all methods are available to subclasses.
- Parameters:
state – State writer should be in
- classmethod add_edge(edge: ApplicationEdge, outgoing_edge_partition_name: str)[source]¶
Adds an Application edge to the user graph.
Syntactic sugar for get_graph().add_edge()
- Parameters:
edge (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:
PacmanConfigurationException – when both graphs contain vertices
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
SpiNNUtilsException – If the graph is currently unavailable
SimulatorNotSetupException – If called before sim.setup
SimulatorShutdownException – If called after sim.end
- add_sample_monitor_vertex(vertex: MachineVertex, all_chips: bool)[source]¶
Accepts a simple of the monitor cores to be added.
Should be called once for each monitor added to all (Ethernet) chips.
Only affect is to change the numbers reported by the get_all/ethernet_monitor methods.
- Parameters:
vertex (MachineVertex) – One of the vertices added to each core, assumed to be typical of all.
all_chips (bool) – If True assumes that this Vertex will be placed on all chips including Ethernet ones. If False assumes that this Vertex type will only be placed on Ethernet Vertices
- classmethod add_vertex(vertex: ApplicationVertex)[source]¶
Adds an Application vertex to the user graph.
Syntactic sugar for get_graph().add_vertex()
- Parameters:
vertex (ApplicationVertex) – The vertex to add to the graph
- Raises:
PacmanConfigurationException – when both graphs contain vertices
PacmanConfigurationException – If there is an attempt to add the same vertex more than once
SpiNNUtilsException – If the graph is currently unavailable
SimulatorNotSetupException – If called before sim.setup
SimulatorShutdownException – If called after sim.end
- set_n_chips_in_graph(n_chips_in_graph)[source]¶
Sets the number of chips needed by the graph.
- Parameters:
n_chips_in_graph (int)
- set_n_required(n_boards_required, n_chips_required)[source]¶
Sets (if not None) the number of boards/chips requested by the user.
- set_placements(placements: Placements)[source]¶
Set the placements.
- Parameters:
placements (Placements)
- Raises:
TypeError – if the placements is not a Placements
- set_plan_n_timesteps(plan_n_timesteps: int | None)[source]¶
Sets the plan_n_timestep. Use None for run forever.
- Parameters:
plan_n_timesteps (int or None)
- Raises:
TypeError – if the plan_n_timesteps are not an int or None
PacmanConfigurationException – On a negative plan_n_timesteps
- set_precompressed(router_tables: MulticastRoutingTables)[source]¶
Sets the precompressed router_tables value.
- Parameters:
router_tables (MulticastRoutingTables) – new value
- Raises:
TypeError – if the router_tables is not a MulticastRoutingTables
- set_routing_infos(routing_infos: RoutingInfo)[source]¶
Set the routing_infos.
- Parameters:
routing_infos (RoutingInfo)
- Raises:
TypeError – if the routing_infos is not a RoutingInfo
- set_routing_table_by_partition(routing_table_by_partition: MulticastRoutingTableByPartition)[source]¶
Sets the _routing_table_by_partition.
- Parameters:
routing_table_by_partition (MulticastRoutingTableByPartition) – raises TypeError: if routing_table_by_partition is no a MulticastRoutingTableByPartition
- set_uncompressed(router_tables: MulticastRoutingTables)[source]¶
Sets the uncompressed router_tables value.
- Parameters:
router_tables (MulticastRoutingTables) – new value
- Raises:
TypeError – if the router_tables is not a MulticastRoutingTables
Module contents¶
- class pacman.data.PacmanDataView¶
Bases:
MachineDataView
Adds the extra Methods to the View for PACMAN level.
See
UtilsDataView
for a more detailed description.This class is designed to only be used directly within the PACMAN repository as all methods are available to subclasses
- classmethod add_edge(edge: ApplicationEdge, outgoing_edge_partition_name: str)[source]¶
Adds an Application edge to the user graph.
Syntactic sugar for get_graph().add_edge()
- Parameters:
edge (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:
PacmanConfigurationException – when both graphs contain vertices
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
SpiNNUtilsException – If the graph is currently unavailable
SimulatorNotSetupException – If called before sim.setup
SimulatorShutdownException – If called after sim.end
- classmethod add_vertex(vertex: ApplicationVertex)[source]¶
Adds an Application vertex to the user graph.
Syntactic sugar for get_graph().add_vertex()
- Parameters:
vertex (ApplicationVertex) – The vertex to add to the graph
- Raises:
PacmanConfigurationException – when both graphs contain vertices
PacmanConfigurationException – If there is an attempt to add the same vertex more than once
SpiNNUtilsException – If the graph is currently unavailable
SimulatorNotSetupException – If called before sim.setup
SimulatorShutdownException – If called after sim.end
- classmethod get_all_monitor_sdram() AbstractSDRAM [source]¶
The amount of SDRAM on every chip reported to be used by monitor vertices.
Ethernet-enabled chips may have more.
Does not include the system SDRAM reserved by the machine/scamp.
- Return type:
- classmethod get_chips_boards_required_str()[source]¶
Gets a String to say what was required :return:
- classmethod get_edges() Sequence[ApplicationEdge] [source]¶
Get all the edges in the graph.
Syntactic sugar for get_graph().edges
- Return type:
- classmethod get_ethernet_monitor_sdram() AbstractSDRAM [source]¶
The amount of SDRAM on every Ethernet chip reported to be used by monitor vertices.
This includes the SDRAM returned by get_all_monitor_sdram unless for some reason these are not on Ethernet chips.
Does not include the system SDRAM reserved by the machine/scamp.
- Return type:
- classmethod get_n_boards_required()[source]¶
Gets the number of boards requested by the user during setup if known.
Guaranteed to be positive
- Return type:
- Raises:
SpiNNUtilsException – If the n_boards_required is currently unavailable
- classmethod get_n_chips_needed()[source]¶
Gets the number of chips needed, if set.
This will be the number of chips requested by the user during setup, even if this is less that what the partitioner reported.
If the partitioner has run and the user has not specified a number, this will be what the partitioner requested.
Guaranteed to be positive if set
- Return type:
- Raises:
SpiNNUtilsException – If data for n_chips_needed is not available
- classmethod get_n_machine_vertices() int [source]¶
Gets the number of machine vertices via the application graph.
- Return type:
- classmethod get_n_partitions() int [source]¶
The partitions in the user application graph.
Syntactic sugar for get_graph().n_outgoing_edge_partitions
- Return type:
- Raises:
SpiNNUtilsException – If the graph is currently unavailable
- classmethod get_n_placements() int [source]¶
The number of placements.
- Return type:
- Raises:
SpiNNUtilsException – If the placements are currently unavailable
- classmethod get_n_vertices() int [source]¶
The number of vertices in the user application graph.
Syntactic sugar for get_graph().n_vertices
- Return type:
- Raises:
SpiNNUtilsException – If the graph is currently unavailable
- classmethod get_outgoing_edge_partitions_starting_at_vertex(vertex: ApplicationVertex) Iterable[AbstractEdgePartition] [source]¶
Get all the edge partitions that start at the given vertex.
Syntactic sugar for get_graph().get_outgoing_edge_partitions_starting_at_vertex()
- Parameters:
vertex (AbstractVertex) – The vertex at which the edge partitions to find starts
- Return type:
iterable(AbstractEdgePartition)
- classmethod get_placement_of_vertex(vertex: MachineVertex) Placement [source]¶
Return the placement information for a vertex.
Syntactic sugar for get_placements().get_placement_of_vertex(vertex). Optimised for speed
- Parameters:
vertex (MachineVertex) – The vertex to find the placement of
- Returns:
The placement
- Return type:
- Raises:
PacmanNotPlacedError – If the vertex has not been placed.
SpiNNUtilsException – If the placements is currently unavailable
- classmethod get_placement_on_processor(x: int, y: int, p: int) Placement [source]¶
Get the vertex on a specific processor, or raise an exception if the processor has not been allocated.
- Parameters:
- Returns:
the vertex placed on the given processor
- Return type:
- Raises:
PacmanProcessorNotOccupiedError – If the processor is not occupied
SpiNNUtilsException – If the placements are currently unavailable
- classmethod get_plan_n_timestep() int | None [source]¶
The number of timesteps to plan for in an auto-pause-resume cycle.
Use by partitioners and such, but not to reserve data regions.
- Return type:
int or None
- Returns:
The planned number of timesteps, or None if run forever.
- classmethod get_precompressed() MulticastRoutingTables [source]¶
Get the pre-compressed routing tables.
This may be the same object as the uncompressed ones if precompression is skipped or determined to be not needed.
- Return type:
- Returns:
The routing tables after the range compressor or if not to be run the original tables
- Raises:
SpiNNUtilsException – If the tables is currently unavailable
- classmethod get_routing_infos() RoutingInfo [source]¶
The routing information, if known.
- Raises:
SpiNNUtilsException – If the routing_infos is currently unavailable
- classmethod get_routing_table_by_partition() MulticastRoutingTableByPartition [source]¶
The MulticastRoutingTableByPartition, if it has been set.
- Return type:
- Raises:
SpiNNUtilsException – If the tables is currently unavailable
- classmethod get_tags() Tags [source]¶
The Tags object if known.
- Return type:
- Raises:
SpiNNUtilsException – If the tags is currently unavailable
- classmethod get_uncompressed() MulticastRoutingTables [source]¶
Get the uncompressed routing tables.
- Return type:
- Returns:
The original routing tables
- Raises:
SpiNNUtilsException – If the tables is currently unavailable
- classmethod get_vertices_by_type(vertex_type: Type[VTX]) Iterable[VTX] [source]¶
The application vertices in the graph of the specific type.
Syntactic sugar for:
for vertex in get_graph().vertices if isinstance(vertex, vertex_type) ...
Note
The result is a generator so can only be used in a single loop
- Parameters:
vertex_type (type or iterable(type)) – The type(s) to filter the vertices on (can be anything acceptable to the isinstance built-in).
- Return type:
iterable(AbstractVertex)
- Raises:
SpiNNUtilsException – If the graph is currently unavailable
- classmethod has_n_boards_required()[source]¶
Reports if a user has sets the number of boards requested during setup.
- Return type:
- Raises:
SpiNNUtilsException – If n_boards_required is not set or set to None
- classmethod has_n_chips_needed()[source]¶
Detects if the number of chips needed has been set.
This will be the number of chips requested by the use during setup or what the partitioner requested.
- Return type:
- classmethod iterate_machine_vertices() Iterable[MachineVertex] [source]¶
Iterate over the Machine vertices via the application graph.
- Return type:
iterable(MachineVertex)
- classmethod iterate_partitions() Iterable[ApplicationEdgePartition] [source]¶
The partitions in the user application graphs as an iterator.
Syntactic sugar for get_graph().outgoing_edge_partitions
- Return type:
iterable(ApplicationEdgePartition)
- Raises:
SpiNNUtilsException – If the graph is currently unavailable
- classmethod iterate_placemements() Iterable[Placement] [source]¶
Iterates over the Placement objects.
Syntactic sugar for get_placements().placements
- Return type:
iterable(Placement)
- classmethod iterate_placements_by_vertex_type(vertex_type: type | Tuple[type, ...]) Iterable[Placement] [source]¶
Iterate over placements on any chip with this vertex_type.
- Parameters:
- Return type:
iterable(Placement)
- Raises:
SpiNNUtilsException – If the placements are currently unavailable
- classmethod iterate_placements_by_xy_and_type(xy: XY, vertex_type: type | Tuple[type, ...]) Iterable[Placement] [source]¶
Iterate over placements with this x, y and type.
- classmethod iterate_placements_on_core(xy: XY) Iterable[Placement] [source]¶
Iterate over placements with this x and y.
- Parameters:
xy (tuple(int, int)) – x and y coordinates to find placements for.
- Return type:
iterable(Placement)
- Raises:
SpiNNUtilsException – If the placements are currently unavailable
- classmethod iterate_vertices() Iterable[ApplicationVertex] [source]¶
The vertices in the user application graph.
Syntactic sugar for get_graph().vertices except that the result is an iterable and not a list.
- Return type:
iterable(AbstractVertex)
- Raises:
SpiNNUtilsException – If the graph is currently unavailable