spinn_front_end_common.data package

Submodules

spinn_front_end_common.data.fec_data_writer module

class spinn_front_end_common.data.fec_data_writer.FecDataWriter(state: DataStatus)[source]

Bases: PacmanDataWriter, SpiNNManDataWriter, FecDataView

See UtilsDataWriter.

This class is designed to only be used directly by AbstractSpinnakerBase and within the Non-PyNN repositories unit tests as all methods are available to subclasses.

Parameters:

state (DataStatus) – State writer should be in

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

clear_notification_protocol() None[source]

Closes an existing notification_protocol and sets the value to None.

If no notification_protocol exist this method silently returns.

If the close causes an Exception it is logged and ignored

clear_run_steps() None[source]

Clears the run step.

get_run_step will go back to returning None

next_run_step will restart at 1

finish_run() None[source]

Puts all data into the state expected after sim.run ends.

increment_current_run_timesteps(increment: int | None)[source]

Increment the current_run_timesteps and sets first_machine_time_step.

A None increment signals run_forever

Parameters:

increment (int or None) – The timesteps for this do_run loop

next_run_step() int[source]

Starts or increases the run step count.

Run steps start at 1

Returns:

The next step number

Return type:

int

reset_sync_signal() None[source]

Returns the sync signal to the default value.

set_allocation_controller(allocation_controller: MachineAllocationController | None)[source]

Sets the allocation controller variable.

Parameters:

allocation_controller (MachineAllocationController) –

set_buffer_manager(buffer_manager: BufferManager)[source]

Sets the Buffer manager variable.

Parameters:

buffer_manager (BufferManager) –

set_database_file_path(database_file_path: str | None)[source]

Sets the database_file_path variable. Possibly to None.

Parameters:

database_file_path (str or None) –

set_ds_database_path(ds_database_path: str)[source]

Sets the Data Spec targets database.

Parameters:

ds_database_path (str) – Existing path to the database

set_executable_targets(executable_targets: ExecutableTargets)[source]

Sets the executable_targets

Parameters:

executable_targets (ExecutableTargets) –

set_executable_types(executable_types: Dict[ExecutableType, CoreSubsets])[source]
Parameters:

executable_types (dict( ExecutableType, CoreSubsets)) –

set_fixed_routes(fixed_routes: Dict[Tuple[int, int], FixedRouteEntry])[source]
Parameters:

fixed_routes (dict((int, int), FixedRouteEntry)) –

set_gatherer_map(gatherer_map: Dict[Chip, DataSpeedUpPacketGatherMachineVertex])[source]

Sets the map of Chip to Gatherer Vertices.

Parameters:

gatherer_map (dict(Chip, DataSpeedUpPacketGatherMachineVertex)) –

set_ipaddress(ip_address: str)[source]
Parameters:

ip_address (str) –

set_java_caller(java_caller: JavaCaller)[source]
Parameters:

java_caller (JavaCaller) –

set_live_packet_gatherer_parameters(params)[source]

testing method will not work outside of mock

set_max_run_time_steps(max_run_time_steps: int)[source]

Sets the max_run_time_steps value

Parameters:

max_run_time_steps (int) – new value

set_monitor_map(monitor_map: Dict[Chip, ExtraMonitorSupportMachineVertex])[source]

Sets the map of Chip to Monitor Vertices.

Parameters:

monitor_map (dict(Chip, ExtraMonitorSupportMachineVertex)) –

set_n_chips_in_graph(n_chips_in_graph: int)[source]

Sets the number of chips needed by the graph.

Parameters:

n_chips_in_graph (int) –

set_n_required(n_boards_required: int | None, n_chips_required: int | None)[source]

Sets (if not None) the number of boards/chips requested by the user.

Parameters:
  • n_boards_required (int or None) – None or the number of boards requested by the user

  • n_chips_required (int or None) – None or the number of chips requested by the user

set_notification_protocol(notification_protocol: NotificationProtocol)[source]

Sets the notification_protocol.

Parameters:

notification_protocol (NotificationProtocol) –

set_system_multicast_routing_data(data: Tuple[MulticastRoutingTables, Dict[Tuple[int, int], int], Dict[Tuple[int, int], int]])[source]

Sets the system_multicast_routing_data.

These are: data_in_multicast_routing_tables, data_in_multicast_key_to_chip_map, system_multicast_router_timeout_keys

Parameters:

data (tuple(MulticastRoutingTables, dict(tuple(int,int),int), dict(tuple(int,int),int))) – new value

set_up_timings(simulation_time_step_us: int | None, time_scale_factor: float | None, default_time_scale_factor: float | None = None)[source]

