spinnaker_graph_front_end package

Submodules

spinnaker_graph_front_end.config_setup module

spinnaker_graph_front_end.config_setup.CONFIG_FILE_NAME = 'spiNNakerGraphFrontEnd.cfg'

The name of the configuration file

spinnaker_graph_front_end.config_setup.setup_configs()[source]

Sets up the configs including the user’s cfg file.

Clears out any previous read configs but does not load the new configs so a warning is generated if a config is used before setup is called.

spinnaker_graph_front_end.config_setup.unittest_setup()[source]

Does all the steps that may be required before a unittest.

Resets the configs so only the local default configs are included. The user cfg is not included!

Unsets any previous simulators and tempdirs

Note

This file should only be called from sPyNNaker tests that do not call sim.setup

spinnaker_graph_front_end.spinnaker module

class spinnaker_graph_front_end.spinnaker.SpiNNaker(n_chips_required=None, n_boards_required=None, time_scale_factor=None, machine_time_step=None)[source]

Bases: spinn_front_end_common.interface.abstract_spinnaker_base.AbstractSpinnakerBase

The implementation of the SpiNNaker simulation interface.

Note

You should not normally instantiate this directly from user code. Call setup() instead.

Parameters:
  • n_chips_required (int) – How many chips are required. Prefer n_boards_required if possible.
  • n_boards_required (int) – How many boards are required. Unnecessary with a local board.
  • time_scale_factor (int) – The time slow-down factor
  • machine_time_step (int) – The size of the machine time step, in microseconds

Module contents

The API for running SpiNNaker simulations based on a basic (non-neural) graph.

The general usage pattern for this API something like is:

import spinnaker_graph_front_end as gfe

# Uses information from your configuration file
# You might need to specify how many SpiNNaker boards to allocate
gfe.setup()

# Make the bits that do the computation
for each vertex to add:
    gfe.add_vertex_instance(vertex)

# Connect them together so computations are coordinated
for each edge to add:
    gfe.add_edge_instance(edge)

# Actually plan and run the simulation
gfe.run(number_of_steps)

# Get the results back; what this means can be complex
for each vertex:
    results += vertex.retrieve_relevant_results()

# Shut everything down
# Only your retrieved results really exist after this
gfe.stop()

# Analyse/render the results; totally application-specific!

It is possible to use GFE-style vertices in a neural graph (e.g., to simulate the external world). Talk to the SpiNNaker team for more details.

spinnaker_graph_front_end.add_edge_instance(edge, partition_id)[source]

Add an edge to the unpartitioned graph.

Parameters:
  • edge (ApplicationEdge) – The edge to add.
  • partition_id (str) – The ID of the partition that the edge belongs to.
spinnaker_graph_front_end.add_socket_address(database_ack_port_num, database_notify_host, database_notify_port_num)[source]

Add a socket address for the notification protocol.

Parameters:
  • database_ack_port_num (int) – port number to send acknowledgement to
  • database_notify_host (str) – host IP to send notification to
  • database_notify_port_num (int) – port that the external device will be notified on.
spinnaker_graph_front_end.add_vertex_instance(vertex_to_add)[source]

Add an existing application vertex to the unpartitioned graph.

Parameters:vertex_to_add (ApplicationVertex) – vertex instance to add to the graph
spinnaker_graph_front_end.buffer_manager()[source]

Get the buffer manager being used for loading/extracting buffers.

Return type:BufferManager
spinnaker_graph_front_end.get_number_of_available_cores_on_machine()[source]

Get the number of cores on this machine that are available to the simulation.

Return type:int
spinnaker_graph_front_end.has_ran()[source]

Get whether the simulation has already run.

Return type:bool
spinnaker_graph_front_end.is_allocated_machine()[source]

Get whether a machine is allocated.

Return type:bool
spinnaker_graph_front_end.machine()[source]

Get the model of the attached/allocated machine.

Return type:Machine
spinnaker_graph_front_end.placements()[source]

Get the placements.

Deprecated since version 7.0: No Longer supported! Use View iterate_placements instead

