spinn_front_end_common.interface package

Submodules

spinn_front_end_common.interface.abstract_spinnaker_base module

main interface for the SpiNNaker tools

class spinn_front_end_common.interface.abstract_spinnaker_base.AbstractSpinnakerBase(configfile, executable_finder, graph_label=None, database_socket_addresses=None, extra_algorithm_xml_paths=None, n_chips_required=None, n_boards_required=None, default_config_paths=None, validation_cfg=None, front_end_versions=None)[source]

Bases: spinn_front_end_common.interface.config_handler.ConfigHandler, spinn_front_end_common.utilities.simulator_interface.SimulatorInterface

Main interface into the tools logic flow

Parameters:
  • configfile (str) – What the configuration file is called
  • executable_finder (ExecutableFinder) – How to find APLX files to deploy to SpiNNaker
  • graph_label (str) – A label for the overall application graph
  • database_socket_addresses (iterable(SocketAddress)) – How to talk to notification databases
  • extra_algorithm_xml_paths (iterable(str)) – Where to load definitions of extra algorithms from
  • n_chips_required (int) – Overrides the number of chips to allocate from spalloc
  • n_boards_required (int) – Overrides the number of boards to allocate from spalloc
  • default_config_paths (list(str)) – Directories to load configurations from
  • validation_cfg (str) – How to validate configuration files
  • front_end_versions (list(tuple(str,str))) – information about what software is in use
add_application_edge(edge_to_add, partition_identifier)[source]
Parameters:
  • edge_to_add
  • partition_identifier (str) – the partition identifier for the outgoing edge partition
Type:

ApplicationEdge

Return type:

None

add_application_vertex(vertex)[source]
Parameters:

vertex – the vertex to add to the graph

Type:

ApplicationVertex

Return type:

None

Raises:
  • ConfigurationException – when both graphs contain vertices
  • PacmanConfigurationException – If there is an attempt to add the same vertex more than once
add_extraction_timing(timing)[source]

Record the time taken for doing data extraction.

add_live_packet_gatherer_parameters(live_packet_gatherer_params, vertex_to_record_from, partition_ids)[source]

Adds params for a new LPG if needed, or adds to the tracker for same params.

Parameters:
  • live_packet_gatherer_params – params to look for a LPG
  • vertex_to_record_from – the vertex that needs to send to a given LPG
  • partition_ids – the IDs of the partitions to connect from the vertex
Return type:

None

add_machine_edge(edge, partition_id)[source]
Parameters:
  • edge – the edge to add to the graph
  • partition_id (str) – the partition identifier for the outgoing edge partition
Type:

MachineEdge

Return type:

None

add_machine_vertex(vertex)[source]
Parameters:

vertex – the vertex to add to the graph

Type:

MachineVertex

Return type:

None

Raises:
  • ConfigurationException – when both graphs contain vertices
  • PacmanConfigurationException – If there is an attempt to add the same vertex more than once
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
  • socket_address – The address of the database socket
Return type:

None

Return type:

None

application_graph

The application graph used to derive the runtime machine configuration.

buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

dsg_algorithm

The DSG algorithm used by the tools

exception_handler(exctype, value, traceback_obj)[source]

Handler of exceptions

Parameters:
  • exctype – the type of execution received
  • value – the value of the exception
  • traceback_obj – the trace back stuff
extend_extra_load_algorithms(extra_load_algorithms)[source]

Add custom data-loading algorithms to the sequence of such algorithms to be run.

Parameters:extra_load_algorithms (list) – Algorithms to add
extend_extra_mapping_algorithms(extra_mapping_algorithms)[source]

Add custom mapping algorithms to the end of the sequence of mapping algorithms to be run.

Parameters:extra_mapping_algorithms (list) – Algorithms to add
extend_extra_post_run_algorithms(extra_post_run_algorithms)[source]

Add custom post-execution algorithms to the sequence of such algorithms to be run.

Parameters:extra_post_run_algorithms (list) – Algorithms to add
fixed_routes
generate_file_machine()[source]

Generates a machine JSON file

get_current_time()[source]

Get the current simulation time.

Return type:float
get_generated_output(name_of_variable)[source]

Get the value of an inter-algorithm variable.

Parameters:name_of_variable (str) – The variable to retrieve
Returns:The value (of arbitrary type), or None if the variable is not found.
get_number_of_available_cores_on_machine

The number of available cores on the machine after taking into account preallocated resources.

Returns:number of available cores
Return type:int
graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
has_reset_last
increment_none_labelled_edge_count()[source]

Increment the number of new edges which have not been labelled.

machine

The python machine description object.

Return type:Machine
machine_graph
no_machine_time_steps

The number of machine time steps.

Return type:int
none_labelled_edge_count

The number of times edges have not been labelled.

original_application_graph
original_machine_graph
placements
prepend_extra_pre_run_algorithms(extra_pre_run_algorithms)[source]

Add custom pre-execution algorithms to the front of the sequence of algorithms to be run.

Parameters:extra_pre_run_algorithms (list) – Algorithms to add
reset()[source]

Code that puts the simulation back at time zero

routing_infos
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:
  • run_time – the run duration in milliseconds. Run a simulation for a fixed amount of time
  • run_time – the run duration in milliseconds.
run_until_complete()[source]

Run a simulation until it completes

set_n_boards_required(n_boards_required)[source]

Sets the machine requirements.

Warning: This method should not be called after the machine requirements have be computed based on the graph.

Parameters:n_boards_required – The number of boards required
Raises:ConfigurationException If any machine requirements have already been set
set_up_machine_specifics(hostname)[source]

Adds machine specifics for the different modes of execution

