spinn_front_end_common.utilities package

Submodules

spinn_front_end_common.utilities.constants module

class spinn_front_end_common.utilities.constants.BUFFERING_OPERATIONS[source]

Bases: enum.Enum

A listing of what SpiNNaker specific EIEIO commands there are.

BUFFER_READ = 0
BUFFER_WRITE = 1
class spinn_front_end_common.utilities.constants.SDP_PORTS[source]

Bases: enum.Enum

SDP port handling output buffering data streaming

EXTRA_MONITOR_CORE_DATA_IN_SPEED_UP = 6
EXTRA_MONITOR_CORE_DATA_SPEED_UP = 5
EXTRA_MONITOR_CORE_REINJECTION = 4
INPUT_BUFFERING_SDP_PORT = 1
OUTPUT_BUFFERING_SDP_PORT = 2
RUNNING_COMMAND_SDP_PORT = 3
class spinn_front_end_common.utilities.constants.SDP_RUNNING_MESSAGE_CODES[source]

Bases: enum.Enum

SDP_CLEAR_IOBUF_CODE = 9
SDP_NEW_RUNTIME_ID_CODE = 7
SDP_STOP_ID_CODE = 6
SDP_UPDATE_PROVENCE_REGION_AND_EXIT = 8

spinn_front_end_common.utilities.exceptions module