Instead of:

front_end.placements().placements

Use:

FecDataView.iterate_placemements()

FecDataView can be imported from spinn_front_end_common.data

class spinnaker_graph_front_end.ReverseIpTagMultiCastSource(n_keys, label=None, max_atoms_per_core=9223372036854775807, receive_port=None, receive_sdp_port=1, receive_tag=None, receive_rate=10, virtual_key=None, prefix=None, prefix_type=None, check_keys=False, send_buffer_times=None, send_buffer_partition_id=None, reserve_reverse_ip_tag=False, injection_partition_id=None, splitter=None)[source]

Bases: spinn_front_end_common.utility_models.reverse_ip_tag_multi_cast_source.ReverseIpTagMultiCastSource

For full documentation see ReverseIpTagMultiCastSource.

Parameters:
  • n_keys (int) – The number of keys to be sent via this multicast source
  • label (str) – The label of this vertex
  • max_atoms_per_core (int) –
  • board_address (str or None) – The IP address of the board on which to place this vertex if receiving data, either buffered or live (by default, any board is chosen)
  • receive_port (int or None) – The port on the board that will listen for incoming event packets (default is to disable this feature; set a value to enable it)
  • receive_sdp_port (int) – The SDP port to listen on for incoming event packets (defaults to 1)
  • receive_tag (IPTag) – The IP tag to use for receiving live events (uses any by default)
  • receive_rate (float) – The estimated rate of packets that will be sent by this source
  • virtual_key (int) – The base multicast key to send received events with (assigned automatically by default)
  • prefix (int) – The prefix to “or” with generated multicast keys (default is no prefix)
  • prefix_type (EIEIOPrefix) – Whether the prefix should apply to the upper or lower half of the multicast keys (default is upper half)
  • check_keys (bool) – True if the keys of received events should be verified before sending (default False)
  • send_buffer_times (ndarray(ndarray(numpy.int32)) or list(ndarray(int32)) or None) – An array of arrays of times at which keys should be sent (one array for each key, default disabled)
  • send_buffer_partition_id (str or None) – The ID of the partition containing the edges down which the events are to be sent
  • reserve_reverse_ip_tag (bool) – Extra flag for input without a reserved port
  • injection_partition (str) – If not None, will enable injection and specify the partition to send injected keys with
  • splitter (None or AbstractSplitterCommon) – the splitter object needed for this vertex
spinnaker_graph_front_end.routing_infos()[source]

Get information about how messages are routed on the machine.

Return type:RoutingInfo
spinnaker_graph_front_end.run(duration=None)[source]

Run a simulation for a number of microseconds.

Parameters:duration (int) – the number of microseconds the application code should run for
spinnaker_graph_front_end.setup(model_binary_module=None, model_binary_folder=None, database_socket_addresses=(), n_chips_required=None, n_boards_required=None, time_scale_factor=None, machine_time_step=None)[source]

Set up a graph, ready to have vertices and edges added to it, and the simulator engine that will execute the graph.

Note

This must be called before the other functions in this API.

Parameters:
  • model_binary_module (ModuleType) – the Python module where the binary files (.aplx) can be found for the compiled C code that is being used in this application; mutually exclusive with the model_binary_folder.
  • model_binary_folder (str) – the folder where the binary files can be found for the c code that is being used in this application; mutually exclusive with the model_binary_module.
  • database_socket_addresses (Iterable(SocketAddress)) – set of SocketAddresses to be added for the database notification system. These are over and above the ones used by the LiveEventConnection
  • n_chips_required (int or None) – Deprecated! Use n_boards_required instead. Must be None if n_boards_required specified.
  • n_boards_required (int or None) – if you need to be allocated a machine (for spalloc) before building your graph, then fill this in with a general idea of the number of boards you need so that the spalloc system can allocate you a machine big enough for your needs.
Raises:

ConfigurationException – if mutually exclusive options are given.

spinnaker_graph_front_end.stop()[source]

Do any necessary cleaning up before exiting. Unregisters the controller.