spinn_front_end_common.interface package

Subpackages

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(*, n_boards_required: int | None = None, n_chips_required: int | None = None, timestep: float | None = None, time_scale_factor: float | None = None)[source]

Bases: ConfigHandler

Main interface into the tools logic flow.

Parameters:
  • n_boards_requiredNone or the number of boards requested by the user

  • n_chips_requiredNone or the number of chips requested by the user

  • timestep – An explicitly specified time step for the simulation in ms. If None, the value is read from the configuration

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

continue_simulation() None[source]

Continue a simulation that has been started in stepped mode.

exception_handler(exc_type: Type[BaseException], value: BaseException, traceback_obj: TracebackType | None) None[source]

Handler of exceptions.

Parameters:
  • exc_type – the type of exception received

  • value – the value of the exception

  • traceback_obj – the trace back stuff

get_machine() Machine[source]

Get the Machine. Creating it if necessary.

This method will make sure that any set called before the next run is hard.

If called after a reset it will return a different Machine to the one from the previous run.

Returns:

The Machine now stored in the DataView

property get_number_of_available_cores_on_machine: int

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

reset() None[source]

Puts the simulation back at time zero.

run(run_time: float | None, sync_time: float = 0) None[source]

Run a simulation for a fixed amount of time.

Parameters:
  • run_time – the run duration in milliseconds.

  • sync_time – 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: int | None = None) None[source]

Run a simulation until it completes.

Parameters:

n_steps – 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.

stop() None[source]

End running of the simulation.

stop_run() None[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.

Raises:

SpiNNUtilsException – If the stop_run was not expected in the current state.

spinn_front_end_common.interface.config_handler module

class spinn_front_end_common.interface.config_handler.ConfigHandler(n_boards_required: int | None = None, n_chips_required: int | None = None)[source]

Bases: AbstractSpiNNManSimulation

Superclass of AbstractSpinnakerBase that handles function only dependent of the configuration and the order its methods are called.

Parameters:
  • n_boards_requiredNone or the number of boards requested by the user

  • n_chips_requiredNone or the number of chips requested by the user

spinn_front_end_common.interface.config_setup module

spinn_front_end_common.interface.config_setup.add_spinnaker_cfg() None[source]

Add the local configuration and all dependent configuration files.

spinn_front_end_common.interface.config_setup.add_spinnaker_template() None[source]

Adds the template for the users cfg file

spinn_front_end_common.interface.config_setup.fec_cfg_paths_skipped() Set[str][source]

Set of cfg path that may not be found based on other cfg settings

Assuming mode = Debug

Returns:

list of cfg path options that point to paths that may not exist

spinn_front_end_common.interface.config_setup.unittest_setup() None[source]

Does all the steps that may be required before a unit test.

Resets the configurations so only the local default configurations are included.

Unsets any previous simulators and temporary directories.

Note

This file should only be called from spinn_front_end_common/tests

spinn_front_end_common.interface.java_caller module

class spinn_front_end_common.interface.java_caller.JavaCaller[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/configuration parameters.

Raises:

ConfigurationException – if simple parameter checking fails.

classmethod check_java() str[source]

Reads and checks the Java call

Returns:

Java call from cfg

Raises:
extract_all_data() None[source]

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

:raises subprocess.CalledProcessError

On failure of the Java code.

load_app_data_specification(use_monitors: bool) None[source]

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

Note

May assume that system cores are already loaded and running if use_monitors is set to True.

Parameters:

use_monitors

Raises:

subprocess.CalledProcessError – On failure of the Java code.

load_system_data_specification() None[source]

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

Raises:

subprocess.CalledProcessError – On failure of the Java code.

set_advanced_monitors() None[source]

Create information describing what’s going on with the monitor cores.

set_placements(used_placements: Iterable[Placement]) None[source]

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

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:

used_placements – Placements that are recording. May not be all placements

spinn_front_end_common.interface.spinnaker module

class spinn_front_end_common.interface.spinnaker.SpiNNaker(*, n_boards_required: int | None = None, n_chips_required: int | None = None, timestep: float | None = None, time_scale_factor: float | None = None)[source]

Bases: AbstractSpinnakerBase

The implementation of the SpiNNaker simulation interface.

Note

You can instantiate this directly from application code. It is the callers responsibility to only have a single instance.

Parameters:
  • n_boards_requiredNone or the number of boards requested by the user

  • n_chips_requiredNone or the number of chips requested by the user

  • timestep – An explicitly specified time step for the simulation in ms. If None, the value is read from the configuration

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

Module contents