# 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, n_chips_required=None, n_boards_required=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 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
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_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
check_machine_specifics()[source]

Checks machine specifics for the different modes of execution.

Not this can only be called from a class that sets the config file to read this data from.

continue_simulation()[source]

Continue a simulation that has been started in stepped mode

do_info_allocator()[source]

Runs, times and logs one of the info allocaters

Sets the “routing_info” data

Which alloactor is run depends on the cfg info_allocator value

This method is the entry point for adding a new Info Allocator

Raises: ConfigurationException – if the cfg info_allocator value is unexpected
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
fixed_routes
Return type: dict(tuple(int,int),FixedRouteEntry)
get_current_time()[source]

Get the current simulation time.

Return type: float
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.

items()[source]

Lists the keys of the data currently available.

Keys exposed this way are limited to the ones needed for injection

Returns: List of the keys for which there is data list(str) KeyError – Amethod this call depends on could raise this exception, but that indicates a programming mismatch
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

n_calls_to_run

The number for this or the next end_user call to run

Return type: int
n_loops

The number for this or the net loop within an end_user run

Return type: int or None
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
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
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
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.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_errored_file()[source]

Writes a errored file that allows file removal to only remove folders that are errored if requested to do so :rtype:

write_finished_file()[source]

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

## 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.