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.add_gfe_cfg()[source]

Add the local cfg and all dependent cfg files.

spinnaker_graph_front_end.config_setup.reset_configs()[source]

Resets the configs so only the local default config is included.

spinnaker_graph_front_end.spinnaker module

class spinnaker_graph_front_end.spinnaker.SpiNNaker(executable_finder, host_name=None, graph_label=None, database_socket_addresses=(), dsg_algorithm=None, n_chips_required=None, n_boards_required=None, extra_pre_run_algorithms=(), extra_post_run_algorithms=(), time_scale_factor=None, machine_time_step=None, extra_xml_paths=())[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:
  • executable_finder (ExecutableFinder) – How to find the executables
  • host_name (str) – The SpiNNaker machine address
  • graph_label (str) – A label for the graph
  • database_socket_addresses (Iterable(SocketAddress)) – Extra sockets that will want to be notified about the location of the runtime database.
  • dsg_algorithm (str) – Algorithm to use for generating data
  • 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.
  • extra_pre_run_algorithms (Iterable(str)) – The names of any extra algorithms to call before running
  • extra_post_run_algorithms (Iterable(str)) – The names of any extra algorithms to call after running
  • time_scale_factor (int) – The time slow-down factor
  • machine_time_step (int) – The size of the machine time step, in microseconds
  • extra_xml_paths (Iterable(str)) – Where to look for algorithm descriptors
is_allocated_machine

Is this an allocated machine? Otherwise, it is local.

Return type:bool
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:run_time (int) – the run duration in milliseconds.

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_machine_vertex_instance(vertex)

# Connect them together so computations are coordinated
for each edge to add:
    gfe.add_machine_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.

class spinnaker_graph_front_end.LivePacketGather(lpg_params, constraints=None)[source]

Bases: spinn_front_end_common.utility_models.live_packet_gather.LivePacketGather

For full documentation see LivePacketGather.

Parameters:
class spinnaker_graph_front_end.ReverseIpTagMultiCastSource(n_keys, label=None, constraints=None, max_atoms_per_core=9223372036854775807, board_address=None, 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, enable_injection=False, 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
  • constraints (iterable(AbstractConstraint)) – Any initial constraints to 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
  • enable_injection (bool) – Flag to indicate that data will be received to inject
  • splitter (None or AbstractSplitterCommon) – the splitter object needed for this vertex
class spinnaker_graph_front_end.MachineEdge(pre_vertex, post_vertex, traffic_type=<EdgeTrafficType.MULTICAST: 1>, label=None, traffic_weight=1, app_edge=None)[source]

Bases: pacman.model.graphs.machine.machine_edge.MachineEdge

For full documentation see MachineEdge.

Parameters:
  • pre_vertex (MachineVertex) – The vertex at the start of the edge.
  • post_vertex (MachineVertex) – The vertex at the end of the edge.
  • traffic_type (EdgeTrafficType) – The type of traffic that this edge will carry.
  • label (str or None) – The name of the edge.
  • traffic_weight (int) – The optional weight of traffic expected to travel down this edge relative to other edges. (default is 1)
  • app_edge (ApplicationEdge or None) – The application edge from which this was created. If None, this edge is part of a pure machine graph.
spinnaker_graph_front_end.setup(hostname=None, graph_label=None, model_binary_module=None, model_binary_folder=None, database_socket_addresses=(), user_dsg_algorithm=None, n_chips_required=None, n_boards_required=None, extra_pre_run_algorithms=(), extra_post_run_algorithms=(), 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:
  • hostname (str) – the hostname of the SpiNNaker machine to operate on (overrides the machine_name from the cfg file).
  • graph_label (str) – a human readable label for the graph (used mainly in reports)
  • 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
  • user_dsg_algorithm (str) – an algorithm used for generating the application data which is loaded onto the machine. If not set, will use the data specification language algorithm required for the type of graph being used.
  • 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.
  • extra_pre_run_algorithms (Iterable(str)) – algorithms which need to be ran after mapping and loading has occurred but before the system has ran. These are plugged directly into the work flow management.
  • extra_post_run_algorithms (Iterable(str)) – algorithms which need to be ran after the simulation has ran. These could be post processing of generated data on the machine for example.
Raises:

ConfigurationException – if mutually exclusive options are given.

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.stop()[source]

Do any necessary cleaning up before exiting. Unregisters the controller

spinnaker_graph_front_end.read_xml_file(file_path)[source]

Read an XML file containing a graph description and translate it into an application graph and machine graph (if required).

Warning

This is not officially supported functionality yet.

Parameters:file_path (str) – the file path in absolute form
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.add_vertex(cell_class, cell_params, label=None, constraints=())[source]

Create an application vertex and add it to the unpartitioned graph.

Parameters:
  • cell_class (type) – the class object for creating the application vertex
  • cell_params (dict(str,object)) – the input parameters for the class object
  • label (str or None) – the label for this vertex
  • constraints (Iterable(AbstractConstraint)) – any constraints to be applied to the vertex once built
Returns:

the application vertex instance object

Return type:

ApplicationVertex

spinnaker_graph_front_end.add_machine_vertex(cell_class, cell_params, label=None, constraints=())[source]

Create a machine vertex and add it to the partitioned graph.

Parameters:
  • cell_class (type) – the class of the machine vertex to create
  • cell_params (dict(str,object)) – the input parameters for the class object
  • label (str or None) – the label for this vertex
  • constraints (Iterable(AbstractConstraint)) – any constraints to be applied to the vertex once built
Returns:

the machine vertex instance object

Return type:

MachineVertex

spinnaker_graph_front_end.add_machine_vertex_instance(vertex_to_add)[source]

Add an existing machine vertex to the partitioned graph.

Parameters:vertex_to_add (MachineVertex) – the vertex to add to the partitioned graph
spinnaker_graph_front_end.add_edge(edge_type, edge_parameters, semantic_label, label=None)[source]

Create an application edge and add it to the unpartitioned graph.

Parameters:
  • edge_type (type) – the kind (class) of application edge to create
  • edge_parameters (dict(str,object)) – parameters to pass to the constructor
  • semantic_label (str) – the ID of the partition that the edge belongs to
  • label (str) – textual label for the edge, or None
Returns:

the created application edge

Return type:

ApplicationEdge

spinnaker_graph_front_end.add_application_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_machine_edge(edge_type, edge_parameters, semantic_label, label=None)[source]

Create a machine edge and add it to the partitioned graph.

Parameters:
  • edge_type (type) – the kind (class) of machine edge to create
  • edge_parameters (dict(str,object)) – parameters to pass to the constructor
  • semantic_label (str) – the ID of the partition that the edge belongs to
  • label (str) – textual label for the edge, or None
Returns:

the created machine edge

Return type:

MachineEdge

spinnaker_graph_front_end.add_machine_edge_instance(edge, partition_id)[source]

Add an edge to the partitioned graph.

Parameters:
  • edge (MachineEdge) – 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.get_txrx()[source]

Get the transceiver used by the tool chain.

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

Get whether the simulation has already run.

Return type:bool
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.no_machine_time_steps()[source]

Get the number of time/simulation steps executed.

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

Get the partitioned graph.

Return type:MachineGraph
spinnaker_graph_front_end.application_graph()[source]

Get the unpartitioned graph.

Return type:ApplicationGraph
spinnaker_graph_front_end.routing_infos()[source]

Get information about how messages are routed on the machine.

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

Get the planned locations of machine vertices on the machine.

Return type:Placements
spinnaker_graph_front_end.transceiver()[source]

Get the transceiver, for talking directly to the SpiNNaker system.

Return type:Transceiver
spinnaker_graph_front_end.buffer_manager()[source]

Get the buffer manager being used for loading/extracting buffers

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

Get the model of the attached/allocated machine.

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

Get whether a machine is allocated.

Return type:bool