spinnaker_graph_front_end package¶
Subpackages¶
Submodules¶
spinnaker_graph_front_end.config_setup module¶
Utilities for setting up the global configuration.
- 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 configurations including the user’s configuration file.
Clears out any previous read configurations but does not load the new configurations so a warning is generated if a configuration 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 unit test.
Resets the configurations so only the local default configurations are included. The user configuration is not included!
Unsets any previous simulators and temporary directories.
Note
This file should only be called from spinnaker_graph_front_end tests that do not call
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:
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.
- class spinnaker_graph_front_end.ReverseIpTagMultiCastSource(n_keys: int, label: str | None = None, max_atoms_per_core: int | Tuple[int, ...] | None = 9223372036854775807, receive_port: int | None = None, receive_sdp_port: int = 1, receive_tag: IPTag | None = None, receive_rate: int = 10, virtual_key: int | None = None, prefix: int | None = None, prefix_type: EIEIOPrefix | None = None, check_keys: bool = False, send_buffer_times: ndarray | List[ndarray] | None = None, send_buffer_partition_id: str | None = None, reserve_reverse_ip_tag: bool = False, injection_partition_id: str | None = None, splitter: AbstractSplitterCommon | None = None)[source]
Bases:
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 (AbstractSplitterCommon or None) – the splitter object needed for this vertex
- 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.
- 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:
- 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:
- spinnaker_graph_front_end.has_ran()[source]
Get whether the simulation has already run.
- Return type:
- spinnaker_graph_front_end.is_allocated_machine()[source]
Get whether a machine is allocated.
- Return type:
- spinnaker_graph_front_end.machine()[source]
Get the model of the attached/allocated machine.
- Return type:
- 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
- spinnaker_graph_front_end.routing_infos()[source]
Get information about how messages are routed on the machine.
- Return type:
- 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 themodel_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 beNone
ifn_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.