Set up timings for the simulation.

Parameters:
  • simulation_time_step_us (int or None) – An explicitly specified time step for the simulation in . If None, the value is read from the configuration

  • time_scale_factor (float or None) – An explicitly specified time scale factor for the simulation. If None, the value is read from the configuration

  • default_time_scale_factor (float or None) – A back up time scale factor for the simulation. Only used if time_scale_factor parameter and configuration are both None. If None, the value is based on simulation_time_step

Module contents

class spinn_front_end_common.data.FecDataView

Bases: PacmanDataView, SpiNNManDataView

Adds the extra Methods to the View for spinn_front_end_commom level.

See UtilsDataView for a more detailed description.

This class is designed to only be used directly within non-PyNN repositories as all methods are available to subclasses

classmethod add_database_socket_address(database_socket_address: SocketAddress)[source]

Adds a socket address to the list of known addresses.

Parameters:

database_socket_address (SocketAddress) –

Raises:

TypeError – if database_socket_address is not a SocketAddress

classmethod add_database_socket_addresses(database_socket_addresses: Iterable[SocketAddress] | None)[source]

Adds all socket addresses to the list of known addresses.

Parameters:

database_socket_addresses (iterable(SocketAddress)) – The addresses to add

Raises:

TypeError – if database_socket_address is not a iterable of SocketAddress

classmethod add_live_output_device(device: LiveOutputDevice)[source]

Add a live output device.

Parameters:

device – The device to be added

classmethod add_live_output_vertex(vertex: ApplicationVertex, partition_id: str)[source]

Add a vertex that is to be output live, and so wants its atom IDs recorded in the database.

Parameters:
  • vertex (ApplicationVertex) – The vertex to add

  • partition_id (str) – The partition to get the IDs of

classmethod add_live_packet_gatherer_parameters(live_packet_gatherer_params: LivePacketGatherParameters, vertex_to_record_from: ApplicationVertex, partition_ids: Iterable[str])[source]

Adds parameters for a new live packet gatherer (LPG) if needed, or adds to the tracker for parameters.

Note

If the ApplicationGraph is used, the vertex must be an ApplicationVertex. If not, it must be a MachineVertex.

Parameters:
  • live_packet_gatherer_params (LivePacketGatherParameters) – parameters for an LPG to look for or create

  • vertex_to_record_from (AbstractVertex) – the vertex that needs to send to a given LPG

  • partition_ids (iterable(str)) – the IDs of the partitions to connect from the vertex; can also be a single string (strings are iterable)

classmethod get_allocation_controller() MachineAllocationController[source]

Returns the allocation controller if known.

Return type:

MachineAllocationController

Raises:

SpiNNUtilsException – If the buffer manager unavailable

classmethod get_app_provenance_dir_path() str[source]

Returns the path to the directory that holds all application provenance files.

This will be the path used by the last run call or to be used by the next run if it has not yet been called.

Note

In unit-test mode this returns a temporary directory shared by all path methods.

Return type:

str

Raises:

SimulatorNotSetupException – If the simulator has not been setup

classmethod get_buffer_manager() BufferManager[source]

Returns the buffer manager if known.

Return type:

BufferManager

Raises:

SpiNNUtilsException – If the buffer manager unavailable

classmethod get_cores_for_type(executable_type: ExecutableType) CoreSubsets[source]

Get the subset of cores running executables of the given type.

Parameters:

executable_type (ExecutableType) –

Return type:

CoreSubsets

Raises:

SpiNNUtilsException – If the executable_types is currently unavailable

classmethod get_current_run_time_ms() float[source]

The end of this or the previous do__run loop time in ms.

Syntactic sugar for current_run_timesteps * simulation_time_step_ms

Will be zero if not yet run and not yet in the do_run_loop

Will be zero if in run forever mode

Return type:

float

classmethod get_current_run_timesteps() int | None[source]

The end of this or the previous do__run loop time in steps.

Will be zero if not yet run and not yet in the do_run_loop

Will be None if in run forever mode

Return type:

int or None

classmethod get_data_in_multicast_key_to_chip_map() Dict[Tuple[int, int], int][source]

Retrieve the data_in_multicast_key_to_chip_map if known. Keys are the coordinates of chips. Values are the base keys for multicast communication received by the Data In streaming module of the extra monitor running on those chips.

Return type:

dict(tuple(int,int), int)

Raises:

SpiNNUtilsException – If the data_in_multicast_key_to_chip_map is currently unavailable

classmethod get_data_in_multicast_routing_tables() MulticastRoutingTables[source]

Retrieve the data_in_multicast_routing_tables if known. These are the routing tables used to handle Data In streaming.

