# spinn_front_end_common.interface package¶

## 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(executable_finder, graph_label=None, database_socket_addresses=None, extra_algorithm_xml_paths=None, n_chips_required=None, n_boards_required=None, front_end_versions=None)[source]

Main interface into the tools logic flow.

Parameters: 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) or None) – 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 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 (ApplicationEdge) – the edge to add to the graph partition_identifier (str) – the partition identifier for the outgoing edge partition
add_application_vertex(vertex)[source]
Parameters: vertex (ApplicationVertex) – the vertex to add to the graph 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.

Parameters: timing (timedelta) –
add_live_packet_gatherer_parameters(live_packet_gatherer_params, vertex_to_record_from, partition_ids)[source]

Adds parameters for a new LPG if needed, or adds to the tracker for parameters. Note that LPGs can be inserted to track behaviour either at the application graph level or at the machine graph level, but not both at the same time.

Parameters: live_packet_gatherer_params (LivePacketGatherParameters) – params to look for a LPG vertex_to_record_from (AbstractVertex) – the vertex that needs to send to a given LPG partition_ids (list(str)) – the IDs of the partitions to connect from the vertex
add_machine_edge(edge, partition_id)[source]
Parameters: edge (MachineEdge) – the edge to add to the graph partition_id (str) – the partition identifier for the outgoing edge partition
add_machine_vertex(vertex)[source]
Parameters: vertex (MachineVertex) – the vertex to add to the graph 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]

application_graph
The protected view of the application graph used to derive the
runtime machine configuration.
Return type: ApplicationGraph
buffer_manager

Return type: BufferManager
continue_simulation()[source]

Continue a simulation that has been started in stepped mode

dsg_algorithm

The DSG algorithm used by the tools

Return type: str
exception_handler(exctype, value, traceback_obj)[source]

Handler of exceptions

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

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(str)) – 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(str)) – Algorithms to add
fixed_routes
Return type: dict(tuple(int,int),FixedRouteEntry)
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 The value (of arbitrary type), or None if the variable is not found. ConfigurationException – If the simulation hasn’t yet run
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 int
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

Returns a protected view of the machine_graph :rtype: ~pacman.model.graphs.machine.MachineGraph

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.

Return type: int
original_application_graph
Return type: ApplicationGraph
original_machine_graph
Return type: MachineGraph
placements

Where machine vertices are placed on the machine.

Return type: 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(str)) – Algorithms to add
reset()[source]

Code that puts the simulation back at time zero

routing_infos
Return type: RoutingInfo
run(run_time, sync_time=0)[source]

Run a simulation for a fixed amount of time

Parameters: run_time (int) – the run duration in milliseconds. sync_time (float) – If not 0, this specifies that the simulation should pause after this duration. The continue_simulation() method must then be called for the simulation to continue.
run_until_complete(n_steps=None)[source]

Run a simulation until it completes

Parameters: n_steps (int) – If not None, this specifies that the simulation should be requested to run for the given number of steps. The host will still wait until the simulation itself says it has completed
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 (int) – The number of boards required 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
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 (bool) – informs the tool chain if it should clear the tags off the machine at stop
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
Return type: Tags
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

Return type: bool
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[source]

Bases: object

Superclass of AbstractSpinnakerBase 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: parent (str) – child_name (str) – must_create (bool) – 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. The fully qualified name of the child folder. str OSError – if the directory existed ahead of time and creation was required by the user
machine_time_step

The machine timestep, in microseconds

Return type: int
machine_time_step_ms

The machine timestep, in milli_seconds

Return type: float
machine_time_step_per_ms

The machine timesteps in a milli_second

Return type: float
set_up_timings(machine_time_step=None, time_scale_factor=None)[source]

Set up timings of the machine

Parameters: machine_time_step (int or None) – An explicitly specified time step for the machine. If None, the value is read from the config time_scale_factor (int or None) – An explicitly specified time scale factor for the simulation. If None, the value is read from the config
time_scale_factor

The time scaling factor. :rtype: int

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, java_jar_path=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 (str) – 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 ConfigurationException – if simple parameter checking fails.
execute_app_data_specification(use_monitors)[source]
Writes all the data specs for application cores,
Parameters: use_monitors (bool) – PacmanExternalAlgorithmFailedToCompleteException – On failure of the Java code.
execute_data_specification()[source]

Raises: PacmanExternalAlgorithmFailedToCompleteException – On failure of the Java code.
execute_system_data_specification()[source]
Writes all the data specs for system cores,
Raises: PacmanExternalAlgorithmFailedToCompleteException – On failure of the Java code.
get_all_data()[source]
Gets all the data from the previously set placements
and put these in the previously set database.
Raises: PacmanExternalAlgorithmFailedToCompleteException – On failure of the Java code.
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(tuple(int,int), ExtraMonitorSupportMachineVertex)) – Where the advanced monitor for each core is packet_gathers (dict(tuple(int,int), DataSpeedUpPacketGatherMachineVertex)) – Where the packet gatherers are 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: placements (Placements) – The Placements Object transceiver (Transceiver) – The Transceiver
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.