These pages document the python code for the SpiNNakerGraphFrontEnd module which is part of the SpiNNaker Project.

This code depends on SpiNNUtils, SpiNNMachine, SpiNNMan, PACMAN, DataSpecification, SpiNNFrontEndCommon (Combined_documentation).


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

# Make the bits that do the computation
for each vertex to add:

# Connect them together so computations are coordinated
for each edge to add:

# Actually plan and run the simulation

# 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

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

For full documentation see LivePacketGather.

  • lpg_params (LivePacketGatherParameters) –
  • constraints (iterable(AbstractConstraint)) –
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]

For full documentation see ReverseIpTagMultiCastSource.

  • 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]

For full documentation see MachineEdge.

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


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

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

ConfigurationException – if mutually exclusive options are given.[source]

Run a simulation for a number of microseconds.

Parameters:duration (int) – the number of microseconds the application code should run for

Do any necessary cleaning up before exiting. Unregisters the controller


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


This is not officially supported functionality yet.

Parameters:file_path (str) – the file path in absolute form

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.

  • 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

the application vertex instance object

Return type:


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.

  • 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

the machine vertex instance object

Return type:



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.

  • 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

the created application edge

Return type:


spinnaker_graph_front_end.add_application_edge_instance(edge, partition_id)[source]

Add an edge to the unpartitioned graph.

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

  • 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

the created machine edge

Return type:


spinnaker_graph_front_end.add_machine_edge_instance(edge, partition_id)[source]

Add an edge to the partitioned graph.

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

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

Get the transceiver used by the tool chain.

Return type:Transceiver

Get whether the simulation has already run.

Return type:bool

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

Return type:int

Get the number of time/simulation steps executed.

Return type:int

Get the partitioned graph.

Return type:MachineGraph

Get the unpartitioned graph.

Return type:ApplicationGraph

Get information about how messages are routed on the machine.

Return type:RoutingInfo

Get the planned locations of machine vertices on the machine.

Return type:Placements

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

Return type:Transceiver

Get the buffer manager being used for loading/extracting buffers

Return type:BufferManager

Get the model of the attached/allocated machine.

Return type:Machine

Get whether a machine is allocated.

Return type:bool


Indices and tables