Parameters:hostname (str) – machine name
Return type:None
stop(turn_off_machine=None, clear_routing_tables=None, clear_tags=None)[source]

End running of the simulation.

Parameters:
  • turn_off_machine (bool) – decides if the machine should be powered down after running the execution. Note that this powers down all boards connected to the BMP connections given to the transceiver
  • clear_routing_tables (bool) – informs the tool chain if it should turn off the clearing of the routing tables
  • clear_tags (boolean) – informs the tool chain if it should clear the tags off the machine at stop
Return type:

None

stop_run()[source]

Request that the current infinite run stop.

Note

This will need to be called from another thread as the infinite run call is blocking.

tags
timescale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
update_extra_inputs(extra_inputs)[source]

Supply extra inputs to the runtime algorithms. Mappings are from known names (the logical type names) to the values to bind to them.

Parameters:extra_inputs (dict(str,any)) – The additional inputs to provide
update_extra_mapping_inputs(extra_mapping_inputs)[source]

Supply extra inputs to the mapping algorithms. Mappings are from known names (the logical type names) to the values to bind to them.

Parameters:extra_inputs (dict(str,any)) – The additional inputs to provide
use_virtual_board

True if this run is using a virtual machine

verify_not_running()[source]

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

spinn_front_end_common.interface.abstract_spinnaker_base.DEFAULT_N_VIRTUAL_CORES = 16

Number of cores to be used when using a Virtual Machine and not specified

spinn_front_end_common.interface.abstract_spinnaker_base.MINIMUM_OFF_STATE_TIME = 20

The minimum time a board is kept in the off state, in seconds

spinn_front_end_common.interface.config_handler module

class spinn_front_end_common.interface.config_handler.ConfigHandler(configfile, default_config_paths, validation_cfg)[source]

Bases: object

Subclass of AbstractSpinnaker base that handles function only dependent of the config and the order its methods are called

child_folder(parent, child_name, must_create=False)[source]
Parameters:must_create – If True, the directory named by child_name (but not necessarily its parents) must be created by this call, and an exception will be thrown if this fails.
Raises:OSError – if the directory existed ahead of time and creation was required by the user
machine_time_step
set_up_output_application_data_specifics(n_calls_to_run)[source]
Parameters:n_calls_to_run (int) – the counter of how many times run has been called.
Returns:the run folder for this simulation to hold app data
set_up_timings(machine_time_step=None, time_scale_factor=None)[source]

Set up timings of the machine

Parameters:
  • machine_time_step – An explicitly specified time step for the machine. If None, the value is read from the config
  • time_scale_factor – An explicitly specified time scale factor for the simulation. If None, the value is read from the config
time_scale_factor
write_finished_file()[source]

Write a finished file that allows file removal to only remove folders that are finished.

spinn_front_end_common.interface.java_caller module

class spinn_front_end_common.interface.java_caller.JavaCaller(json_folder, java_call, java_spinnaker_path=None, java_properties=None)[source]

Bases: object

Support class that holds all the stuff for running stuff in Java. This includes the work of preparing data for transmitting to Java and back.

This separates the choices of how to call the Java batch vs streaming, jar locations, parameters, etc from the rest of the python code.

Creates a java caller and checks the user/config parameters.

Parameters:
  • json_folder (str) – The location where the machine JSON is written.
  • java_call (str) – Call to start java. Including the path if required.
  • java_spinnaker_path – the path where the java code can be found. This must point to a local copy of https://github.com/SpiNNakerManchester/JavaSpiNNaker. It must also have been built! If None the assumption is that it is the same parent directory as https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon.
  • java_properties (str) – Optional properties that will be passed to Java. Must start with -D. For example -Dlogging.level=DEBUG
Raises:

ConfigurationException – if simple parameter checking fails.

execute_app_data_specification(use_monitors)[source]

Writes all the data specs for application cores, uploading the result to the machine.

execute_data_specification()[source]

Writes all the data specs, uploading the result to the machine.

execute_system_data_specification()[source]

Writes all the data specs for system cores, uploading the result to the machine.

get_all_data()[source]

Gets all the data from the previously set placements and put these in the previously set database.

set_advanced_monitors(placements, tags, monitor_cores, packet_gathers)[source]
Parameters:
  • placements (Placements) – The placements of the vertices
  • tags (Tags) – The tags assigned to the vertices
  • monitor_cores (dict(Vertex,Vertex)) – Where the advanced monitor for each core is
  • packet_gathers (dict(Vertex,Vertex)) – Where the packet gatherers are
Return type:

None

set_machine(machine)[source]

Passes the machine in leaving this class to decide pass it to Java.

Parameters:machine (Machine) – A machine Object
set_placements(placements, transceiver)[source]

Passes in the placements leaving this class to decide pass it to Java.

This method may obtain extra information about he placements which is why it also needs the transceiver.

Currently the extra information extracted is recording region base address but this could change if recording region saved in the database.

Currently this method uses JSON but that may well change to using the database.

Parameters:
set_report_folder(report_folder)[source]

Passes the database file in.

Parameters:report_folder (str) – Path to directory with SQLite databases and into which java will write

spinn_front_end_common.interface.simulator_state module

class spinn_front_end_common.interface.simulator_state.Simulator_State(value, doc='')[source]

Bases: enum.Enum

Different states the Simulator could be in.

FINISHED = 3

run ended shutdown not called

INIT = 0

init called

IN_RUN = 1

inside run method

RUN_FOREVER = 2

finished run method, but running forever

SHUTDOWN = 4

shutdown called

STOP_REQUESTED = 5

stop requested in middle of run forever

Module contents