exception spinn_front_end_common.utilities.exceptions.BufferableRegionTooSmall[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when the SDRAM space of the region for buffered packets is too small to contain any packet at all

exception spinn_front_end_common.utilities.exceptions.BufferedRegionNotPresent[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when trying to issue buffered packets for a region not managed

exception spinn_front_end_common.utilities.exceptions.ConfigurationException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when the front end determines a input parameter is invalid

exception spinn_front_end_common.utilities.exceptions.ExecutableFailedToStartException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when an executable has not entered the expected state during start up

exception spinn_front_end_common.utilities.exceptions.ExecutableFailedToStopException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when an executable has not entered the expected state during execution

exception spinn_front_end_common.utilities.exceptions.ExecutableNotFoundException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when a specified executable could not be found

exception spinn_front_end_common.utilities.exceptions.RallocException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when there are not enough routing table entries

exception spinn_front_end_common.utilities.exceptions.SpinnFrontEndException[source]

Bases: exceptions.Exception

Raised when the front end detects an error

spinn_front_end_common.utilities.function_list module

spinn_front_end_common.utilities.function_list.get_front_end_common_pacman_xml_paths()[source]

Get the XML path for the front end common interface functions

Return type:list(str)

spinn_front_end_common.utilities.globals_variables module

spinn_front_end_common.utilities.globals_variables.get_not_running_simulator()[source]

Get the current simulator object and verify that it is not running.

Return type:SimulatorInterface
spinn_front_end_common.utilities.globals_variables.get_simulator()[source]

Get the current simulator object.

Return type:SimulatorInterface
spinn_front_end_common.utilities.globals_variables.has_simulator()[source]

Check if a simulator is operational.

Return type:bool
spinn_front_end_common.utilities.globals_variables.set_failed_state(new_failed_state)[source]

Install a marker to say that the simulator has failed.

Parameters:new_failed_state (FailedState) – the failure marker
spinn_front_end_common.utilities.globals_variables.set_simulator(new_simulator)[source]

Set the current simulator object.

Parameters:new_simulator (SimulatorInterface) – The simulator to set.
spinn_front_end_common.utilities.globals_variables.unset_simulator()[source]

Destroy the current simulator.

spinn_front_end_common.utilities.helpful_functions module

spinn_front_end_common.utilities.helpful_functions.convert_string_into_chip_and_core_subset(cores)[source]

Translate a string list of cores into a core subset

Parameters:cores (str or None) – string representing down cores formatted as x,y,p[:x,y,p]*
Return type:CoreSubsets
spinn_front_end_common.utilities.helpful_functions.convert_time_diff_to_total_milliseconds(sample)[source]

Convert between a time diff and total milliseconds.

Returns:total milliseconds
Return type:float
spinn_front_end_common.utilities.helpful_functions.convert_vertices_to_core_subset(vertices, placements)[source]

Converts vertices into core subsets.

Parameters:
  • vertices – the vertices to convert to core subsets
  • placements (Placements) – the placements object
Returns:

the CoreSubSets of the vertices

Return type:

CoreSubsets

spinn_front_end_common.utilities.helpful_functions.determine_flow_states(executable_types, no_sync_changes)[source]

Get the start and end states for these executable types.

Parameters:
  • executable_types (dict(ExecutableType,any)) – the execute types to locate start and end states from
  • no_sync_changes (int) – the number of times sync signals been sent
Returns:

dict of executable type to states.

Return type:

tuple(dict(ExecutableType,CPUState), dict(ExecutableType,CPUState))

spinn_front_end_common.utilities.helpful_functions.emergency_recover_state_from_failure(txrx, app_id, vertex, placement)[source]

Used to get at least some information out of a core when something goes badly wrong. Not a replacement for what abstract spinnaker base does.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • app_id (int) – The ID of the application.
  • vertex (AbstractHasAssociatedBinary) – The vertex to retrieve the IOBUF from if it is suspected as being dead
  • placement – Where the vertex is located.
spinn_front_end_common.utilities.helpful_functions.emergency_recover_states_from_failure(txrx, app_id, executable_targets)[source]

Used to get at least some information out of a core when something goes badly wrong. Not a replacement for what abstract spinnaker base does.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • app_id (int) – The ID of the application.
  • executable_targets (ExecutableTargets) – The what/where mapping
spinn_front_end_common.utilities.helpful_functions.find_executable_start_type(machine_vertex, graph_mapper=None)[source]
spinn_front_end_common.utilities.helpful_functions.flood_fill_binary_to_spinnaker(executable_targets, binary, txrx, app_id)[source]

flood fills a binary to spinnaker on a given app_id given the executable targets and binary.

Parameters:
  • executable_targets (ExecutableTargets) – the executable targets object
  • binary (str) – the (name of the) binary to flood fill
  • txrx (Transceiver) – spinnman instance
  • app_id (int) – the app id to load it on
Returns:

the number of cores it was loaded onto

Return type:

int

spinn_front_end_common.utilities.helpful_functions.generate_unique_folder_name(folder, filename, extension)[source]

Generate a unique file name with a given extension in a given folder

Parameters:
  • folder (str) – where to put this unique file
  • filename (str) – the name of the first part of the file without extension
  • extension (str) – extension of the file
Returns:

file path with a unique addition

Return type:

str

spinn_front_end_common.utilities.helpful_functions.get_ethernet_chip(machine, board_address)[source]

Locate the chip with the given board IP address

Parameters:
  • machine (Machine) – the SpiNNaker machine
  • board_address (str) – the board address to locate the chip of.
Returns:

The chip that supports that board address

Return type:

Chip

Raises:

ConfigurationException – when that board address has no chip associated with it

spinn_front_end_common.utilities.helpful_functions.locate_extra_monitor_mc_receiver(machine, placement_x, placement_y, packet_gather_cores_to_ethernet_connection_map)[source]
Parameters:
  • machine (Machine) – The machine descriptor
  • placement_x (int) – The X coordinate of the reference chip
  • placement_y (int) – The Y coordinate of the reference chip
  • packet_gather_cores_to_ethernet_connection_map
Type:

dict(tuple(int,int),?)

Return type:

?

spinn_front_end_common.utilities.helpful_functions.locate_memory_region_for_placement(placement, region, transceiver)[source]

Get the address of a region for a placement

Parameters:
  • region (int) – the region to locate the base address of
  • placement (Placement) – the placement object to get the region address of
  • transceiver (Transceiver) – the python interface to the SpiNNaker machine
spinn_front_end_common.utilities.helpful_functions.read_config(config, section, item)[source]

Get the string value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

str or None

spinn_front_end_common.utilities.helpful_functions.read_config_boolean(config, section, item)[source]

Get the boolean value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

bool or None

spinn_front_end_common.utilities.helpful_functions.read_config_int(config, section, item)[source]

Get the integer value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

int or None

spinn_front_end_common.utilities.helpful_functions.read_data(x, y, address, length, data_format, transceiver)[source]

Reads and converts a single data item from memory

Parameters:
  • x (int) – chip x
  • y (int) – chip y
  • address (int) – base address of the SDRAM chip to read
  • length (int) – length to read
  • data_format (str) – the format to read memory (see struct.pack)
  • transceiver (Transceiver) – the SpinnMan interface
spinn_front_end_common.utilities.helpful_functions.write_address_to_user0(txrx, x, y, p, address)[source]

Writes the given address into the user_0 register of the given core.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • x (int) – Chip coordinate.
  • y (int) – Chip coordinate.
  • p (int) – Core ID on chip.
  • address (int) – Value to write (32-bit integer)

Module contents

class spinn_front_end_common.utilities.FailedState[source]

Bases: spinn_front_end_common.utilities.simulator_interface.SimulatorInterface

Marks that the simulator has failed (and replaces said simulator).

Warning

Any method invoked on this object may fail with ConfigurationException.

add_socket_address(socket_address)[source]

Add the address of a socket used in the run notification protocol.

Parameters:socket_address (SocketAddress) – The address of the socket
Return type:None
buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
machine

The python machine description object.

Return type:Machine
machine_time_step
no_machine_time_steps

The number of machine time steps.

Return type:int
placements

Where machine vertices are placed on the machine.

Return type:Placements
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:run_time – the run duration in milliseconds.
stop()[source]

End running of the simulation.

tags
time_scale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
use_virtual_board
verify_not_running()[source]

Verify that the simulator is in a state where it can start running.

class spinn_front_end_common.utilities.SimulatorInterface[source]

Bases: object

add_socket_address(socket_address)[source]

Add the address of a socket used in the run notification protocol.

Parameters:socket_address (SocketAddress) – The address of the socket
Return type:None
buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
machine

The python machine description object.

Return type:Machine
machine_time_step
no_machine_time_steps

The number of machine time steps.

Return type:int
placements

Where machine vertices are placed on the machine.

Return type:Placements
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:run_time – the run duration in milliseconds.
stop()[source]

End running of the simulation.

tags
time_scale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
use_virtual_board
verify_not_running()[source]

Verify that the simulator is in a state where it can start running.