Return type:

MulticastRoutingTables

Raises:

SpiNNUtilsException – If the data_in_multicast_routing_tables is currently unavailable

classmethod get_database_file_path() str | None[source]

Will return the database_file_path if set or None if not set or set to None

Return type:

str or None

classmethod get_ds_database_path() str[source]

Gets the path for the Data Spec database.

Return type:

str

Raises:

SpiNNUtilsException – If the ds_database path is currently unavailable

classmethod get_executable_targets() ExecutableTargets[source]

Binaries to be executed.

Return type:

ExecutableTargets

Raises:

SpiNNUtilsException – If the executable_targets is currently unavailable

classmethod get_executable_types() Dict[ExecutableType, CoreSubsets][source]

Gets the executable_types if they have been created.

Return type:

dict( ExecutableType, CoreSubsets)

Raises:

SpiNNUtilsException – If the executable_types is currently unavailable

classmethod get_first_machine_time_step() int | None[source]

The start of this or the next do_run loop time in steps.

Will be None if in run forever mode

Return type:

int or None

classmethod get_fixed_routes() Dict[Tuple[int, int], FixedRouteEntry][source]

Gets the fixed routes if they have been created.

Return type:

dict((int, int), FixedRouteEntry)

Raises:

SpiNNUtilsException – If the fixed_routes is currently unavailable

classmethod get_gatherer_by_chip(chip: Chip) DataSpeedUpPacketGatherMachineVertex[source]

The DataSpeedUpPacketGatherMachineVertex for an Ethernet-enabled chip.

Parameters:

chip (Chip) – The Ethernet-enabled chip

Return type:

DataSpeedUpPacketGatherMachineVertex

Raises:
  • SpiNNUtilsException – If the gatherers are currently unavailable

  • KeyError – If the chip does not have a gatherer (e.g., if it is not an Ethernet-enabled chip)

classmethod get_gatherer_by_xy(x: int, y: int) DataSpeedUpPacketGatherMachineVertex[source]

The DataSpeedUpPacketGatherMachineVertex for chip (x,y).

Parameters:
  • x (int) – X coordinate of chip

  • y (int) – Y coordinate of chip

Return type:

DataSpeedUpPacketGatherMachineVertex

Raises:
classmethod get_hardware_time_step_ms() float[source]

The hardware timestep, in milliseconds.

Syntactic sugar for simulation_time_step_ms * time_scale_factor

Return type:

float

Raises:

SpiNNUtilsException – If the hardware_time_step is currently unavailable

classmethod get_hardware_time_step_us() int[source]

The hardware timestep, in microseconds.

Syntactic sugar for simulation_time_step_us * time_scale_factor

Return type:

int

Raises:

SpiNNUtilsException – If the hardware_time_step is currently unavailable

classmethod get_ipaddress() str[source]

Gets the IP address of the board with chip 0,0 if it has been set.

Return type:

str

Raises:

SpiNNUtilsException – If the IP address is currently unavailable

classmethod get_java_caller() JavaCaller[source]

Gets the Java_caller.

Return type:

JavaCaller

Raises:

SpiNNUtilsException – If the java_caller is currently unavailable

classmethod get_json_dir_path() str[source]

Returns the path to the directory that holds all JSON files.

This will be the path used by the last run call or to be used by the next run if it has not yet been called.

Note

In unit-test mode this returns a temporary directory shared by all path methods.

Return type:

str

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod get_live_packet_recorder_params() Dict[LivePacketGatherParameters, LivePacketGather][source]

Mapping of live_packet_gatherer_params to a list of tuples (vertex and list of ids)).

Return type:

