spinn_front_end_common.utilities.connections package

Submodules

spinn_front_end_common.utilities.connections.live_event_connection module

class spinn_front_end_common.utilities.connections.live_event_connection.LiveEventConnection(live_packet_gather_label, receive_labels=None, send_labels=None, local_host=None, local_port=19999, machine_vertices=False)[source]

Bases: spinn_front_end_common.utilities.database.database_connection.DatabaseConnection

A connection for receiving and sending live events from and to SpiNNaker

Parameters:
  • live_packet_gather_label – The label of the LivePacketGather vertex to which received events are being sent
  • receive_labels (iterable of str) – Labels of vertices from which live events will be received.
  • send_labels (iterable of str) – Labels of vertices to which live events will be sent
  • local_host (str) – Optional specification of the local hostname or ip address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
add_init_callback(label, init_callback)[source]

Add a callback to be called to initialise a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • init_callback (function(str, int, float, float) -> None) – A function to be called to initialise the vertex. This should take as parameters the label of the vertex, the number of neurons in the population, the run time of the simulation in milliseconds, and the simulation timestep in milliseconds
add_pause_stop_callback(label, pause_stop_callback)[source]

Add a callback for the pause and stop state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • pause_stop_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the pause or stop message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
Return type:

None

add_receive_callback(label, live_event_callback)[source]

Add a callback for the reception of live events from a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • live_event_callback (function(str, int, [int]) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, the simulation timestep when the event occurred, and an array-like of atom ids.
add_start_callback(label, start_callback)[source]

Add a callback for the start of the simulation

Parameters:
  • start_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
  • label (str) – the label of the function to be sent
add_start_resume_callback(label, start_resume_callback)[source]
close()[source]

See spinnman.connections.abstract_classes.connection.Connection.close()

send_event(label, atom_id, send_full_keys=False)[source]

Send an event from a single atom

Parameters:
  • label (str) – The label of the vertex from which the event will originate
  • atom_id (int) – The id of the atom sending the event
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each atom from the database, or whether to send 16-bit atom ids directly
send_events(label, atom_ids, send_full_keys=False)[source]

Send a number of events

Parameters:
  • label (str) – The label of the vertex from which the events will originate
  • atom_ids ([int]) – array-like of atom ids sending events
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each atom from the database, or whether to send 16-bit atom ids directly

Module contents

class spinn_front_end_common.utilities.connections.LiveEventConnection(live_packet_gather_label, receive_labels=None, send_labels=None, local_host=None, local_port=19999, machine_vertices=False)[source]

Bases: spinn_front_end_common.utilities.database.database_connection.DatabaseConnection

A connection for receiving and sending live events from and to SpiNNaker

Parameters:
  • live_packet_gather_label – The label of the LivePacketGather vertex to which received events are being sent
  • receive_labels (iterable of str) – Labels of vertices from which live events will be received.
  • send_labels (iterable of str) – Labels of vertices to which live events will be sent
  • local_host (str) – Optional specification of the local hostname or ip address of the interface to listen on
  • local_port (int) – Optional specification of the local port to listen on. Must match the port that the toolchain will send the notification on (19999 by default)
add_init_callback(label, init_callback)[source]

Add a callback to be called to initialise a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • init_callback (function(str, int, float, float) -> None) – A function to be called to initialise the vertex. This should take as parameters the label of the vertex, the number of neurons in the population, the run time of the simulation in milliseconds, and the simulation timestep in milliseconds
add_pause_stop_callback(label, pause_stop_callback)[source]

Add a callback for the pause and stop state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • pause_stop_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the pause or stop message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
Return type:

None

add_receive_callback(label, live_event_callback)[source]

Add a callback for the reception of live events from a vertex

Parameters:
  • label (str) – The label of the vertex to be notified about. Must be one of the vertices listed in the constructor
  • live_event_callback (function(str, int, [int]) -> None) – A function to be called when events are received. This should take as parameters the label of the vertex, the simulation timestep when the event occurred, and an array-like of atom ids.
add_start_callback(label, start_callback)[source]

Add a callback for the start of the simulation

Parameters:
  • start_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start message has been received. This function should take the label of the referenced vertex, and an instance of this class, which can be used to send events
  • label (str) – the label of the function to be sent
add_start_resume_callback(label, start_resume_callback)[source]
close()[source]

See spinnman.connections.abstract_classes.connection.Connection.close()

send_event(label, atom_id, send_full_keys=False)[source]

Send an event from a single atom

Parameters:
  • label (str) – The label of the vertex from which the event will originate
  • atom_id (int) – The id of the atom sending the event
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each atom from the database, or whether to send 16-bit atom ids directly
send_events(label, atom_ids, send_full_keys=False)[source]

Send a number of events

Parameters:
  • label (str) – The label of the vertex from which the events will originate
  • atom_ids ([int]) – array-like of atom ids sending events
  • send_full_keys (bool) – Determines whether to send full 32-bit keys, getting the key for each atom from the database, or whether to send 16-bit atom ids directly