dict(LivePacketGatherParameters, tuple(AbstractVertex, list(str))

Raises:

SpiNNUtilsException – If the _live_packet_recorder_params is currently unavailable

classmethod get_max_run_time_steps() int[source]

Returns the calculated longest time this or a future run loop could be.

Mainly used to indicate the number of timesteps the vertex can and therefore should reserve memory for

Guaranteed to be positive int if available

Return type:

int

Raises:

SpiNNUtilsException – If the max run time is currently unavailable

classmethod get_monitor_by_chip(chip: Chip) ExtraMonitorSupportMachineVertex[source]

The ExtraMonitorSupportMachineVertex for chip.

Parameters:

chip (Chip) – chip to get monitor for

Return type:

ExtraMonitorSupportMachineVertex

Raises:
classmethod get_monitor_by_xy(x: int, y: int) ExtraMonitorSupportMachineVertex[source]

The ExtraMonitorSupportMachineVertex for chip (x,y).

Parameters:
  • x (int) – X coordinate of chip

  • y (int) – Y coordinate of chip

Return type:

ExtraMonitorSupportMachineVertex

Raises:
classmethod get_n_boards_required() int[source]

Gets the number of boards requested by the user during setup if known.

Guaranteed to be positive

Return type:

int

Raises:

SpiNNUtilsException – If the n_boards_required is currently unavailable

classmethod get_n_chips_needed() int[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:

int

Raises:

SpiNNUtilsException – If data for n_chips_needed is not available

classmethod get_n_database_socket_addresses() int[source]

Number of registered database_socket_addresses.

Return type:

int

classmethod get_n_gathers() int[source]

Number of DataSpeedUpPacketGatherMachineVertex(s).

Return type:

int

Raises:

SpiNNUtilsException – If the gathers are currently unavailable

classmethod get_n_monitors() int[source]

Number of ExtraMonitorSupportMachineVertexs.

Return type:

int

Raises:

SpiNNUtilsException – If the monitors are currently unavailable

classmethod get_next_ds_references(number)[source]

Get a a list of unique data specification references

These will be unique since the last hard reset

Parameters:

number – number of values in the list

Return type:

list(int)

classmethod get_next_none_labelled_edge_number() int[source]

Returns an unused number for labelling an unlabelled edge.

Return type:

int

classmethod get_next_sync_signal() Signal[source]

Returns alternately Signal.SYNC0 and Signal.SYNC1.

Return type:

Signal

classmethod get_notification_protocol() NotificationProtocol[source]

The notification protocol handler.

Return type:

NotificationProtocol

Raises:

SpiNNUtilsException – If the notification_protocol is currently unavailable

classmethod get_provenance_dir_path() str[source]

Returns the path to the directory that holds all provenance files.

This will be the path used by the last run call or to be used by the next run if it has not yet been called.

Note

In unit-test mode this returns a temporary directory shared by all path methods.

Return type:

str

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod get_reset_number() int[source]

Get the number of times a reset has happened.

Only counts the first reset after each run.

So resets that are first soft then hard are ignored. Double reset calls without a run and resets before run are ignored.

Reset numbers start at zero

Return type:

int

Raises:

SpiNNUtilsException – If the run_number is currently unavailable

classmethod get_reset_str() str[source]

Get the number of times a reset has happened as a string.

An empty string is returned if the system has never been reset (i.e., the reset number is 0)

Only counts the first reset after each run.

So resets that are first soft then hard are ignored. Double reset calls without a run and resets before run are ignored.

Reset numbers start at zero

Raises:

SpiNNUtilsException – If the run_number is currently unavailable

Return type:

str

classmethod get_run_number() int[source]

Get the number of this or the next run.

Run numbers start at 1

Return type:

int

Raises:

SpiNNUtilsException – If the run_number is currently unavailable

classmethod get_run_step() int | None[source]

Get the auto pause and resume step currently running if any.

If and only if currently in an auto pause and resume loop this will report the number of the step. Starting at 1

In most cases this will return None, including when running without steps.

Return type:

None or int

classmethod get_simulation_time_step_ms() float[source]

The simulation time step, in milliseconds.

Syntactic sugar for simulation_time_step_us / 1000.

Return type:

float

Raises:

SpiNNUtilsException – If the simulation_time_step_ms is currently unavailable

classmethod get_simulation_time_step_per_ms() float[source]

The number of simulation time steps in a millisecond.

Syntactic sugar for 1000 / simulation_time_step_us

Return type:

float

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod get_simulation_time_step_per_s() float[source]

The number of simulation time steps in a seconds.

Syntactic sugar for 1,000,000 / simulation_time_step_us

Return type:

float

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod get_simulation_time_step_s() float[source]

The simulation timestep, in seconds.

Syntactic sugar for simulation_time_step() / 1,000,000.

Return type:

float

Raises:

SpiNNUtilsException – If the simulation_time_step_ms is currently unavailable

classmethod get_simulation_time_step_us() int[source]

The simulation timestep, in microseconds.

Previously known as “machine_time_step”

Return type:

int

Raises:

SpiNNUtilsException – If the simulation_time_step_us is currently unavailable

classmethod get_spalloc_job() SpallocJob | None[source]

Returns the Spalloc job, if there is one.

classmethod get_system_multicast_router_timeout_keys() Dict[Tuple[int, int], int][source]

Retrieve the system_multicast_router_timeout_keys if known. Keys are the coordinates of chips. Values are the base keys for multicast communications received by the re-injector module of the extra monitor running on those chips.

Return type:

dict(tuple(int,int), int)

Raises:

SpiNNUtilsException – If the system_multicast_router_timeout_keys is currently unavailable

classmethod get_system_provenance_dir_path() str[source]

Returns the path to the directory that holds system provenance files.

This will be the path used by the last run call or to be used by the next run if it has not yet been called.

Note

In unit-test mode this returns a temporary directory shared by all path methods.

Return type:

str

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod get_time_scale_factor() int | float[source]
Return type:

int or float

Raises:
  • SpiNNUtilsException – If the time_scale_factor is currently unavailable

  • SpiNNUtilsException – If the time_scale_factor is currently unavailable

classmethod get_timestamp_dir_path() str[source]

Returns path to existing time-stamped directory in the reports directory.

Note

In unit-test mode this returns a temporary directory shared by all path methods.

Return type:

str

Raises:

SpiNNUtilsException – If the simulation_time_step is currently unavailable

classmethod has_allocation_controller() bool[source]

Reports if an AllocationController object has already been set.

Returns:

True if and only if an AllocationController has been added and not reset.

Return type:

bool

classmethod has_buffer_manager() bool[source]

Reports if a BufferManager object has already been set.

Returns:

True if and only if a BufferManager has been added and not reset

Return type:

bool

classmethod has_ipaddress() bool[source]

Detects if the IP address of the board with chip 0,0 is known.

Return type:

bool

classmethod has_java_caller() bool[source]

Reports if there is a Java called that can be used.

Equivalent to get_config_bool(“Java”, “use_java”) as the writer will have created the caller during setup

The behaviour when Mocked is currently to always return False.

Return type:

bool

classmethod has_live_packet_recorder_params() bool[source]

Reports if there are live_packet_recorder_params.

If True the live_packet_recorder_params not be empty

Return type:

bool

classmethod has_max_run_time_steps() bool[source]

Indicates if max_run_time_steps is currently available.

Return type:

bool

classmethod has_monitors() bool[source]

Detect is ExtraMonitorSupportMachineVertex(s) have been created.

Return type:

bool

classmethod has_n_boards_required() bool[source]

Reports if a user has sets the number of boards requested during setup.

Return type:

bool

Raises:

SpiNNUtilsException – If n_boards_required is not set or set to None

classmethod has_n_chips_needed() bool[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:

bool

classmethod has_time_scale_factor() bool[source]
Return type:

bool

classmethod has_time_step() bool[source]

Check if any/all of the time_step values are known.

True When all simulation/hardware_time_step methods are known False when none of the simulation/hardware_time_step values are known. There is never a case when some are known and others not

Return type:

bool

classmethod iterate_database_socket_addresses() Iterator[SocketAddress][source]

Iterates over the registered database_socket_addresses.

Return type:

iterable(SocketAddress)

classmethod iterate_gather_items() Iterable[Tuple[Chip, DataSpeedUpPacketGatherMachineVertex]][source]

Iterates over the (x,y) and DataSpeedUpPacketGatherMachineVertex.

get_n_gathers returns the number of items this iterable will provide

Return type:

iterable(tuple(Chip,DataSpeedUpPacketGatherMachineVertex))

Raises:

SpiNNUtilsException – If the gathers are currently unavailable

classmethod iterate_gathers() Iterable[DataSpeedUpPacketGatherMachineVertex][source]

Iterates over the DataSpeedUpPacketGatherMachineVertex(s).

Return type:

iterable(DataSpeedUpPacketGatherMachineVertex)

Raises:

SpiNNUtilsException – If the gathers are currently unavailable

classmethod iterate_live_output_devices() Iterable[LiveOutputDevice][source]

Iterate over live output devices.

Return type:

iterable(LiveOutputDevice)

classmethod iterate_live_output_vertices() Iterable[Tuple[ApplicationVertex, str]][source]

Get an iterator over the live output vertices and partition IDs.

Return type:

iterable(tuple(ApplicationVertex, str))

classmethod iterate_monitor_items() Iterable[Tuple[Chip, ExtraMonitorSupportMachineVertex]][source]

Iterates over the Chip and ExtraMonitorSupportMachineVertex.

get_n_monitors returns the number of items this iterable will provide.

Return type:

iterable(tuple(Chip,ExtraMonitorSupportMachineVertex))

Raises:

SpiNNUtilsException – If the monitors are currently unavailable

classmethod iterate_monitors() Iterable[ExtraMonitorSupportMachineVertex][source]

Iterates over the ExtraMonitorSupportMachineVertex(s).

Return type:

iterable(ExtraMonitorSupportMachineVertex)

Raises:

SpiNNUtilsException – If the monitors are currently unavailable