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

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

SpiNNFrontEndCommon

Contents:

spinn_front_end_common

spinn_front_end_common package

Subpackages

spinn_front_end_common.abstract_models package
Subpackages
spinn_front_end_common.abstract_models.impl package
Module contents
class spinn_front_end_common.abstract_models.impl.MachineAllocationController(thread_name)[source]

Bases: spinn_front_end_common.abstract_models.abstract_machine_allocation_controller.AbstractMachineAllocationController

How to manage the allocation of a machine so that it gets cleaned up neatly when the script dies.

close()[source]

Indicate that the use of the machine is complete.

class spinn_front_end_common.abstract_models.impl.MachineDataSpecableVertex(*args, **kwargs)[source]

Bases: spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification

Support for a vertex that simplifies generating a data specification.

generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to
  • placement (Placement) – the placement the vertex is located at
  • machine_graph (MachineGraph) – (Injected)
  • routing_info (RoutingInfo) – (Injected)
  • tags – (Injected)
  • machine_time_step – (Injected)
  • time_scale_factor – (Injected)
Return type:

None

generate_machine_data_specification(spec, placement, machine_graph, routing_info, iptags, reverse_iptags, machine_time_step, time_scale_factor)[source]
Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write into.
  • placement (Placement) – Where this node is on the SpiNNaker machine.
  • machine_graph (MachineGraph) – The graph containing this node.
  • routing_info (RoutingInfo) – The routing info.
  • iptags (iterable(IPTag) or None) – The (forward) IP tags for the vertex, if any
  • reverse_iptags (iterable(ReverseIPTag) or None) – The reverse IP tags for the vertex, if any
  • machine_time_step (int) – The machine time step
  • time_scale_factor (int) – The time step scaling factor
Return type:

None

class spinn_front_end_common.abstract_models.impl.ProvidesKeyToAtomMappingImpl[source]

Bases: spinn_front_end_common.abstract_models.abstract_provides_key_to_atom_mapping.AbstractProvidesKeyToAtomMapping

routing_key_partition_atom_mapping(*args, **kwargs)[source]

Returns a list of atom to key mapping.

Parameters:
Returns:

a iterable of tuples of atom IDs to keys.

Return type:

iterable(tuple(int,int))

Module contents
class spinn_front_end_common.abstract_models.AbstractChangableAfterRun[source]

Bases: object

An item that can be changed after a call to run, the changes to which might or might not require mapping or data generation.

mark_no_changes()[source]

Marks the point after which changes are reported, so that new changes can be detected before the next check.

requires_data_generation

True if changes that have been made require that data generation be performed. By default this returns False but can be overridden to indicate changes that require data regeneration.

Return type:bool
requires_mapping

True if changes that have been made require that mapping be performed. By default this returns False but can be overridden to indicate changes that require mapping.

Return type:bool
class spinn_front_end_common.abstract_models.AbstractGeneratesDataSpecification[source]

Bases: object

generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

class spinn_front_end_common.abstract_models.AbstractHasAssociatedBinary[source]

Bases: object

Marks a machine graph vertex that can be launched on a SpiNNaker core.

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
class spinn_front_end_common.abstract_models.AbstractMachineAllocationController[source]

Bases: object

An object that controls the allocation of a machine

close()[source]

Indicate that the use of the machine is complete.

extend_allocation(new_total_run_time)[source]

Extend the allocation of the machine from the original run time.

Parameters:new_total_run_time (float) – The total run time that is now required starting from when the machine was first allocated
class spinn_front_end_common.abstract_models.AbstractProvidesIncomingPartitionConstraints[source]

Bases: object

A vertex that can provide constraints for its incoming edge partitions.

get_incoming_partition_constraints(partition)[source]

Get constraints to be added to the given edge that goes in to a vertex of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An partition that goes in to this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
class spinn_front_end_common.abstract_models.AbstractProvidesKeyToAtomMapping[source]

Bases: object

Interface to provide a mapping between routing key partitions and atom IDs

routing_key_partition_atom_mapping(routing_info, partition)[source]

Returns a list of atom to key mapping.

Parameters:
Returns:

a iterable of tuples of atom IDs to keys.

Return type:

iterable(tuple(int,int))

class spinn_front_end_common.abstract_models.AbstractProvidesNKeysForPartition[source]

Bases: object

Allows a vertex to provide the number of keys for a partition of edges, rather than relying on the number of atoms in the pre-vertex.

get_n_keys_for_partition(partition, graph_mapper)[source]

Get the number of keys required by the given partition of edges.

Parameters:
  • partition (AbstractOutgoingEdgePartition) – An partition that comes out of this vertex
  • graph_mapper (GraphMapper) – A mapper between the graphs
Returns:

A list of constraints

Return type:

list(AbstractConstraint)

class spinn_front_end_common.abstract_models.AbstractProvidesOutgoingPartitionConstraints[source]

Bases: object

A vertex that can provide constraints for its outgoing edge partitions.

get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
class spinn_front_end_common.abstract_models.AbstractRecordable[source]

Bases: object

Indicates that an object might record some data in to SDRAM

is_recording()[source]

Deduce if the recorder is actually recording

Return type:bool
class spinn_front_end_common.abstract_models.AbstractRewritesDataSpecification[source]

Bases: object

Indicates an object that allows data to be changed after run, and so can rewrite the data specification

mark_regions_reloaded()[source]

Indicate that the regions have been reloaded

regenerate_data_specification(spec, placement)[source]

Regenerate the data specification, only generating regions that have changed and need to be reloaded

Parameters:
requires_memory_regions_to_be_reloaded()[source]

Return true if any data region needs to be reloaded

Return type:bool
class spinn_front_end_common.abstract_models.AbstractSendMeMulticastCommandsVertex[source]

Bases: object

A vertex which wants to commands to be sent to it as multicast packets at fixed points in the simulation

pause_stop_commands

The commands needed when pausing or stopping simulation

Return type:iterable(MultiCastCommand)
start_resume_commands

The commands needed when starting or resuming simulation

Return type:iterable(MultiCastCommand)
timed_commands

The commands to be sent at given times in the simulation

Return type:iterable(MultiCastCommand)
class spinn_front_end_common.abstract_models.AbstractSupportsDatabaseInjection[source]

Bases: object

Marks a machine vertex as supporting injection of information via a database running on the controlling host.

is_in_injection_mode

Whether this vertex is actually in injection mode.

Return type:bool
class spinn_front_end_common.abstract_models.AbstractVertexWithEdgeToDependentVertices[source]

Bases: object

A vertex with a dependent vertices, which should be connected to this vertex by an edge directly to each of them

dependent_vertices()[source]

Return the vertices which this vertex depends upon

Return type:iterable(ApplicationVertex)
edge_partition_identifiers_for_dependent_vertex(vertex)[source]

Return the dependent edge identifiers for a particular dependent vertex.

Parameters:vertex (ApplicationVertex) –
Return type:iterable(str)
class spinn_front_end_common.abstract_models.AbstractUsesMemoryIO[source]

Bases: object

Indicates that the class will write data using the MemoryIO interface.

get_memory_io_data_size()[source]

Get the size of the data area to allocate for this vertex.

Returns:The size of the data area in bytes
Return type:int
write_data_to_memory_io(memory, tag)[source]

Write the data to the given memory object

Parameters:
  • memory (MemoryIO) – The memory to write to (and handle to use to do the write)
  • tag (int) – The tag given to the allocated memory
Return type:

None

class spinn_front_end_common.abstract_models.AbstractCanReset[source]

Bases: object

Indicates an object that can be reset to time 0.

reset_to_first_timestep()[source]

Reset the object to first time step.

spinn_front_end_common.common_model_binaries package
Module contents

This module contains no python code

spinn_front_end_common.interface package
Subpackages
spinn_front_end_common.interface.buffer_management package
Subpackages
spinn_front_end_common.interface.buffer_management.buffer_models package
Module contents
class spinn_front_end_common.interface.buffer_management.buffer_models.AbstractReceiveBuffersToHost[source]

Bases: object

Indicates that this object can receive buffers.

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering

Returns:The region numbers that have active recording
Return type:iterable(int)
get_recording_region_base_address(txrx, placement)[source]

Get the recording region base address

Parameters:
  • txrx (Transceiver) – the SpiNNMan instance
  • placement (Placement) – the placement object of the core to find the address of
Returns:

the base address of the recording region

Return type:

int

class spinn_front_end_common.interface.buffer_management.buffer_models.AbstractSendsBuffersFromHost[source]

Bases: object

Interface to an object that sends buffers of keys to be transmitted at given timestamps in the simulation.

buffering_input()[source]

Return True if the input of this vertex is to be buffered.

Return type:bool
get_next_key(region)[source]

Get the next key in the given region

Parameters:region (int) – The region to get the next key from
Returns:The next key, or None if there are no more keys
Return type:int
get_next_timestamp(region)[source]

Get the next timestamp at which there are still keys to be sent for the given region

Parameters:region (int) – The region to get the timestamp for
Returns:The timestamp of the next available keys
Return type:int
get_region_buffer_size(region)[source]

Get the size of the buffer to be used in SDRAM on the machine for the region in bytes

Parameters:region (int) – The region to get the buffer size of
Returns:The size of the buffer space in bytes
Return type:int
get_regions()[source]

Get the set of regions for which there are keys to be sent

Returns:Iterable of region IDs
Return type:iterable(int)
is_empty(region)[source]

Return true if there are no spikes to be buffered for the specified region

Parameters:region (int) – The region to get the next key from
Returns:Whether there are no keys to send for the region
Return type:bool
is_next_key(region, timestamp)[source]

Determine if there are still keys to be sent at the given timestamp for the given region

Parameters:
  • region (int) – The region to determine if there are keys for
  • timestamp (int) – The timestamp to determine if there are more keys for
Returns:

Whether there are more keys to send for the parameters

Return type:

bool

is_next_timestamp(region)[source]

Determine if there is another timestamp with data to be sent

Parameters:region (int) – The region to determine if there is more data for
Returns:Whether there is more data
Return type:bool
rewind(region)[source]

Rewinds the internal buffer in preparation of re-sending the spikes

Parameters:region (int) – The region to rewind
class spinn_front_end_common.interface.buffer_management.buffer_models.SendsBuffersFromHostPreBufferedImpl[source]

Bases: spinn_front_end_common.interface.buffer_management.buffer_models.abstract_sends_buffers_from_host.AbstractSendsBuffersFromHost

Implementation of AbstractReceiveBuffersToHost which uses an existing set of buffers for the details.

buffering_input()[source]
Return type:bool
get_next_key(region)[source]

Get the next key for a given region

Parameters:region – the region to get the next key from
get_next_timestamp(region)[source]

Return the next time stamp available in the buffered region

Parameters:region – the region ID which is being asked
Returns:the next time stamp
get_regions()[source]

Return the regions which has buffers to send

is_empty(region)[source]

Check if a region is empty

Parameters:region – the region ID to check
Returns:bool
is_next_key(region, timestamp)[source]

Check if there is more keys to transmit for a given region in a given timestamp

Parameters:
  • region – the region ID to check
  • timestamp – the timestamp to check
Returns:

bool

is_next_timestamp(region)[source]

Check if there are more time stamps which need transmitting

Parameters:region – the region to check
Returns:boolean
rewind(region)[source]

Rewinds the internal buffer in preparation of re-sending the spikes

Parameters:region (int) – The region to rewind
send_buffers
Return type:dict(int,BufferedSendingRegion)
spinn_front_end_common.interface.buffer_management.storage_objects package
Module contents
class spinn_front_end_common.interface.buffer_management.storage_objects.AbstractDatabase[source]

Bases: object

This API separates the required database calls from the implementation.

Methods here are designed for the convenience of the caller not the database.

There should only ever be a single Database Object in use at any time. In the case of application_graph_changed the first should closed and a new one created.

Do not assume that just because 2 database objects where opened with the same parameters (for example SQLite file) that they hold the same data. In fact the second init is allowed to delete any previous data.

While not recommended implementation objects are allowed to hold data in memory, with the exception of data required by the java which must be in the database once commit is called.

clear()[source]

Clears the data for all regions.

Note

This method will be removed when the database moves to keeping data after reset.

Return type:None
close()[source]

Signals that the database can be closed and will not be reused.

Once this is called any other method in this API is allowed to raise any kind of exception.

get_region_data(x, y, p, region)[source]

Get the data stored for a given region of a given core

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data
Returns:

a buffer containing all the data received during the simulation, and a flag indicating if any data was missing

Note

Implementations should not assume that the total buffer is necessarily shorter than 1GB.

Return type:

tuple(memoryview, bool)

store_data_in_region_buffer(x, y, p, region, data)[source]

Store some information in the corresponding buffer for a specific chip, core and recording region.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data to be stored
  • data (bytearray) –

    data to be stored

    Note

    Implementations may assume this to be shorter than 1GB

class spinn_front_end_common.interface.buffer_management.storage_objects.BufferedReceivingData(report_folder)[source]

Bases: object

Stores the information received through the buffering output technique from the SpiNNaker system. The data kept includes the last sent packet and last received packet, their correspondent sequence numbers, the data retrieved, a flag to identify if the data from a core has been flushed and the final state of the buffering output state machine

Parameters:report_folder (str) – The directory to write the database used to store some of the data.
clear(x, y, p, region_id)[source]

Clears the data from a given data region (only clears things associated with a given data recording region).

Parameters:
  • x (int) – placement x coordinate
  • y (int) – placement y coordinate
  • p (int) – placement p coordinate
  • region_id (int) – the recording region ID to clear data from
Return type:

None

flushing_data_from_region(x, y, p, region, data)[source]

Store flushed data from a region of a core on a chip, and mark it as being flushed.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data to be stored
  • data (bytearray) – data to be stored
get_end_buffering_sequence_number(x, y, p)[source]

Get the last sequence number sent by the core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

The last sequence number

Return type:

int

get_end_buffering_state(x, y, p, region)[source]

Get the end state of the buffering.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

The end state

get_region_data(x, y, p, region)[source]

Get the data stored for a given region of a given core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data
Returns:

an array contained all the data received during the simulation, and a flag indicating if any data was missing

Return type:

tuple(memoryview, bool)

get_region_data_pointer(x, y, p, region)[source]

It is no longer possible to get access to the data pointer.

Use get_region_data to get the data and missing flag directly.

is_data_from_region_flushed(x, y, p, region)[source]

Check if the data region has been flushed.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data
Returns:

True if the region has been flushed. False otherwise

Return type:

bool

is_end_buffering_sequence_number_stored(x, y, p)[source]

Determine if the last sequence number has been retrieved.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

True if the number has been retrieved

Return type:

bool

is_end_buffering_state_recovered(x, y, p, region)[source]

Determine if the end state has been stored.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

True if the state has been stored

last_received_packet_from_core(x, y, p)[source]

Get the last packet received for a given core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

SpinnakerRequestReadData packet received

Return type:

spinnman.messages.eieio.command_messages.SpinnakerRequestReadData

last_sent_packet_to_core(x, y, p)[source]

Retrieve the last packet sent to a core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

last HostDataRead packet sent

Return type:

spinnman.messages.eieio.command_messages.HostDataRead

last_sequence_no_for_core(x, y, p)[source]

Get the last sequence number for a core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
Returns:

last sequence number used

Return type:

int

reset()[source]
resume()[source]

Resets states so that it can behave in a resumed mode.

store_data_in_region_buffer(x, y, p, region, data)[source]

Store some information in the correspondent buffer class for a specific chip, core and region.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data to be stored
  • data (bytearray) – data to be stored
store_end_buffering_sequence_number(x, y, p, sequence)[source]

Store the last sequence number sent by the core.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • sequence (int) – The last sequence number
store_end_buffering_state(x, y, p, region, state)[source]

Store the end state of buffering.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • state – The end state
store_last_received_packet_from_core(x, y, p, packet)[source]

Store the most recent packet received from SpiNNaker for a given core.

Parameters:
store_last_sent_packet_to_core(x, y, p, packet)[source]

Store the last packet sent to the given core.

Parameters:
update_sequence_no_for_core(x, y, p, sequence_no)[source]

Set the last sequence number used.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • sequence_no (int) – last sequence number used
Return type:

None

class spinn_front_end_common.interface.buffer_management.storage_objects.BufferedSendingRegion[source]

Bases: object

A set of keys to be sent at given timestamps for a given region of data. Note that keys must be added in timestamp order or else an exception will be raised.

add_key(timestamp, key)[source]

Add a key to be sent at a given time.

Parameters:
  • timestamp (int) – The time at which the key is to be sent
  • key (int) – The key to send
add_keys(timestamp, keys)[source]

Add a set of keys to be sent at the given time.

Parameters:
  • timestamp (int) – The time at which the keys are to be sent
  • keys (iterable(int)) – The keys to send
clear()[source]

Clears the buffer.

current_timestamp

The current timestamp in the iterator.

get_n_keys(timestamp)[source]

Get the number of keys for a given timestamp.

Parameters:timestamp – the time stamp to check if there’s still keys to transmit
is_next_key(timestamp)[source]

Determine if there is another key for the given timestamp.

Parameters:timestamp – the time stamp to check if there’s still keys to transmit
Return type:bool
is_next_timestamp
Determines if the region is empty.
True if the region is empty, false otherwise.
Return type:bool
n_timestamps

The number of timestamps available.

Return type:int
next_key

The next key to be sent.

Return type:int
next_timestamp

The next timestamp of the data to be sent, or None if no more data.

Return type:int or None
rewind()[source]

Rewind the buffer to initial position.

timestamps

The timestamps for which there are keys.

Return type:iterable(int)
class spinn_front_end_common.interface.buffer_management.storage_objects.BuffersSentDeque(region, sent_stop_message=False, n_sequences_per_tranmission=64)[source]

Bases: object

A tracker of buffers sent / to send for a region

Parameters:
  • region (int) – The region being managed
  • sent_stop_message (bool) – True if the stop message has been sent
  • n_sequences_per_tranmission (int) – The number of sequences allowed in each transmission set
add_message_to_send(message)[source]

Add a message to send. The message is converted to a sequenced message.

Parameters:message (spinnman.messages.eieio.abstract_messages.AbstractEIEIOMessage) – The message to be added
is_empty()[source]

Determine if there are no messages.

Return type:int
is_full

Determine if the number of messages sent is at the limit for the sequencing system.

Return type:bool
messages

The messages that have been added to the set.

Return type:iterable(spinnman.messages.eieio.command_messages.HostSendSequencedData)
send_stop_message()[source]

Send a message to indicate the end of all the messages.

update_last_received_sequence_number(last_received_sequence_no)[source]

Updates the last received sequence number. If the sequence number is within the valid window, packets before the sequence number within the window are removed, and the last received sequence number is updated, thus moving the window for the next call. If the sequence number is not within the valid window, it is assumed to be invalid and so is ignored.

Parameters:last_received_sequence_no (int) – The new sequence number
Returns:True if update went ahead, False if it was ignored
Return type:bool
class spinn_front_end_common.interface.buffer_management.storage_objects.ChannelBufferState(start_address, current_write, current_dma_write, current_read, end_address, region_id, missing_info, last_buffer_operation)[source]

Bases: object

Stores information related to a single channel output buffering state, as it is retrieved at the end of a simulation on the SpiNNaker system.

Parameters:
  • start_address (int) – start buffering area memory address (32 bits)
  • current_write (int) – address where data was last written (32 bits)
  • current_read (int) – address where data was last read (32 bits)
  • end_address (int) – The address of first byte after the buffer (32 bits)
  • region_id (int) – The ID of the region (8 bits)
  • missing_info (int) – True if the region overflowed during the simulation (8 bits)
  • last_buffer_operation (int) – Last operation performed on the buffer - read or write (8 bits)
ChannelBufferStateSize = 24

4 bytes for _start_address, 4 for _current_write, 4 for current_dma_write, 4 for _current_read, 4 for _end_address, 1 for _region_id, 1 for _missing_info, 1 for _last_buffer_operation

static create_from_bytearray(data)[source]
Parameters:data (bytearray) – The contents of the buffer state structure on SpiNNaker.
Return type:ChannelBufferState
current_read

address where data was last read

current_write

address where data was last written

end_address

The address of first byte after the buffer

is_state_updated

bool check for if its extracted data from machine

last_buffer_operation

Last operation performed on the buffer - read (0) or write (non-0)

missing_info

True if the region overflowed during the simulation

region_id

The ID of the region

set_update_completed()[source]
static size_of_channel_state()[source]
Return type:int
start_address

start buffering area memory address

update_last_operation(operation)[source]
update_read_pointer(read_ptr)[source]
class spinn_front_end_common.interface.buffer_management.storage_objects.EndBufferingState(buffering_out_fsm_state, list_channel_buffer_state)[source]

Bases: object

Stores the buffering state at the end of a simulation.

Parameters:
  • buffering_out_fsm_state (int) – Final sequence number received
  • list_channel_buffer_state (list(ChannelBufferState)) – a list of channel state, where each channel is stored in a ChannelBufferState object
buffering_out_fsm_state
Return type:int
channel_buffer_state(i)[source]
Parameters:i (int) – the index into the buffer states
Return type:ChannelBufferState
get_missing_info_for_region(region_id)[source]
Return type:bool or None
get_state_for_region(region_id)[source]
Parameters:region_id (int) – The region identifier
Return type:None or ChannelBufferState
static size_of_region(n_regions_to_record)[source]
Parameters:n_regions_to_record (int) – Number of regions to be recorded
Returns:Size of region required to hold that state, in bytes
Return type:int
class spinn_front_end_common.interface.buffer_management.storage_objects.SqlLiteDatabase(database_file=None)[source]

Bases: spinn_front_end_common.interface.buffer_management.storage_objects.abstract_database.AbstractDatabase

Specific implementation of the Database for SQLite 3.

Note

NOT THREAD SAFE ON THE SAME DB. Threads can access different DBs just fine.

Parameters:database_file (str) – The name of a file that contains (or will contain) an SQLite database holding the data. If omitted, an unshared in-memory database will be used.
clear()[source]

Clears the data for all regions.

Note

This method will be removed when the database moves to keeping data after reset.

Return type:None
close()[source]

Signals that the database can be closed and will not be reused.

Once this is called any other method in this API is allowed to raise any kind of exception.

get_region_data(x, y, p, region)[source]

Get the data stored for a given region of a given core

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data
Returns:

a buffer containing all the data received during the simulation, and a flag indicating if any data was missing

Note

Implementations should not assume that the total buffer is necessarily shorter than 1GB.

Return type:

tuple(memoryview, bool)

store_data_in_region_buffer(x, y, p, region, data)[source]

Store some information in the corresponding buffer for a specific chip, core and recording region.

Parameters:
  • x (int) – x coordinate of the chip
  • y (int) – y coordinate of the chip
  • p (int) – Core within the specified chip
  • region (int) – Region containing the data to be stored
  • data (bytearray) –

    data to be stored

    Note

    Implementations may assume this to be shorter than 1GB

Module contents
class spinn_front_end_common.interface.buffer_management.BufferManager(placements, tags, transceiver, extra_monitor_cores, packet_gather_cores_to_ethernet_connection_map, extra_monitor_to_chip_mapping, machine, fixed_routes, uses_advanced_monitors, report_folder, java_caller=None)[source]

Bases: object

Manager of send buffers.

Parameters:
  • placements (Placements) – The placements of the vertices
  • tags (Tags) – The tags assigned to the vertices
  • transceiver (Transceiver) – The transceiver to use for sending and receiving information
  • packet_gather_cores_to_ethernet_connection_map (dict(tuple(int,int), DataSpeedUpPacketGatherMachineVertex)) – mapping of cores to the gatherer vertex placed on them
  • report_folder (str) – The directory for reports which includes the file to use as an SQL database.
  • java_caller (JavaCaller) – Support class to call Java, or None to use python
add_receiving_vertex(vertex)[source]

Add a vertex into the managed list for vertices which require buffers to be received from them during runtime.

Parameters:vertex (AbstractReceiveBuffersToHost) – the vertex to be managed
add_sender_vertex(vertex)[source]

Add a vertex into the managed list for vertices which require buffers to be sent to them during runtime.

Parameters:vertex (AbstractSendsBuffersFromHost) – the vertex to be managed
clear_recorded_data(x, y, p, recording_region_id)[source]

Removes the recorded data stored in memory.

Parameters:
  • x (int) – placement x coordinate
  • y (int) – placement y coordinate
  • p (int) – placement p coordinate
  • recording_region_id (int) – the recording region ID
get_data_by_placement(placement, recording_region_id)[source]

Get the data container for all the data retrieved during the simulation from a specific region area of a core.

Parameters:
  • placement (Placement) – the placement to get the data from
  • recording_region_id (int) – desired recording data region
Returns:

an array contained all the data received during the simulation, and a flag indicating if any data was missing

Return type:

tuple(bytearray, bool)

get_data_for_placements(placements, progress=None)[source]
Parameters:
  • placements (Placements) – Where to get the data from.
  • progress (ProgressBar or None) – How to measure/display the progress.
get_data_for_vertex(placement, recording_region_id)[source]

It is no longer possible to get access to the data pointer.

Use get_data_by_vertex instead which returns the data that pointer.read_all() used to return the missing flag as before

load_initial_buffers()[source]

Load the initial buffers for the senders using memory writes.

reset()[source]

Resets the buffered regions to start transmitting from the beginning of its expected regions and clears the buffered out data files.

resume()[source]

Resets any data structures needed before starting running again.

sender_vertices

The vertices which are buffered.

stop()[source]

Indicates that the simulation has finished, so no further outstanding requests need to be processed.

spinn_front_end_common.interface.ds package
Module contents
class spinn_front_end_common.interface.ds.DataRowReader(data)[source]

Bases: spinn_storage_handlers.abstract_classes.abstract_data_reader.AbstractDataReader, spinn_storage_handlers.abstract_classes.abstract_context_manager.AbstractContextManager

close()[source]

Does Nothing

read(n_bytes=None)[source]

Read some bytes of data from the underlying storage. Will block until some bytes are available, but might not return the full n_bytes. The size of the returned array indicates how many bytes were read.

Parameters:n_bytes (int) – The number of bytes to read; if unspecified, read all remaining bytes
Returns:The data that was read
Return type:bytearray
Raises:IOError – If an error occurs reading from the underlying storage
tell()[source]

Returns the position of the file cursor.

Returns:Position of the file cursor
Return type:int
class spinn_front_end_common.interface.ds.DataRowWriter(x, y, p, targets)[source]

Bases: spinn_storage_handlers.abstract_classes.abstract_data_writer.AbstractDataWriter, spinn_storage_handlers.abstract_classes.abstract_context_manager.AbstractContextManager

close()[source]

Closes the writer if not already closed.

write(data)[source]

Write some bytes of data to the underlying storage. Does not return until all the bytes have been written.

Parameters:data (bytearray or bytes) – The data to write
Returns:Nothing is returned
Return type:None
Raises:IOError – If an error occurs writing to the underlying storage
class spinn_front_end_common.interface.ds.DataSpecificationTargets(machine, report_folder, init=None, clear=True)[source]

Bases: _abcoll.MutableMapping

Parameters:
  • machine (Machine) –
  • report_folder (str) –
create_data_spec(x, y, p)[source]
get_app_id(x, y, p)[source]

Gets the app_id set for this core

Parameters:
  • x – core x
  • y – core y
  • p – core p
Return type:

int

get_database()[source]

Expose the database so it can be shared

Return type:DsAbstractDatabase
items() → list of D's (key, value) pairs, as 2-tuples[source]
iteritems()

D.items() -> list of D’s (key, value) pairs, as 2-tuples

keys()[source]

Yields the keys.

As the more typical call is iteritems this makes use of that

Return type:iterable(tuple(int,int,int))
mark_system_cores(core_subsets)[source]
n_targets()

TEMP implementation

Returns:
set_app_id(app_id)[source]

Sets the same app_id for all rows that have DS content

Parameters:app_id (int) – value to set
write_data_spec(x, y, p, ds)[source]
class spinn_front_end_common.interface.ds.DsAbstractDatabase[source]

Bases: object

Interface supported by all database implementations that store data specifications.

clear_ds()[source]

Clear all saved data specification data

clear_write_info()[source]

Clears the provenance for all rows

close()[source]

Signals that the database can be closed and will not be reused.

Note

Once this is called any other method in this API is allowed to raise any kind of exception.

ds_get_app_id(x, y, p)[source]

Gets the app_id set for this core

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Return type:

int

ds_iteritems()[source]

Yields the keys and values for the DS data

Returns:Yields the (x, y, p) and saved ds pairs
Return type:iterable(tuple(tuple(int, int, int), bytearray))
ds_mark_as_system(core_list)[source]

Flags a list of processors as running system binaries.

Parameters:core_list (iterable(tuple(int,int,int))) – list of (core x, core y, core p)
ds_n_cores()[source]

Returns the number for cores there is a ds saved for

Return type:int
ds_set_app_id(app_id)[source]

Sets the same app_id for all rows that have ds content

Parameters:app_id (int) – value to set
get_ds(x, y, p)[source]

Retrieves the data spec as byte code for this core.

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Returns:

data spec as byte code

Return type:

bytearray

get_write_info(x, y, p)[source]

Gets the provenance returned by the Data Spec executor

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
Return type:

DataWritten

info_iteritems()[source]

Yields the keys and values for the Info data. Note that a DB transaction may be held while this iterator is processing.

Returns:Yields the (x, y, p) and DataWritten
Return type:iterable(tuple(tuple(int, int, int), DataWritten))
info_n_cores()[source]

Returns the number for cores there is a info saved for.

Return type:int
save_ds(core_x, core_y, core_p, ds)[source]
Parameters:
  • core_x (int) – x of the core ds applies to
  • core_y (int) – y of the core ds applies to
  • p (int) – p of the core ds applies to
  • ds (bytearray) – the data spec as byte code
set_write_info(x, y, p, info)[source]

Sets the provenance returned by the Data Spec executor.

Parameters:
  • x (int) – core x
  • y (int) – core y
  • p (int) – core p
  • info (DataWritten) – DataWritten
spinn_front_end_common.interface.interface_functions package
Module contents
class spinn_front_end_common.interface.interface_functions.ApplicationFinisher[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.ApplicationRunner[source]

Bases: object

Ensures all cores are initialised correctly, ran, and completed successfully.

run_application(buffer_manager, notifier, executable_types, app_id, txrx, runtime, time_scale_factor, no_sync_changes, time_threshold, run_until_complete)[source]
class spinn_front_end_common.interface.interface_functions.BufferExtractor[source]

Bases: object

Extracts data in between runs

class spinn_front_end_common.interface.interface_functions.BufferManagerCreator[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.ChipIOBufClearer[source]

Bases: object

Clears the logging output buffer of an application running on a SpiNNaker machine.

class spinn_front_end_common.interface.interface_functions.ChipIOBufExtractor(recovery_mode=False, filename_template='iobuf_for_chip_{}_{}_processor_id_{}.txt')[source]

Bases: object

Extract the logging output buffers from the machine, and separates lines based on their prefix.

class spinn_front_end_common.interface.interface_functions.ChipProvenanceUpdater[source]

Bases: object

Forces all cores to generate provenance data, and then exit

class spinn_front_end_common.interface.interface_functions.ChipRuntimeUpdater[source]

Bases: object

Updates the runtime of an application running on a SpiNNaker machine.

class spinn_front_end_common.interface.interface_functions.DatabaseInterface[source]

Bases: object

Writes a database of the graph(s) and other information

database_file_path
needs_database
class spinn_front_end_common.interface.interface_functions.DataInMulticastRoutingGenerator[source]

Bases: object

Generates routing table entries used by the data in processes with the extra monitor cores.

class spinn_front_end_common.interface.interface_functions.DSGRegionReloader[source]

Bases: object

Regenerates and reloads the data specifications.

class spinn_front_end_common.interface.interface_functions.EdgeToNKeysMapper[source]

Bases: object

Works out the number of keys needed for each edge.

class spinn_front_end_common.interface.interface_functions.GraphBinaryGatherer[source]

Bases: object

Extracts binaries to be executed.

class spinn_front_end_common.interface.interface_functions.GraphDataSpecificationWriter[source]

Bases: object

Executes the data specification generation step.

class spinn_front_end_common.interface.interface_functions.GraphMeasurer[source]

Bases: object

Works out how many chips a machine graph needs.

class spinn_front_end_common.interface.interface_functions.GraphProvenanceGatherer[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.HBPAllocator[source]

Bases: object

Request a machine from the HBP remote access server that will fit a number of chips.

class spinn_front_end_common.interface.interface_functions.HBPMaxMachineGenerator[source]

Bases: object

Generates the width and height of the maximum machine a given HBP server can generate.

class spinn_front_end_common.interface.interface_functions.HostExecuteDataSpecification[source]

Bases: object

Executes the host based data specification.

execute_application_data_specs(transceiver, machine, app_id, dsg_targets, uses_advanced_monitors, executable_targets, placements=None, extra_monitor_cores=None, extra_monitor_cores_to_ethernet_connection_map=None, report_folder=None, java_caller=None, processor_to_app_data_base_address=None, disable_advanced_monitor_usage=False)[source]

Execute the data specs for all non-system targets.

Parameters:
  • machine – the python representation of the SpiNNaker machine
  • transceiver – the spinnman instance
  • app_id – the application ID of the simulation
  • dsg_targets – map of placement to file path
  • uses_advanced_monitors – whether to use fast data in protocol
  • executable_targets – what core will running what binary
  • placements – where vertices are located
  • extra_monitor_cores – the deployed extra monitors, if any
  • extra_monitor_cores_to_ethernet_connection_map – how to talk to extra monitor cores
  • processor_to_app_data_base_address – map of placement and DSG data
  • disable_advanced_monitor_usage – whether to avoid using advanced monitors even if they’re available
Returns:

map of placement and DSG data

execute_system_data_specs(transceiver, machine, app_id, dsg_targets, executable_targets, report_folder=None, java_caller=None, processor_to_app_data_base_address=None)[source]

Execute the data specs for all system targets.

Parameters:
  • machine (Machine) – the python representation of the spinnaker machine
  • transceiver (Transceiver) – the spinnman instance
  • app_id (int) – the application ID of the simulation
  • dsg_targets (dict(tuple(int,int,int),str)) – map of placement to file path
  • executable_targets (ExecutableTargets) – the map between binaries and locations and executable types
Returns:

map of placement and DSG data, and loaded data flag.

Return type:

dict(tuple(int,int,int), DataWritten)

first = True
class spinn_front_end_common.interface.interface_functions.InsertChipPowerMonitorsToGraphs[source]

Bases: object

Adds chip power monitors into a given graph.

class spinn_front_end_common.interface.interface_functions.InsertEdgesToExtraMonitorFunctionality[source]

Bases: object

Inserts edges between vertices who use MC speed up and its local MC data gatherer.

class spinn_front_end_common.interface.interface_functions.InsertEdgesToLivePacketGatherers[source]

Bases: object

Add edges from the recorded vertices to the local Live PacketGatherers.

class spinn_front_end_common.interface.interface_functions.InsertExtraMonitorVerticesToGraphs[source]

Bases: object

Inserts the extra monitor vertices into the graph that correspond to the extra monitor cores required.

class spinn_front_end_common.interface.interface_functions.InsertLivePacketGatherersToGraphs[source]

Bases: object

Adds LPGs as required into a given graph

class spinn_front_end_common.interface.interface_functions.LoadExecutableImages[source]

Bases: object

Go through the executable targets and load each binary to everywhere and then send a start request to the cores that actually use it.

load_app_images(executable_targets, app_id, transceiver)[source]
load_sys_images(executable_targets, app_id, transceiver)[source]
class spinn_front_end_common.interface.interface_functions.LocateExecutableStartType[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.LoadFixedRoutes[source]

Bases: object

Load a set of fixed routes onto a SpiNNaker machine.

class spinn_front_end_common.interface.interface_functions.MachineGenerator[source]

Bases: object

Makes a transceiver and a Machine object.

class spinn_front_end_common.interface.interface_functions.NotificationProtocol[source]

Bases: object

The notification protocol for external device interaction

send_read_notification(database_directory)[source]

Send the read notifications via the notification protocol

Parameters:database_directory – the path to the database
Return type:None:
send_start_resume_notification()[source]

Send the start notifications via the notification protocol

Return type:None:
send_stop_pause_notification()[source]

Send the stop or pause notifications via the notification protocol

Return type:None:
stop()[source]

Ends the notification protocol

Return type:None:
wait_for_confirmation()[source]

Waits for devices to confirm they have read the database via the notification protocol

Return type:None:
class spinn_front_end_common.interface.interface_functions.PlacementsProvenanceGatherer[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.PreAllocateResourcesForChipPowerMonitor[source]

Bases: object

Adds chip power monitor resources as required for a machine

class spinn_front_end_common.interface.interface_functions.PreAllocateResourcesForExtraMonitorSupport[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.PreAllocateResourcesForLivePacketGatherers[source]

Bases: object

Adds Live Packet Gatherer resources as required for a machine

class spinn_front_end_common.interface.interface_functions.ProcessPartitionConstraints[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.ProfileDataGatherer[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.ProvenanceJSONWriter[source]

Bases: object

Write provenance data into JSON

class spinn_front_end_common.interface.interface_functions.ProvenanceXMLWriter[source]

Bases: object

Write provenance data into XML

class spinn_front_end_common.interface.interface_functions.RouterProvenanceGatherer[source]

Bases: object

Gathers diagnostics from the routers.

class spinn_front_end_common.interface.interface_functions.RoutingSetup[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.RoutingTableLoader[source]

Bases: object

class spinn_front_end_common.interface.interface_functions.SpallocAllocator[source]

Bases: object

Request a machine from a SPALLOC server that will fit the given number of chips

class spinn_front_end_common.interface.interface_functions.SpallocMaxMachineGenerator[source]

Bases: object

Generates a maximum virtual machine a given allocation server can generate

class spinn_front_end_common.interface.interface_functions.TagsLoader[source]

Bases: object

Loads tags onto the machine

static load_iptags(iptags, transceiver, progress_bar)[source]

Loads all the IP tags individually.

Parameters:
  • iptags – the IP tags to be loaded.
  • transceiver – the transceiver object
Return type:

None

static load_reverse_iptags(reverse_ip_tags, transceiver, progress_bar)[source]

Loads all the reverse IP tags individually.

Parameters:
  • reverse_ip_tags – the reverse IP tags to be loaded
  • transceiver – the transceiver object
Return type:

None

class spinn_front_end_common.interface.interface_functions.TDMAAgendaBuilder[source]

Bases: object

Algorithm that builds an agenda for transmissions. It uses a TDMA (time-division multiple access) system and graph colouring to deduce the agenda set up. Ensures parallel transmissions so that the destination should never be overloaded.

class spinn_front_end_common.interface.interface_functions.VirtualMachineGenerator[source]

Bases: object

Generates a virtual machine with given dimensions and configuration.

spinn_front_end_common.interface.profiling package
Module contents
class spinn_front_end_common.interface.profiling.AbstractHasProfileData[source]

Bases: object

Indicates an object that can record a profile

get_profile_data(transceiver, placement)[source]

Get the profile data recorded during simulation

Return type:spinn_front_end_common.interface.profiling.profile_data.ProfileData
class spinn_front_end_common.interface.profiling.ProfileData(tag_labels)[source]

Bases: object

A container for profile data

Parameters:tag_labels (list(str)) – A list of labels indexed by tag ID
DURATION = 1
START_TIME = 0
add_data(data)[source]

Add profiling data read from the profile section

Parameters:data (bytearray) – Data read from the profile section on the machine
get_mean_ms(tag)[source]

Get the mean time in milliseconds spent on operations with the given tag

Parameters:tag (str) – The tag to get the mean time for
Return type:float
get_mean_ms_per_ts(tag, machine_time_step_ms)[source]

Get the mean time in milliseconds spent on operations with the given tag per timestep

Parameters:
  • tag (str) – The tag to get the data for
  • machine_time_step_ms (int) – The time step of the simulation in microseconds
Return type:

float

get_mean_n_calls_per_ts(tag, machine_time_step_ms)[source]

Get the mean number of times the given tag was recorded per timestep

Parameters:
  • tag (str) – The tag to get the data for
  • machine_time_step_ms (int) – The time step of the simulation in microseconds
Return type:

float

get_n_calls(tag)[source]

Get the number of times the given tag was recorded

Parameters:tag (str) – The tag to get the number of calls of
Return type:int
tags

The tags recorded as labels

Return type:list(str)
spinn_front_end_common.interface.provenance package
Module contents
class spinn_front_end_common.interface.provenance.AbstractProvidesLocalProvenanceData[source]

Bases: object

Indicates an object that provides locally obtained provenance data

get_local_provenance_data()[source]

Get an iterable of provenance data items

Returns:iterable of ProvenanceDataItem
class spinn_front_end_common.interface.provenance.AbstractProvidesProvenanceDataFromMachine[source]

Bases: object

Indicates that an object provides provenance data retrieved from the machine

get_provenance_data_from_machine(transceiver, placement)[source]

Get an iterable of provenance data items

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface object
  • placement (Placement) – the placement of the object
Returns:

the provenance items

Return type:

iterable(ProvenanceDataItem)

class spinn_front_end_common.interface.provenance.PacmanProvenanceExtractor[source]

Bases: object

Extracts Provenance data from a PACMANAlgorithmExecutor

clear()[source]

Clears the provenance data store

Return type:None
data_items

Returns the provenance data items

Returns:list of provenance data items.
Return type:iterable(ProvenanceDataItem)
extract_provenance(executor)[source]

Acquires the timings from PACMAN algorithms (provenance data)

Parameters:executor – the PACMAN workflow executor
Return type:None
class spinn_front_end_common.interface.provenance.ProvidesProvenanceDataFromMachineImpl[source]

Bases: spinn_front_end_common.interface.provenance.abstract_provides_provenance_data_from_machine.AbstractProvidesProvenanceDataFromMachine

An implementation that gets provenance data from a region of ints on the machine.

NUM_PROVENANCE_DATA_ENTRIES = 5
class PROVENANCE_DATA_ENTRIES[source]

Bases: enum.Enum

entries for the provenance data generated by models using provides provenance vertex

CALLBACK_QUEUE_OVERLOADED = 1
DMA_QUEUE_OVERLOADED = 2
MAX_NUMBER_OF_TIMER_TIC_OVERRUN = 4
TIMER_TIC_HAS_OVERRUN = 3
TRANSMISSION_EVENT_OVERFLOW = 0
get_provenance_data_from_machine(transceiver, placement)[source]

Get an iterable of provenance data items

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface object
  • placement (Placement) – the placement of the object
Returns:

the provenance items

Return type:

iterable(ProvenanceDataItem)

static get_provenance_data_size(n_additional_data_items)[source]
reserve_provenance_data_region(spec)[source]
spinn_front_end_common.interface.simulation package
Module contents
spinn_front_end_common.interface.simulation.get_simulation_header_array(binary_file_name, machine_time_step, time_scale_factor)[source]

Get data to be written to the simulation header

Parameters:
  • binary_file_name – The name of the binary of the application
  • machine_time_step – The time step of the simulation
  • time_scale_factor – The time scaling of the simulation
Returns:

An array of values to be written as the simulation header

Submodules
spinn_front_end_common.interface.abstract_spinnaker_base module

main interface for the SpiNNaker tools

class spinn_front_end_common.interface.abstract_spinnaker_base.AbstractSpinnakerBase(configfile, executable_finder, graph_label=None, database_socket_addresses=None, extra_algorithm_xml_paths=None, n_chips_required=None, n_boards_required=None, default_config_paths=None, validation_cfg=None, front_end_versions=None)[source]

Bases: spinn_front_end_common.interface.config_handler.ConfigHandler, spinn_front_end_common.utilities.simulator_interface.SimulatorInterface

Main interface into the tools logic flow

Parameters:
  • configfile (str) – What the configuration file is called
  • executable_finder (ExecutableFinder) – How to find APLX files to deploy to SpiNNaker
  • graph_label (str) – A label for the overall application graph
  • database_socket_addresses (iterable(SocketAddress)) – How to talk to notification databases
  • extra_algorithm_xml_paths (iterable(str)) – Where to load definitions of extra algorithms from
  • n_chips_required (int) – Overrides the number of chips to allocate from spalloc
  • n_boards_required (int) – Overrides the number of boards to allocate from spalloc
  • default_config_paths (list(str)) – Directories to load configurations from
  • validation_cfg (str) – How to validate configuration files
  • front_end_versions (list(tuple(str,str))) – information about what software is in use
add_application_edge(edge_to_add, partition_identifier)[source]
Parameters:
  • edge_to_add
  • partition_identifier (str) – the partition identifier for the outgoing edge partition
Type:

ApplicationEdge

Return type:

None

add_application_vertex(vertex)[source]
Parameters:

vertex – the vertex to add to the graph

Type:

ApplicationVertex

Return type:

None

Raises:
  • ConfigurationException – when both graphs contain vertices
  • PacmanConfigurationException – If there is an attempt to add the same vertex more than once
add_extraction_timing(timing)[source]

Record the time taken for doing data extraction.

add_live_packet_gatherer_parameters(live_packet_gatherer_params, vertex_to_record_from, partition_ids)[source]

Adds params for a new LPG if needed, or adds to the tracker for same params.

Parameters:
  • live_packet_gatherer_params – params to look for a LPG
  • vertex_to_record_from – the vertex that needs to send to a given LPG
  • partition_ids – the IDs of the partitions to connect from the vertex
Return type:

None

add_machine_edge(edge, partition_id)[source]
Parameters:
  • edge – the edge to add to the graph
  • partition_id (str) – the partition identifier for the outgoing edge partition
Type:

MachineEdge

Return type:

None

add_machine_vertex(vertex)[source]
Parameters:

vertex – the vertex to add to the graph

Type:

MachineVertex

Return type:

None

Raises:
  • ConfigurationException – when both graphs contain vertices
  • PacmanConfigurationException – If there is an attempt to add the same vertex more than once
add_socket_address(socket_address)[source]

Add the address of a socket used in the run notification protocol.

Parameters:
  • socket_address (SocketAddress) – The address of the socket
  • socket_address – The address of the database socket
Return type:

None

Return type:

None

application_graph

The application graph used to derive the runtime machine configuration.

buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

dsg_algorithm

The DSG algorithm used by the tools

exception_handler(exctype, value, traceback_obj)[source]

Handler of exceptions

Parameters:
  • exctype – the type of execution received
  • value – the value of the exception
  • traceback_obj – the trace back stuff
extend_extra_load_algorithms(extra_load_algorithms)[source]

Add custom data-loading algorithms to the sequence of such algorithms to be run.

Parameters:extra_load_algorithms (list) – Algorithms to add
extend_extra_mapping_algorithms(extra_mapping_algorithms)[source]

Add custom mapping algorithms to the end of the sequence of mapping algorithms to be run.

Parameters:extra_mapping_algorithms (list) – Algorithms to add
extend_extra_post_run_algorithms(extra_post_run_algorithms)[source]

Add custom post-execution algorithms to the sequence of such algorithms to be run.

Parameters:extra_post_run_algorithms (list) – Algorithms to add
fixed_routes
generate_file_machine()[source]

Generates a machine JSON file

get_current_time()[source]

Get the current simulation time.

Return type:float
get_generated_output(name_of_variable)[source]

Get the value of an inter-algorithm variable.

Parameters:name_of_variable (str) – The variable to retrieve
Returns:The value (of arbitrary type), or None if the variable is not found.
get_number_of_available_cores_on_machine

The number of available cores on the machine after taking into account preallocated resources.

Returns:number of available cores
Return type:int
graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
has_reset_last
increment_none_labelled_edge_count()[source]

Increment the number of new edges which have not been labelled.

machine

The python machine description object.

Return type:Machine
machine_graph
no_machine_time_steps

The number of machine time steps.

Return type:int
none_labelled_edge_count

The number of times edges have not been labelled.

original_application_graph
original_machine_graph
placements
prepend_extra_pre_run_algorithms(extra_pre_run_algorithms)[source]

Add custom pre-execution algorithms to the front of the sequence of algorithms to be run.

Parameters:extra_pre_run_algorithms (list) – Algorithms to add
reset()[source]

Code that puts the simulation back at time zero

routing_infos
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:
  • run_time – the run duration in milliseconds. Run a simulation for a fixed amount of time
  • run_time – the run duration in milliseconds.
run_until_complete()[source]

Run a simulation until it completes

set_n_boards_required(n_boards_required)[source]

Sets the machine requirements.

Warning: This method should not be called after the machine requirements have be computed based on the graph.

Parameters:n_boards_required – The number of boards required
Raises:ConfigurationException If any machine requirements have already been set
set_up_machine_specifics(hostname)[source]

Adds machine specifics for the different modes of execution

Parameters:hostname (str) – machine name
Return type:None
stop(turn_off_machine=None, clear_routing_tables=None, clear_tags=None)[source]

End running of the simulation.

Parameters:
  • turn_off_machine (bool) – decides if the machine should be powered down after running the execution. Note that this powers down all boards connected to the BMP connections given to the transceiver
  • clear_routing_tables (bool) – informs the tool chain if it should turn off the clearing of the routing tables
  • clear_tags (boolean) – informs the tool chain if it should clear the tags off the machine at stop
Return type:

None

stop_run()[source]

Request that the current infinite run stop.

Note

This will need to be called from another thread as the infinite run call is blocking.

tags
timescale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
update_extra_inputs(extra_inputs)[source]

Supply extra inputs to the runtime algorithms. Mappings are from known names (the logical type names) to the values to bind to them.

Parameters:extra_inputs (dict(str,any)) – The additional inputs to provide
update_extra_mapping_inputs(extra_mapping_inputs)[source]

Supply extra inputs to the mapping algorithms. Mappings are from known names (the logical type names) to the values to bind to them.

Parameters:extra_inputs (dict(str,any)) – The additional inputs to provide
use_virtual_board

True if this run is using a virtual machine

verify_not_running()[source]

Verify that the simulator is in a state where it can start running.

spinn_front_end_common.interface.abstract_spinnaker_base.DEFAULT_N_VIRTUAL_CORES = 16

Number of cores to be used when using a Virtual Machine and not specified

spinn_front_end_common.interface.abstract_spinnaker_base.MINIMUM_OFF_STATE_TIME = 20

The minimum time a board is kept in the off state, in seconds

spinn_front_end_common.interface.config_handler module
class spinn_front_end_common.interface.config_handler.ConfigHandler(configfile, default_config_paths, validation_cfg)[source]

Bases: object

Subclass of AbstractSpinnaker base that handles function only dependent of the config and the order its methods are called

child_folder(parent, child_name, must_create=False)[source]
Parameters:must_create – If True, the directory named by child_name (but not necessarily its parents) must be created by this call, and an exception will be thrown if this fails.
Raises:OSError – if the directory existed ahead of time and creation was required by the user
machine_time_step
set_up_output_application_data_specifics(n_calls_to_run)[source]
Parameters:n_calls_to_run (int) – the counter of how many times run has been called.
Returns:the run folder for this simulation to hold app data
set_up_timings(machine_time_step=None, time_scale_factor=None)[source]

Set up timings of the machine

Parameters:
  • machine_time_step – An explicitly specified time step for the machine. If None, the value is read from the config
  • time_scale_factor – An explicitly specified time scale factor for the simulation. If None, the value is read from the config
time_scale_factor
write_finished_file()[source]

Write a finished file that allows file removal to only remove folders that are finished.

spinn_front_end_common.interface.java_caller module
class spinn_front_end_common.interface.java_caller.JavaCaller(json_folder, java_call, java_spinnaker_path=None, java_properties=None)[source]

Bases: object

Support class that holds all the stuff for running stuff in Java. This includes the work of preparing data for transmitting to Java and back.

This separates the choices of how to call the Java batch vs streaming, jar locations, parameters, etc from the rest of the python code.

Creates a java caller and checks the user/config parameters.

Parameters:
  • json_folder (str) – The location where the machine JSON is written.
  • java_call (str) – Call to start java. Including the path if required.
  • java_spinnaker_path – the path where the java code can be found. This must point to a local copy of https://github.com/SpiNNakerManchester/JavaSpiNNaker. It must also have been built! If None the assumption is that it is the same parent directory as https://github.com/SpiNNakerManchester/SpiNNFrontEndCommon.
  • java_properties (str) – Optional properties that will be passed to Java. Must start with -D. For example -Dlogging.level=DEBUG
Raises:

ConfigurationException – if simple parameter checking fails.

execute_app_data_specification(use_monitors)[source]

Writes all the data specs for application cores, uploading the result to the machine.

execute_data_specification()[source]

Writes all the data specs, uploading the result to the machine.

execute_system_data_specification()[source]

Writes all the data specs for system cores, uploading the result to the machine.

get_all_data()[source]

Gets all the data from the previously set placements and put these in the previously set database.

set_advanced_monitors(placements, tags, monitor_cores, packet_gathers)[source]
Parameters:
  • placements (Placements) – The placements of the vertices
  • tags (Tags) – The tags assigned to the vertices
  • monitor_cores (dict(Vertex,Vertex)) – Where the advanced monitor for each core is
  • packet_gathers (dict(Vertex,Vertex)) – Where the packet gatherers are
Return type:

None

set_machine(machine)[source]

Passes the machine in leaving this class to decide pass it to Java.

Parameters:machine (Machine) – A machine Object
set_placements(placements, transceiver)[source]

Passes in the placements leaving this class to decide pass it to Java.

This method may obtain extra information about he placements which is why it also needs the transceiver.

Currently the extra information extracted is recording region base address but this could change if recording region saved in the database.

Currently this method uses JSON but that may well change to using the database.

Parameters:
set_report_folder(report_folder)[source]

Passes the database file in.

Parameters:report_folder (str) – Path to directory with SQLite databases and into which java will write
spinn_front_end_common.interface.simulator_state module
class spinn_front_end_common.interface.simulator_state.Simulator_State(value, doc='')[source]

Bases: enum.Enum

Different states the Simulator could be in.

FINISHED = 3

run ended shutdown not called

INIT = 0

init called

IN_RUN = 1

inside run method

RUN_FOREVER = 2

finished run method, but running forever

SHUTDOWN = 4

shutdown called

STOP_REQUESTED = 5

stop requested in middle of run forever

Module contents
spinn_front_end_common.mapping_algorithms package
Subpackages
spinn_front_end_common.mapping_algorithms.on_chip_router_table_compression package
Submodules
spinn_front_end_common.mapping_algorithms.on_chip_router_table_compression.compression module
spinn_front_end_common.mapping_algorithms.on_chip_router_table_compression.compression.mundy_on_chip_router_compression(routing_tables, transceiver, machine, app_id, system_provenance_folder, compress_only_when_needed=True, compress_as_much_as_possible=False)[source]

Load routing tables and compress then using Mundy’s algorithm

Parameters:
  • routing_tables – the memory routing tables to be compressed
  • transceiver – the spinnman interface
  • machine – the SpiNNaker machine representation
  • app_id – the application ID used by the main application
  • system_provenance_folder – the path to where to write the data
  • compress_as_much_as_possible (bool) – If False, the compressor will only reduce the table until it fits in the router space, otherwise it will try to reduce until it until it can’t reduce it any more
  • compress_only_when_needed (bool) – If True, the compressor will only compress if the table doesn’t fit in the current router space, otherwise it will just load the table
Returns:

spinn_front_end_common.mapping_algorithms.on_chip_router_table_compression.compression.pair_compression(routing_tables, transceiver, executable_finder, machine, app_id, provenance_file_path, compress_only_when_needed=False, compress_as_much_as_possible=True)[source]

Load routing tables and compress then using Pair Algorithm

See pacman/operations/router_compressors/pair_compressor.py which is the
exact same algorithm implemented in python
Parameters:
  • routing_tables – the memory routing tables to be compressed
  • transceiver – the spinnman interface
  • executable_finder
  • machine – the SpiNNaker machine representation
  • app_id – the application ID used by the main application
  • provenance_file_path – the path to where to write the data
  • compress_as_much_as_possible (bool) – If False, the compressor will only reduce the table until it fits in the router space, otherwise it will try to reduce until it until it can’t reduce it any more
  • compress_only_when_needed (bool) – If True, the compressor will only compress if the table doesn’t fit in the current router space, otherwise it will just load the table
Module contents
Module contents
spinn_front_end_common.utilities package
Subpackages
spinn_front_end_common.utilities.connections package
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(str)) – Labels of vertices from which live events will be received.
  • send_labels (iterable(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, translate_key=True)[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, list(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.
  • translate_key – True if the key is to be converted to an atom ID, False if the key should stay a key
add_receive_label(label)[source]
add_send_label(label)[source]
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]

Add a callback for the start and resume state of the simulation

Parameters:
  • label (str) – the label of the function to be sent
  • start_resume_callback (function(str, SpynnakerLiveEventConnection) -> None) – A function to be called when the start or resume 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

close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
send_eieio_message(message, label)[source]

Send an EIEIO message (using one-way the live input) to the vertex with the given label.

Parameters:
  • message – The EIEIO message to send
  • label – The label of the receiver machine vertex
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_event_with_payload(label, atom_id, payload)[source]

Send an event with a payload 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
  • payload (int) – The payload to send
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 (list(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
send_events_with_payloads(label, atom_ids_and_payloads)[source]

Send a number of events with payloads

Parameters:
  • label (str) – The label of the vertex from which the events will originate
  • atom_ids_and_payloads (list((int, int))) – array-like of tuples of atom IDs sending events with their payloads
spinn_front_end_common.utilities.database package
Module contents
class spinn_front_end_common.utilities.database.DatabaseConnection(start_resume_callback_function=None, stop_pause_callback_function=None, local_host=None, local_port=19999)[source]

Bases: spinnman.connections.udp_packet_connections.udp_connection.UDPConnection

A connection from the toolchain which will be notified when the database has been written, and can then respond when the database has been read, and further wait for notification that the simulation has started.

Parameters:
  • start_resume_callback_function (function() -> None) – A function to be called when the start message has been received. This function should not take any parameters or return anything.
  • 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_database_callback(database_callback_function)[source]

Add a database callback to be called when the database is ready.

Parameters:database_callback_function (function( spinn_front_end_common.utilities.database.database_reader.DatabaseReader) -> None) – A function to be called when the database message has been received. This function should take a single parameter, which will be a DatabaseReader object. Once the function returns, it will be assumed that the database has been read, and the return response will be sent.
Raises:SpinnmanIOException – If anything goes wrong
close()[source]

Closes the connection

Returns:Nothing is returned
Return type:None
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.database.DatabaseReader(database_path)[source]

Bases: object

A reader for the database.

Parameters:database_path (str) – The path to the database
close()[source]
cursor

The database cursor. Allows custom SQL queries to be performed.

Return type:sqlite3.Cursor
get_atom_id_to_key_mapping(label)[source]

Get a mapping of atom ID to event key for a given vertex

Parameters:label (str) – The label of the vertex
Returns:dictionary of event keys indexed by atom ID
Return type:dict(int, int)
get_configuration_parameter_value(parameter_name)[source]

Get the value of a configuration parameter

Parameters:parameter_name (str) – The name of the parameter
Returns:The value of the parameter
Return type:float
get_ip_address(x, y)[source]

Get an IP address to contact a chip

Parameters:
  • x – The x-coordinate of the chip
  • y – The y-coordinate of the chip
Returns:

The IP address of the Ethernet to use to contact the chip

get_key_to_atom_id_mapping(label)[source]

Get a mapping of event key to atom ID for a given vertex

Parameters:label (str) – The label of the vertex
Returns:dictionary of atom IDs indexed by event key
Return type:dict(int, int)
get_live_input_details(label)[source]

Get the IP address and port where live input should be sent for a given vertex

Parameters:label (str) – The label of the vertex
Returns:tuple of (IP address, port)
Return type:tuple(str, int)
get_live_output_details(label, receiver_label)[source]

Get the IP address, port and whether the SDP headers are to be stripped from the output from a vertex

Parameters:label (str) – The label of the vertex
Returns:tuple of (IP address, port, strip SDP)
Return type:tuple(str, int, bool)
get_machine_live_input_details(label)[source]

Get the IP address and port where live input should be sent for a given machine vertex

Parameters:label (str) – The label of the vertex
Returns:tuple of (IP address, port)
Return type:tuple(str, int)
get_machine_live_input_key(label)[source]
get_machine_live_output_details(label, receiver_label)[source]

Get the IP address, port and whether the SDP headers are to be stripped from the output from a machine vertex

Parameters:label (str) – The label of the vertex
Returns:tuple of (IP address, port, strip SDP)
Return type:tuple(str, int, bool)
get_machine_live_output_key(label, receiver_label)[source]
get_n_atoms(label)[source]

Get the number of atoms in a given vertex

Parameters:label (str) – The label of the vertex
Returns:The number of atoms
Return type:int
get_placement(label)[source]

Get the placement of a machine vertex with a given label

Parameters:label (str) – The label of the vertex
Returns:The x, y, p coordinates of the vertex
Return type:tuple(int, int, int)
get_placements(label)[source]

Get the placements of an application vertex with a given label

Parameters:label (str) – The label of the vertex
Returns:A list of x, y, p coordinates of the vertices
Return type:list(tuple(int, int, int))
class spinn_front_end_common.utilities.database.DatabaseWriter(database_directory)[source]

Bases: object

The interface for the database system for main front ends. Any special tables needed from a front end should be done by sub classes of this interface.

add_application_vertices(application_graph)[source]
Parameters:application_graph
Return type:None
add_machine_objects(machine)[source]

Store the machine object into the database

Parameters:machine – the machine object.
Return type:None
add_placements(placements)[source]

Adds the placements objects into the database

Parameters:
  • placements – the placements object
  • machine_graph – the machine graph object
Return type:

None

add_routing_infos(routing_infos, machine_graph)[source]

Adds the routing information (key masks etc) into the database

Parameters:
  • routing_infos – the routing information object
  • machine_graph – the machine graph object
Return type:

None:

add_routing_tables(routing_tables)[source]

Adds the routing tables into the database

Parameters:routing_tables – the routing tables object
Return type:None
add_system_params(time_scale_factor, machine_time_step, runtime)[source]

Write system params into the database

Parameters:
  • time_scale_factor – the time scale factor used in timing
  • machine_time_step – the machine time step used in timing
  • runtime – the amount of time the application is to run for
add_tags(machine_graph, tags)[source]

Adds the tags into the database

Parameters:
  • machine_graph – the machine graph object
  • tags – the tags object
Return type:

None

add_vertices(machine_graph, data_n_timesteps, graph_mapper, application_graph)[source]

Add the machine graph, graph mapper and application graph into the database.

Parameters:
  • machine_graph – the machine graph object
  • data_n_timesteps – The number of timesteps for which data space will been reserved
  • graph_mapper – the graph mapper object
  • application_graph – the application graph object
Return type:

None

static auto_detect_database(machine_graph)[source]

Auto detects if there is a need to activate the database system

Parameters:machine_graph – the machine graph of the application problem space.
Returns:a bool which represents if the database is needed
create_atom_to_event_id_mapping(application_graph, machine_graph, routing_infos, graph_mapper)[source]
Parameters:
  • application_graph
  • machine_graph
  • routing_infos
  • graph_mapper
Return type:

None

database_path
spinn_front_end_common.utilities.notification_protocol package
Module contents
class spinn_front_end_common.utilities.notification_protocol.NotificationProtocol(socket_addresses, wait_for_read_confirmation)[source]

Bases: object

The protocol which hand shakes with external devices about the database and starting execution

close()[source]

Closes the thread pool

send_read_notification(database_path)[source]

Sends notifications to all devices which have expressed an interest in when the database has been written

Parameters:database_path – the path to the database file
Return type:None
send_start_resume_notification()[source]

Either waits till all sources have confirmed read the database and are configured, and/or just sends the start notification (when the system is executing)

Return type:None
send_stop_pause_notification()[source]

Sends the pause / stop notifications when the script has either finished or paused

Return type:None
wait_for_confirmation()[source]

If asked to wait for confirmation, waits for all external systems to confirm that they are configured and have read the database

Return type:None
class spinn_front_end_common.utilities.notification_protocol.SocketAddress(notify_host_name, notify_port_no, listen_port)[source]

Bases: object

Data holder for a socket interface for notification protocol.

listen_port

The port to listen to for responses

notify_host_name

The notify host name

notify_port_no

The notify port no

spinn_front_end_common.utilities.report_functions package
Submodules
spinn_front_end_common.utilities.report_functions.energy_report module
class spinn_front_end_common.utilities.report_functions.energy_report.EnergyReport[source]

Bases: object

Creates a report about the approximate total energy consumed by a SpiNNaker job execution.

ENERGY_DETAILED_FILENAME = 'Detailed_energy_report.rpt'
ENERGY_SUMMARY_FILENAME = 'energy_summary_report.rpt'
JOULES_PER_SPIKE = 8e-10
JOULES_TO_KILOWATT_HOURS = 3600000
MILLIWATTS_FOR_BOXED_48_CHIP_FRAME_IDLE_COST = 0.0045833333
MILLIWATTS_FOR_FRAME_IDLE_COST = 0.117
MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD = 0.0006399999999999999
MILLIWATTS_PER_FPGA = 0.000584635
MILLIWATTS_PER_FRAME_ACTIVE_COST = 0.154163558
MILLIWATTS_PER_IDLE_CHIP = 0.00036
MILLIWATTS_PER_UNBOXED_48_CHIP_FRAME_IDLE_COST = 0.01666667
N_MONITORS_ACTIVE_DURING_COMMS = 2
Module contents
class spinn_front_end_common.utilities.report_functions.EnergyReport[source]

Bases: object

Creates a report about the approximate total energy consumed by a SpiNNaker job execution.

ENERGY_DETAILED_FILENAME = 'Detailed_energy_report.rpt'
ENERGY_SUMMARY_FILENAME = 'energy_summary_report.rpt'
JOULES_PER_SPIKE = 8e-10
JOULES_TO_KILOWATT_HOURS = 3600000
MILLIWATTS_FOR_BOXED_48_CHIP_FRAME_IDLE_COST = 0.0045833333
MILLIWATTS_FOR_FRAME_IDLE_COST = 0.117
MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD = 0.0006399999999999999
MILLIWATTS_PER_FPGA = 0.000584635
MILLIWATTS_PER_FRAME_ACTIVE_COST = 0.154163558
MILLIWATTS_PER_IDLE_CHIP = 0.00036
MILLIWATTS_PER_UNBOXED_48_CHIP_FRAME_IDLE_COST = 0.01666667
N_MONITORS_ACTIVE_DURING_COMMS = 2
class spinn_front_end_common.utilities.report_functions.FixedRouteFromMachineReport[source]

Bases: object

Generate a report of the fixed routes from the machine.

class spinn_front_end_common.utilities.report_functions.MemoryMapOnHostChipReport[source]

Bases: object

Report on memory usage.

class spinn_front_end_common.utilities.report_functions.MemoryMapOnHostReport[source]

Bases: object

Report on memory usage.

class spinn_front_end_common.utilities.report_functions.RoutingTableFromMachineReport[source]

Bases: object

spinn_front_end_common.utilities.scp package
Module contents
class spinn_front_end_common.utilities.scp.ClearIOBUFProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

clear_iobuf(core_subsets, n_cores)[source]
receive_response(_response)[source]
class spinn_front_end_common.utilities.scp.SCPClearIOBUFRequest(x, y, p, destination_port, expect_response=True)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.scp.SCPUpdateRuntimeRequest(x, y, p, current_time, run_time, infinite_run, destination_port, expect_response=True)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.scp.UpdateRuntimeProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

receive_response(_response)[source]
update_runtime(current_time, run_time, infinite_run, core_subsets, n_cores)[source]
spinn_front_end_common.utilities.utility_objs package
Subpackages
spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages package
Module contents
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.GetReinjectionStatusMessage(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to get the status of the dropped packet reinjection

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.GetReinjectionStatusMessageResponse(command_code)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_response.AbstractSCPResponse

An SCP response to a request for the dropped packet reinjection status

read_data_bytestring(data, offset)[source]

See spinnman.messages.scp.abstract_scp_response.AbstractSCPResponse.read_data_bytestring()

reinjection_functionality_status
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.ResetCountersMessage(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to reset the statistics counters of the dropped packet reinjection

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.SetReinjectionPacketTypesMessage(x, y, p, multicast, point_to_point, fixed_route, nearest_neighbour)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to set the dropped packet reinjected packet types

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
  • point_to_point (bool) – If point to point should be set
  • multicast (bool) – If multicast should be set
  • nearest_neighbour (bool) – If nearest neighbour should be set
  • fixed_route (bool) – If fixed route should be set
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.SetRouterEmergencyTimeoutMessage(x, y, p, timeout_mantissa, timeout_exponent)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to set the router emergency timeout for dropped packet reinjection

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
  • timeout_mantissa (int) – The mantissa of the timeout value, between 0 and 15
  • timeout_exponent (int) – The exponent of the timeout value, between 0 and 15
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.SetRouterTimeoutMessage(x, y, p, timeout_mantissa, timeout_exponent)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to the extra monitor core to set the router timeout for dropped packet reinjection

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
  • timeout_mantissa (int) – The mantissa of the timeout value, between 0 and 15
  • timeout_exponent (int) – The exponent of the timeout value, between 0 and 15
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.ClearReinjectionQueueMessage(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to set the dropped packet reinjected packet types

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.LoadApplicationMCRoutesMessage(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to write the application multicast routes into the router.

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_messages.LoadSystemMCRoutesMessage(x, y, p)[source]

Bases: spinnman.messages.scp.abstract_messages.scp_request.AbstractSCPRequest

An SCP Request to write the system multicast routes into the router

Parameters:
  • x (int) – The x-coordinate of a chip, between 0 and 255
  • y (int) – The y-coordinate of a chip, between 0 and 255
  • p (int) – The processor running the extra monitor vertex, between 0 and 17
  • command_code – the command code used by the extra monitor vertex for setting system multicast routes.
get_scp_response()[source]

Get an SCP response message to be used to process any response received

Returns:An SCP response, or None if no response is required
Return type:spinnman.messages.scp_response.SCPResponse
Raises:None – No known exceptions are raised
spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes package
Module contents
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.ReadStatusProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

get_reinjection_status(x, y, p)[source]
get_reinjection_status_for_core_subsets(core_subsets)[source]
handle_reinjection_status_response(response)[source]
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.ResetCountersProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

reset_counters(core_subsets)[source]
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.SetPacketTypesProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

set_packet_types(core_subsets, point_to_point, multicast, nearest_neighbour, fixed_route)[source]

Set what types of packets should be reinjected.

Parameters:
  • core_subsets – sets of cores to send command to
  • point_to_point (bool) – If point-to-point should be set
  • multicast (bool) – If multicast should be set
  • nearest_neighbour (bool) – If nearest neighbour should be set
  • fixed_route (bool) – If fixed route should be set
  • command_code – The SCP command code
Return type:

None

class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.SetRouterEmergencyTimeoutProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

set_timeout(mantissa, exponent, core_subsets)[source]
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.SetRouterTimeoutProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

set_timeout(mantissa, exponent, core_subsets)[source]
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.ClearQueueProcess(connection_selector)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

reset_counters(core_subsets)[source]
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.LoadApplicationMCRoutesProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

load_application_mc_routes(core_subsets)[source]
Parameters:core_subsets – sets of cores to send command to
Return type:None
class spinn_front_end_common.utilities.utility_objs.extra_monitor_scp_processes.LoadSystemMCRoutesProcess(next_connection_selector, n_retries=10, timeout=1.0, n_channels=8, intermediate_channel_waits=7)[source]

Bases: spinnman.processes.abstract_multi_connection_process.AbstractMultiConnectionProcess

load_system_mc_routes(core_subsets)[source]
Parameters:core_subsets – sets of cores to send command to
Return type:None
Module contents
class spinn_front_end_common.utilities.utility_objs.DataWritten(start_address, memory_used, memory_written)[source]

Bases: object

Describes data written to SpiNNaker.

memory_used
memory_written
start_address
class spinn_front_end_common.utilities.utility_objs.DPRIFlags(value, doc='')[source]

Bases: enum.Enum

SCP Dropped Packet Reinjection (DPRI) packet type flags

FIXED_ROUTE = 8
MULTICAST = 1
NEAREST_NEIGHBOUR = 4
POINT_TO_POINT = 2
class spinn_front_end_common.utilities.utility_objs.ExecutableFinder(binary_search_paths=None, include_common_binaries_folder=True)[source]

Bases: spinn_utilities.executable_finder.ExecutableFinder

Manages a set of folders in which to search for binaries, and allows for binaries to be discovered within this path. This adds a default location to look to the base class.

Parameters:
  • binary_search_paths (iterable of str) – The initial set of folders to search for binaries.
  • include_common_binaries_folder (bool) – If True (i.e. the default), the spinn_front_end_common.common_model_binaries folder is searched for binaries. If you are not using the common models, or the model binary names conflict with your own, this parameter can be used to avoid this issue. Note that the folder will be appended to the value of binary_search_paths, so the common binary search path will be looked in last.
class spinn_front_end_common.utilities.utility_objs.ExecutableType(value, start_state, end_state, supports_auto_pause_and_resume, doc='')[source]

Bases: enum.Enum

The different types of executable from the perspective of how they are started and controlled.

NO_APPLICATION = 3
RUNNING = 0
SYNC = 1
SYSTEM = 4
USES_SIMULATION_INTERFACE = 2
class spinn_front_end_common.utilities.utility_objs.LivePacketGatherParameters(port, hostname, tag, strip_sdp, use_prefix, key_prefix, prefix_type, message_type, right_shift, payload_as_time_stamps, use_payload_prefix, payload_prefix, payload_right_shift, number_of_packets_sent_per_time_step, label, board_address=None)[source]

Bases: object

Parameter holder for LPGs so that they can be instantiated at a later date.

board_address
hostname
key_prefix
label
message_type
number_of_packets_sent_per_time_step
payload_as_time_stamps
payload_prefix
payload_right_shift
port
prefix_type
right_shift
strip_sdp
tag
use_payload_prefix
use_prefix
class spinn_front_end_common.utilities.utility_objs.ProvenanceDataItem(names, value, report=False, message=None)[source]

Bases: object

Container for provenance data

Parameters:
  • names – A list of strings representing the naming hierarchy of this item
  • value – The value of the item
  • report – True if the item should be reported to the user
  • message – The message to send to the end user if report is True
message

The message to report to the end user, or None if no message

names

The hierarchy of names of this bit of provenance data

report

True if this provenance data entry needs reporting to the end user

value

The value of the item

class spinn_front_end_common.utilities.utility_objs.ReInjectionStatus(data, offset)[source]

Bases: object

Represents a status information from dropped packet reinjection

Parameters:
  • data (str) – The data containing the information
  • offset (int) – The offset in the data where the information starts
is_reinjecting_fixed_route

True if re-injection of fixed-route packets is enabled

is_reinjecting_multicast

True if re-injection of multicast packets is enabled

is_reinjecting_nearest_neighbour

True if re-injection of nearest neighbour packets is enabled

is_reinjecting_point_to_point

True if re-injection of point-to-point packets is enabled

n_dropped_packet_overflows

Of the n_dropped_packets received, how many were lost due to not having enough space in the queue of packets to reinject

n_dropped_packets

The number of packets dropped by the router and received by the re injection functionality (may not fit in the queue though)

The number of times that when a dropped packet was caused due to a link failing to take the packet.

Returns:int
n_missed_dropped_packets

The number of times that when a dropped packet was read it was found that another one or more packets had also been dropped, but had been missed

n_processor_dumps

The number of times that when a dropped packet was caused due to a processor failing to take the packet.

Returns:int
n_reinjected_packets

Of the n_dropped_packets received, how many packets were successfully re injected

router_emergency_timeout

The WAIT2 timeout value of the router in cycles

router_emergency_timeout_parameters

The WAIT2 timeout value of the router as mantissa and exponent

router_timeout

The WAIT1 timeout value of the router in cycles

router_timeout_parameters

The WAIT1 timeout value of the router as mantissa and exponent

class spinn_front_end_common.utilities.utility_objs.ExecutableTargets[source]

Bases: spinnman.model.executable_targets.ExecutableTargets

add_processor(binary, chip_x, chip_y, chip_p, executable_type=None)[source]

Add a processor to the executable targets

Parameters:
  • binary – the binary path for executable
  • chip_x – the coordinate on the machine in terms of x for the chip
  • chip_y – the coordinate on the machine in terms of y for the chip
  • chip_p – the processor ID to place this executable on
Returns:

add_subsets(binary, subsets, executable_type=None)[source]

Add core subsets to a binary

Parameters:
  • binary – the path to the binary needed to be executed
  • subsets – the subset of cores that the binary needs to be loaded on
Returns:

executable_types_in_binary_set()[source]

get the executable types in the set of binaries

Returns:iterable of the executable types in this binary set.
get_binaries_of_executable_type(executable_type)[source]

get the binaries of a given a executable type

Parameters:execute_type – the executable type enum value
Returns:iterable of binaries with that executable type
get_n_cores_for_executable_type(executable_type)[source]

returns the number of cores that the executable type is using

Parameters:executable_type – the executable type for locating n cores of
Returns:the number of cores using this executable type
Submodules
spinn_front_end_common.utilities.constants module
class spinn_front_end_common.utilities.constants.BUFFERING_OPERATIONS[source]

Bases: enum.Enum

A listing of what SpiNNaker specific EIEIO commands there are.

BUFFER_READ = 0
BUFFER_WRITE = 1
class spinn_front_end_common.utilities.constants.SDP_PORTS[source]

Bases: enum.Enum

SDP port handling output buffering data streaming

EXTRA_MONITOR_CORE_DATA_IN_SPEED_UP = 6
EXTRA_MONITOR_CORE_DATA_SPEED_UP = 5
EXTRA_MONITOR_CORE_REINJECTION = 4
INPUT_BUFFERING_SDP_PORT = 1
OUTPUT_BUFFERING_SDP_PORT = 2
RUNNING_COMMAND_SDP_PORT = 3
class spinn_front_end_common.utilities.constants.SDP_RUNNING_MESSAGE_CODES[source]

Bases: enum.Enum

SDP_CLEAR_IOBUF_CODE = 9
SDP_NEW_RUNTIME_ID_CODE = 7
SDP_STOP_ID_CODE = 6
SDP_UPDATE_PROVENCE_REGION_AND_EXIT = 8
spinn_front_end_common.utilities.exceptions module
exception spinn_front_end_common.utilities.exceptions.BufferableRegionTooSmall[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when the SDRAM space of the region for buffered packets is too small to contain any packet at all

exception spinn_front_end_common.utilities.exceptions.BufferedRegionNotPresent[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when trying to issue buffered packets for a region not managed

exception spinn_front_end_common.utilities.exceptions.ConfigurationException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when the front end determines a input parameter is invalid

exception spinn_front_end_common.utilities.exceptions.ExecutableFailedToStartException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when an executable has not entered the expected state during start up

exception spinn_front_end_common.utilities.exceptions.ExecutableFailedToStopException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when an executable has not entered the expected state during execution

exception spinn_front_end_common.utilities.exceptions.ExecutableNotFoundException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when a specified executable could not be found

exception spinn_front_end_common.utilities.exceptions.RallocException[source]

Bases: spinn_front_end_common.utilities.exceptions.SpinnFrontEndException

Raised when there are not enough routing table entries

exception spinn_front_end_common.utilities.exceptions.SpinnFrontEndException[source]

Bases: exceptions.Exception

Raised when the front end detects an error

spinn_front_end_common.utilities.function_list module
spinn_front_end_common.utilities.function_list.get_front_end_common_pacman_xml_paths()[source]

Get the XML path for the front end common interface functions

Return type:list(str)
spinn_front_end_common.utilities.globals_variables module
spinn_front_end_common.utilities.globals_variables.get_not_running_simulator()[source]

Get the current simulator object and verify that it is not running.

Return type:SimulatorInterface
spinn_front_end_common.utilities.globals_variables.get_simulator()[source]

Get the current simulator object.

Return type:SimulatorInterface
spinn_front_end_common.utilities.globals_variables.has_simulator()[source]

Check if a simulator is operational.

Return type:bool
spinn_front_end_common.utilities.globals_variables.set_failed_state(new_failed_state)[source]

Install a marker to say that the simulator has failed.

Parameters:new_failed_state (FailedState) – the failure marker
spinn_front_end_common.utilities.globals_variables.set_simulator(new_simulator)[source]

Set the current simulator object.

Parameters:new_simulator (SimulatorInterface) – The simulator to set.
spinn_front_end_common.utilities.globals_variables.unset_simulator()[source]

Destroy the current simulator.

spinn_front_end_common.utilities.helpful_functions module
spinn_front_end_common.utilities.helpful_functions.convert_string_into_chip_and_core_subset(cores)[source]

Translate a string list of cores into a core subset

Parameters:cores (str or None) – string representing down cores formatted as x,y,p[:x,y,p]*
Return type:CoreSubsets
spinn_front_end_common.utilities.helpful_functions.convert_time_diff_to_total_milliseconds(sample)[source]

Convert between a time diff and total milliseconds.

Returns:total milliseconds
Return type:float
spinn_front_end_common.utilities.helpful_functions.convert_vertices_to_core_subset(vertices, placements)[source]

Converts vertices into core subsets.

Parameters:
  • vertices – the vertices to convert to core subsets
  • placements (Placements) – the placements object
Returns:

the CoreSubSets of the vertices

Return type:

CoreSubsets

spinn_front_end_common.utilities.helpful_functions.determine_flow_states(executable_types, no_sync_changes)[source]

Get the start and end states for these executable types.

Parameters:
  • executable_types (dict(ExecutableType,any)) – the execute types to locate start and end states from
  • no_sync_changes (int) – the number of times sync signals been sent
Returns:

dict of executable type to states.

Return type:

tuple(dict(ExecutableType,CPUState), dict(ExecutableType,CPUState))

spinn_front_end_common.utilities.helpful_functions.emergency_recover_state_from_failure(txrx, app_id, vertex, placement)[source]

Used to get at least some information out of a core when something goes badly wrong. Not a replacement for what abstract spinnaker base does.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • app_id (int) – The ID of the application.
  • vertex (AbstractHasAssociatedBinary) – The vertex to retrieve the IOBUF from if it is suspected as being dead
  • placement – Where the vertex is located.
spinn_front_end_common.utilities.helpful_functions.emergency_recover_states_from_failure(txrx, app_id, executable_targets)[source]

Used to get at least some information out of a core when something goes badly wrong. Not a replacement for what abstract spinnaker base does.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • app_id (int) – The ID of the application.
  • executable_targets (ExecutableTargets) – The what/where mapping
spinn_front_end_common.utilities.helpful_functions.find_executable_start_type(machine_vertex, graph_mapper=None)[source]
spinn_front_end_common.utilities.helpful_functions.flood_fill_binary_to_spinnaker(executable_targets, binary, txrx, app_id)[source]

flood fills a binary to spinnaker on a given app_id given the executable targets and binary.

Parameters:
  • executable_targets (ExecutableTargets) – the executable targets object
  • binary (str) – the (name of the) binary to flood fill
  • txrx (Transceiver) – spinnman instance
  • app_id (int) – the app id to load it on
Returns:

the number of cores it was loaded onto

Return type:

int

spinn_front_end_common.utilities.helpful_functions.generate_unique_folder_name(folder, filename, extension)[source]

Generate a unique file name with a given extension in a given folder

Parameters:
  • folder (str) – where to put this unique file
  • filename (str) – the name of the first part of the file without extension
  • extension (str) – extension of the file
Returns:

file path with a unique addition

Return type:

str

spinn_front_end_common.utilities.helpful_functions.get_ethernet_chip(machine, board_address)[source]

Locate the chip with the given board IP address

Parameters:
  • machine (Machine) – the SpiNNaker machine
  • board_address (str) – the board address to locate the chip of.
Returns:

The chip that supports that board address

Return type:

Chip

Raises:

ConfigurationException – when that board address has no chip associated with it

spinn_front_end_common.utilities.helpful_functions.locate_extra_monitor_mc_receiver(machine, placement_x, placement_y, packet_gather_cores_to_ethernet_connection_map)[source]
Parameters:
  • machine (Machine) – The machine descriptor
  • placement_x (int) – The X coordinate of the reference chip
  • placement_y (int) – The Y coordinate of the reference chip
  • packet_gather_cores_to_ethernet_connection_map
Type:

dict(tuple(int,int),?)

Return type:

?

spinn_front_end_common.utilities.helpful_functions.locate_memory_region_for_placement(placement, region, transceiver)[source]

Get the address of a region for a placement

Parameters:
  • region (int) – the region to locate the base address of
  • placement (Placement) – the placement object to get the region address of
  • transceiver (Transceiver) – the python interface to the SpiNNaker machine
spinn_front_end_common.utilities.helpful_functions.read_config(config, section, item)[source]

Get the string value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

str or None

spinn_front_end_common.utilities.helpful_functions.read_config_boolean(config, section, item)[source]

Get the boolean value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

bool or None

spinn_front_end_common.utilities.helpful_functions.read_config_int(config, section, item)[source]

Get the integer value of a config item, returning None if the value is “None”

Parameters:
  • config – The configuration to look things up in.
  • section (str) – The section name
  • item (str) – The item name.
Return type:

int or None

spinn_front_end_common.utilities.helpful_functions.read_data(x, y, address, length, data_format, transceiver)[source]

Reads and converts a single data item from memory

Parameters:
  • x (int) – chip x
  • y (int) – chip y
  • address (int) – base address of the SDRAM chip to read
  • length (int) – length to read
  • data_format (str) – the format to read memory (see struct.pack)
  • transceiver (Transceiver) – the SpinnMan interface
spinn_front_end_common.utilities.helpful_functions.write_address_to_user0(txrx, x, y, p, address)[source]

Writes the given address into the user_0 register of the given core.

Parameters:
  • txrx (Transceiver) – The transceiver.
  • x (int) – Chip coordinate.
  • y (int) – Chip coordinate.
  • p (int) – Core ID on chip.
  • address (int) – Value to write (32-bit integer)
Module contents
class spinn_front_end_common.utilities.FailedState[source]

Bases: spinn_front_end_common.utilities.simulator_interface.SimulatorInterface

Marks that the simulator has failed (and replaces said simulator).

Warning

Any method invoked on this object may fail with ConfigurationException.

add_socket_address(socket_address)[source]

Add the address of a socket used in the run notification protocol.

Parameters:socket_address (SocketAddress) – The address of the socket
Return type:None
buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
machine

The python machine description object.

Return type:Machine
machine_time_step
no_machine_time_steps

The number of machine time steps.

Return type:int
placements

Where machine vertices are placed on the machine.

Return type:Placements
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:run_time – the run duration in milliseconds.
stop()[source]

End running of the simulation.

tags
time_scale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
use_virtual_board
verify_not_running()[source]

Verify that the simulator is in a state where it can start running.

class spinn_front_end_common.utilities.SimulatorInterface[source]

Bases: object

add_socket_address(socket_address)[source]

Add the address of a socket used in the run notification protocol.

Parameters:socket_address (SocketAddress) – The address of the socket
Return type:None
buffer_manager

The buffer manager being used for loading/extracting buffers

config

Provides access to the configuration for front end interfaces.

graph_mapper
has_ran

Whether the simulation has executed anything at all.

Return type:bool
machine

The python machine description object.

Return type:Machine
machine_time_step
no_machine_time_steps

The number of machine time steps.

Return type:int
placements

Where machine vertices are placed on the machine.

Return type:Placements
run(run_time)[source]

Run a simulation for a fixed amount of time

Parameters:run_time – the run duration in milliseconds.
stop()[source]

End running of the simulation.

tags
time_scale_factor
transceiver

How to talk to the machine.

Return type:Transceiver
use_virtual_board
verify_not_running()[source]

Verify that the simulator is in a state where it can start running.

spinn_front_end_common.utility_models package
Module contents
class spinn_front_end_common.utility_models.CommandSender(label, constraints)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints

A utility for sending commands to a vertex (possibly an external device) at fixed times in the simulation

Parameters:
  • label (str) – The label of this vertex
  • constraints (iterable(AbstractConstraint)) – Any initial constraints to this vertex
add_commands(start_resume_commands, pause_stop_commands, timed_commands, vertex_to_send_to)[source]

Add commands to be sent down a given edge

Parameters:
  • start_resume_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – The commands to send when the simulation starts or resumes from pause
  • pause_stop_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – the commands to send when the simulation stops or pauses after running
  • timed_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – The commands to send at specific times
  • vertex_to_send_to (AbstractVertex) – The vertex these commands are to be sent to
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
edges_and_partitions()[source]
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
class spinn_front_end_common.utility_models.CommandSenderMachineVertex(label, constraints)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.interface.provenance.provides_provenance_data_from_machine_impl.ProvidesProvenanceDataFromMachineImpl, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints

Parameters:
  • label (str) – The label of this vertex
  • constraints (iterable(AbstractConstraint)) – Any initial constraints to this vertex
BINARY_FILE_NAME = 'command_sender_multicast_source.aplx'
class DATA_REGIONS[source]

Bases: enum.Enum

COMMANDS_AT_START_RESUME = 2
COMMANDS_AT_STOP_PAUSE = 3
COMMANDS_WITH_ARBITRARY_TIMES = 1
PROVENANCE_REGION = 4
SYSTEM_REGION = 0
add_commands(start_resume_commands, pause_stop_commands, timed_commands, vertex_to_send_to)[source]

Add commands to be sent down a given edge

Parameters:
  • start_resume_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – The commands to send when the simulation starts or resumes from pause
  • pause_stop_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – the commands to send when the simulation stops or pauses after running
  • timed_commands (iterable(spinn_front_end_common.utility_models.multi_cast_command.MultiCastCommand)) – The commands to send at specific times
  • vertex_to_send_to (AbstractVertex) – The vertex these commands are to be sent to
edges_and_partitions()[source]
generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_edges_and_partitions(pre_vertex, edge_type)[source]
static get_n_command_bytes(commands)[source]
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_timed_commands_bytes()[source]
resources_required

The resources required by the vertex

Return type:ResourceContainer
class spinn_front_end_common.utility_models.ChipPowerMonitor(label, constraints, n_samples_per_recording, sampling_frequency)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification

Represents idle time recording code in a application graph.

Parameters:
  • label (str) – vertex label
  • constraints (iterable(AbstractConstraint)) – constraints for the vertex
  • n_samples_per_recording (int) – how many samples to take before recording to SDRAM the total
  • sampling_frequency (int) – how many microseconds between sampling
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_resources_used_by_atoms(*args, **kwargs)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
class spinn_front_end_common.utility_models.ChipPowerMonitorMachineVertex(*args, **kwargs)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.interface.buffer_management.buffer_models.abstract_receive_buffers_to_host.AbstractReceiveBuffersToHost

Machine vertex for C code representing functionality to record idle times in a machine graph.

Parameters:
  • label (str) – vertex label
  • constraints (iterable(AbstractConstraint)) – constraints on this vertex
  • n_samples_per_recording (int) – how may samples between recording entry
  • sampling_frequency (int) – how often to sample, in microseconds
static binary_file_name()[source]

Return the string binary file name

Return type:str
static binary_start_type()[source]

The type of binary that implements this vertex

Returns:starttype enum
Return type:ExecutableType
generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_recorded_data(placement, buffer_manager)[source]

Get data from SDRAM given placement and buffer manager

Parameters:
  • placement (Placement) – the location on machine to get data from
  • buffer_manager (BufferManager) – the buffer manager that might have data
Returns:

results, an array with 1 dimension of uint32 values

Return type:

numpy.ndarray

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering

Returns:The region numbers that have active recording
Return type:iterable(int)
get_recording_region_base_address(txrx, placement)[source]

Get the recording region base address

Parameters:
  • txrx (Transceiver) – the SpiNNMan instance
  • placement (Placement) – the placement object of the core to find the address of
Returns:

the base address of the recording region

Return type:

int

static get_resources(time_step, time_scale_factor, n_samples_per_recording, sampling_frequency)[source]

Get the resources used by this vertex

Return type:ResourceContainer
n_samples_per_recording
resources_required

The resources required by the vertex

Return type:ResourceContainer
sampling_frequency
class spinn_front_end_common.utility_models.DataSpeedUpPacketGather(x, y, ip_address, extra_monitors_by_chip, report_default_directory, write_data_speed_up_reports, constraints=None)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary

The gatherer for the data speed up protocols. Gatherers are only ever deployed on chips with an ethernet connection.

Parameters:
  • x (int) – Where this gatherer is.
  • y (int) – Where this gatherer is.
  • extra_monitors_by_chip (dict(tuple(int,int), ExtraMonitorSupportMachineVertex)) – UNUSED
  • ip_address (str) – How to talk directly to the chip where the gatherer is.
  • report_default_directory (str) – Where reporting is done.
  • write_data_speed_up_reports (bool) – Whether to write low-level reports on data transfer speeds.
  • constraints (iterable(AbstractConstraint)) –
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
machine_vertex
n_atoms

The number of atoms in the vertex

Return type:int
class spinn_front_end_common.utility_models.DataSpeedUpPacketGatherMachineVertex(x, y, extra_monitors_by_chip, ip_address, report_default_directory, write_data_speed_up_reports, constraints=None)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.interface.provenance.abstract_provides_local_provenance_data.AbstractProvidesLocalProvenanceData

Parameters:
  • x (int) – Where this gatherer is.
  • y (int) – Where this gatherer is.
  • extra_monitors_by_chip (dict(tuple(int,int), ExtraMonitorSupportMachineVertex)) – UNUSED
  • ip_address (str) – How to talk directly to the chip where the gatherer is.
  • report_default_directory (str) – Where reporting is done.
  • write_data_speed_up_reports (bool) – Whether to write low-level reports on data transfer speeds.
  • constraints (iterable(AbstractConstraint)) –
BASE_KEY = 4294967289

base key (really nasty hack to tie in fixed route keys)

BASE_MASK = 4294967291

to use with multicast stuff

END_FLAG_KEY = 4294967286
END_FLAG_KEY_OFFSET = 3
FIRST_DATA_KEY = 4294967287
FIRST_DATA_KEY_OFFSET = 2
IN_REPORT_NAME = 'speeds_gained_in_speed_up_process.rpt'

report name for tracking performance gains

NEW_SEQ_KEY = 4294967288
NEW_SEQ_KEY_OFFSET = 1
OUT_REPORT_NAME = 'routers_used_in_speed_up_process.rpt'

report name for tracking used routers

TRAFFIC_TYPE = 2
calculate_max_seq_num()[source]

Deduce the max sequence number expected to be received

Returns:the biggest sequence num expected
Return type:int
generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
  • spec (DataSpecificationGenerator) – The data specification to write to
  • placement (Placement) – the placement the vertex is located at
  • machine_graph (MachineGraph) – (injected)
  • routing_info (RoutingInfo) – (injected)
  • tags (Tags) – (injected)
  • machine_time_step (int) – (injected)
  • time_scale_factor (int) – (injected)
  • mc_data_chips_to_keys (dict(tuple(int,int), int)) – (injected)
  • machine (Machine) – (injected)
  • app_id (int) – (injected)
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_data(placement, memory_address, length_in_bytes, fixed_routes)[source]

Gets data from a given core and memory address.

Parameters:
  • placement (Placement) – placement object for where to get data from
  • memory_address (int) – the address in SDRAM to start reading from
  • length_in_bytes (int) – the length of data to read in bytes
  • fixed_routes (dict(tuple(int,int),FixedRouteEntry)) – the fixed routes, used in the report of which chips were used by the speed up process
Returns:

byte array of the data

Return type:

bytearray

get_local_provenance_data()[source]

Get an iterable of provenance data items

Returns:iterable of ProvenanceDataItem
static load_application_routing_tables(transceiver, extra_monitor_cores, placements)[source]

Set all chips to have application table loaded in the router

Parameters:
Return type:

None

static load_system_routing_tables(transceiver, extra_monitor_cores, placements)[source]

Set all chips to have the system table loaded in the router

Parameters:
Return type:

None

static locate_correct_write_data_function_for_chip_location(uses_advanced_monitors, machine, x, y, transceiver, extra_monitor_cores_to_ethernet_connection_map)[source]

supports other components figuring out which gather and function to call for writing data onto spinnaker

Parameters:
  • uses_advanced_monitors (bool) – Whether the system is using advanced monitors
  • machine (Machine) – the SpiNNMachine instance
  • x (int) – the chip x coordinate to write data to
  • y (int) – the chip y coordinate to write data to
  • transceiver (Transceiver) – the SpiNNMan instance
  • extra_monitor_cores_to_ethernet_connection_map (dict(tuple(int,int), DataSpeedUpPacketGatherMachineVertex)) – mapping between cores and connections
Returns:

a write function of either a LPG or the spinnMan

Return type:

callable

resources_required

The resources required by the vertex

Return type:ResourceContainer
send_data_into_spinnaker(x, y, base_address, data, n_bytes=None, offset=0, cpu=0, is_filename=False)[source]

sends a block of data into SpiNNaker to a given chip

Parameters:
  • x (int) – chip x for data
  • y (int) – chip y for data
  • base_address (int) – the address in SDRAM to start writing memory
  • data (bytes or bytearray or memoryview or str) – the data to write (or filename to load data from, if is_filename is True; that’s the only time this is a str)
  • n_bytes (int) – how many bytes to read, or None if not set
  • offset (int) – where in the data to start from
  • is_filename (bool) – whether data is actually a file.
Return type:

None

set_cores_for_data_streaming(transceiver, extra_monitor_cores, placements)[source]

Helper method for setting the router timeouts to a state usable for data streaming

Parameters:
Return type:

None

static static_resources_required()[source]
static streaming(gatherers, transceiver, extra_monitor_cores, placements)[source]

Helper method for setting the router timeouts to a state usable for data streaming via a Python context manager (i.e., using the ‘with’ statement).

Parameters:
Return type:

a context manager

unset_cores_for_data_streaming(transceiver, extra_monitor_cores, placements)[source]

Helper method for setting the router timeouts to a state usable for data streaming

Parameters:
Return type:

None

class spinn_front_end_common.utility_models.ExtraMonitorSupport(constraints)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification

Control over the extra monitors.

Parameters:constraints (iterable(AbstractConstraint)) – The constraints on the vertex
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
class spinn_front_end_common.utility_models.ExtraMonitorSupportMachineVertex(constraints, reinject_multicast=None, reinject_point_to_point=False, reinject_nearest_neighbour=False, reinject_fixed_route=False)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification

Machine vertex for talking to extra monitor cores. Supports reinjection control and the faster data transfer protocols.

Parameters:
  • constraints (iterable(AbstractConstraint)) – constraints on this vertex
  • reinject_multicast (bool) – if we reinject multicast packets; defaults to value of enable_reinjection setting in configuration file
  • reinject_point_to_point (bool) – if we reinject point-to-point packets
  • reinject_nearest_neighbour (bool) – if we reinject nearest-neighbour packets
  • reinject_fixed_route (bool) – if we reinject fixed route packets
clear_reinjection_queue(transceiver, placements, extra_monitor_cores_to_set)[source]

Clears the queues for reinjection

Parameters:
generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_reinjection_status(placements, transceiver)[source]

Get the reinjection status from this extra monitor vertex

Parameters:
Returns:

the reinjection status for this vertex

Return type:

ReInjectionStatus

get_reinjection_status_for_vertices(placements, extra_monitor_cores_for_data, transceiver)[source]

Get the reinjection status from a set of extra monitor cores

Parameters:
Return type:

dict(tuple(int,int), ReInjectionStatus)

load_application_mc_routes(placements, extra_monitor_cores_for_data, transceiver)[source]

Get the extra monitor cores to load up the application-based multicast routes (used by data in).

Parameters:
Return type:

None

load_system_mc_routes(placements, extra_monitor_cores_for_data, transceiver)[source]

Get the extra monitor cores to load up the system-based multicast routes (used by data in).

Parameters:
Return type:

None

placement
Return type:Placement
reinject_fixed_route
Return type:bool
reinject_multicast
Return type:bool
reinject_nearest_neighbour
Return type:bool
reinject_point_to_point
Return type:bool
reset_reinjection_counters(transceiver, placements, extra_monitor_cores_to_set)[source]

Resets the counters for reinjection

Parameters:
resources_required

The resources required by the vertex

Return type:ResourceContainer
set_reinjection_packets(placements, extra_monitor_cores_for_data, transceiver, point_to_point=None, multicast=None, nearest_neighbour=None, fixed_route=None)[source]
Parameters:
  • placements (Placements) – placements object
  • extra_monitor_cores_for_data (iterable(ExtraMonitorSupportMachineVertex)) – the extra monitor cores to set the packets of
  • transceiver (Transceiver) – spinnman instance
  • point_to_point (bool or None) – If point to point should be set, or None if left as before
  • multicast (bool or None) – If multicast should be set, or None if left as before
  • nearest_neighbour (bool or None) – If nearest neighbour should be set, or None if left as before
  • fixed_route (bool or None) – If fixed route should be set, or None if left as before.
Return type:

None

set_router_emergency_timeout(timeout, transceiver, placements, extra_monitor_cores_to_set)[source]

Sets the timeout of the routers

Parameters:
  • timeout (tuple(int, int)) – The mantissa and exponent of the timeout value, each between 0 and 15
  • transceiver (Transceiver) – the spinnMan instance
  • placements (Placements) – the placements object
  • extra_monitor_cores_to_set (iterable(ExtraMonitorSupportMachineVertex)) – which monitors control the routers to set the timeout of
set_router_time_outs(timeout, transceiver, placements, extra_monitor_cores_to_set)[source]

Supports setting of the router time outs for a set of chips via their extra monitor cores.

Parameters:
  • timeout (tuple(int, int)) – The mantissa and exponent of the timeout value, each between 0 and 15
  • transceiver (Transceiver) – the spinnman interface
  • placements (Placements) – placements object
  • extra_monitor_cores_to_set (iterable(ExtraMonitorSupportMachineVertex)) – which monitors control the routers to set the timeout of
Return type:

None

static static_get_binary_file_name()[source]

The name of the binary implementing this vertex.

Return type:str
static static_get_binary_start_type()[source]

The type of the binary implementing this vertex.

Return type:ExecutableType
static static_resources_required()[source]

The resources required by this vertex.

Return type:ResourceContainer
class spinn_front_end_common.utility_models.LivePacketGather(hostname=None, port=None, tag=None, strip_sdp=True, use_prefix=False, key_prefix=None, prefix_type=None, message_type=<EIEIOType.KEY_32_BIT: 2>, right_shift=0, payload_as_time_stamps=True, use_payload_prefix=True, payload_prefix=None, payload_right_shift=0, number_of_packets_sent_per_time_step=0, constraints=None, label=None)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary

A model which stores all the events it receives during a timer tick and then compresses them into Ethernet packets and sends them out of a SpiNNaker machine.

create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
class spinn_front_end_common.utility_models.LivePacketGatherMachineVertex(label, use_prefix=False, key_prefix=None, prefix_type=None, message_type=<EIEIOType.KEY_32_BIT: 2>, right_shift=0, payload_as_time_stamps=True, use_payload_prefix=True, payload_prefix=None, payload_right_shift=0, number_of_packets_sent_per_time_step=0, hostname=None, port=None, strip_sdp=None, tag=None, constraints=None)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.interface.provenance.provides_provenance_data_from_machine_impl.ProvidesProvenanceDataFromMachineImpl, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_supports_database_injection.AbstractSupportsDatabaseInjection

TRAFFIC_IDENTIFIER = 'LPG_EVENT_STREAM'

Used to identify tags involved with the live packet gatherer.

generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
static get_cpu_usage()[source]

Get the CPU used by this vertex

Returns:0
Return type:int
static get_dtcm_usage()[source]

Get the DTCM used by this vertex

get_provenance_data_from_machine(transceiver, placement)[source]

Get an iterable of provenance data items

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface object
  • placement (Placement) – the placement of the object
Returns:

the provenance items

Return type:

iterable(ProvenanceDataItem)

static get_sdram_usage()[source]

Get the SDRAM used by this vertex

Return type:int
is_in_injection_mode

Whether this vertex is actually in injection mode.

Return type:bool
resources_required

The resources required by the vertex

Return type:ResourceContainer
class spinn_front_end_common.utility_models.MultiCastCommand(key, payload=None, time=None, repeat=0, delay_between_repeats=0)[source]

Bases: object

A command to be sent to a vertex.

Parameters:
  • key (int) – The key of the command
  • payload (int) – The payload of the command
  • time (int) – The time within the simulation at which to send the command, or None if this is not a timed command
  • repeat (int) – The number of times that the command should be repeated after sending it once. This could be used to ensure that the command is sent despite lost packets. Must be between 0 and 65535
  • delay_between_repeats (int) – The amount of time in microseconds to wait between sending repeats of the same command. Must be between 0 and 65535, and must be 0 if repeat is 0
Raises:

SpynnakerException – If the repeat or delay are out of range

delay_between_repeats
is_payload

Determine if this command has a payload. By default, this returns True if the payload passed in to the constructor is not None, but this can be overridden to indicate that a payload will be generated, despite None being passed to the constructor

Returns:True if there is a payload, False otherwise
Return type:bool
is_timed
key
payload

Get the payload of the command.

Returns:The payload of the command, or None if there is no payload
Return type:int
repeat
time
class spinn_front_end_common.utility_models.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)[source]

Bases: pacman.model.graphs.application.application_vertex.ApplicationVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.abstract_models.impl.provides_key_to_atom_mapping_impl.ProvidesKeyToAtomMappingImpl

A model which will allow events to be injected into a SpiNNaker machine and converted into multicast packets.

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 (numpy.ndarray(numpy.ndarray(numpy.int32)) or list(numpy.ndarray(numpy.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
create_machine_vertex(vertex_slice, resources_required, label=None, constraints=None)[source]

Create a machine vertex from this application vertex

Parameters:
  • vertex_slice (Slice) – The slice of atoms that the machine vertex will cover
  • resources_required (ResourceContainer) – the resources used by the machine vertex
  • label (str or None) – human readable label for the machine vertex
  • constraints (iterable(AbstractConstraint)) – Constraints to be passed on to the machine vertex
enable_recording(new_state=True)[source]
generate_data_specification(spec, placement)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_resources_used_by_atoms(vertex_slice)[source]

Get the separate resource requirements for a range of atoms

Parameters:vertex_slice (Slice) – the low value of atoms to calculate resources from
Returns:a Resource container that contains a CPUCyclesPerTickResource, DTCMResource and SDRAMResource
Return type:ResourceContainer
Raises:None – this method does not raise any known exception
n_atoms

The number of atoms in the vertex

Return type:int
send_buffer_times

When messages will be sent.

class spinn_front_end_common.utility_models.ReverseIPTagMulticastSourceMachineVertex(*args, **kwargs)[source]

Bases: pacman.model.graphs.machine.machine_vertex.MachineVertex, spinn_front_end_common.abstract_models.abstract_generates_data_specification.AbstractGeneratesDataSpecification, spinn_front_end_common.abstract_models.abstract_has_associated_binary.AbstractHasAssociatedBinary, spinn_front_end_common.abstract_models.abstract_supports_database_injection.AbstractSupportsDatabaseInjection, spinn_front_end_common.interface.provenance.provides_provenance_data_from_machine_impl.ProvidesProvenanceDataFromMachineImpl, spinn_front_end_common.abstract_models.abstract_provides_outgoing_partition_constraints.AbstractProvidesOutgoingPartitionConstraints, spinn_front_end_common.interface.buffer_management.buffer_models.sends_buffers_from_host_pre_buffered_impl.SendsBuffersFromHostPreBufferedImpl, spinn_front_end_common.interface.buffer_management.buffer_models.abstract_receive_buffers_to_host.AbstractReceiveBuffersToHost, spinn_front_end_common.abstract_models.abstract_recordable.AbstractRecordable

A model which allows events to be injected into SpiNNaker and converted in to multicast packets

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
  • 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 (numpy.ndarray(numpy.ndarray(numpy.int32)) or list(numpy.ndarray(numpy.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_recording(new_state=True)[source]

Enable recording of the keys sent

generate_data_specification(*args, **kwargs)[source]

Generate a data specification.

Parameters:
Return type:

None

get_binary_file_name()[source]

Get the binary name to be run for this vertex.

Return type:str
get_binary_start_type()[source]

Get the start type of the binary to be run.

Return type:ExecutableType
static get_cpu_usage()[source]
static get_dtcm_usage()[source]
get_outgoing_partition_constraints(partition)[source]

Get constraints to be added to the given edge that comes out of this vertex.

Parameters:partition (AbstractOutgoingEdgePartition) – An edge that comes out of this vertex
Returns:A list of constraints
Return type:list(AbstractConstraint)
get_provenance_data_from_machine(transceiver, placement)[source]

Get an iterable of provenance data items

Parameters:
  • transceiver (Transceiver) – the SpinnMan interface object
  • placement (Placement) – the placement of the object
Returns:

the provenance items

Return type:

iterable(ProvenanceDataItem)

get_recorded_region_ids()[source]

Get the recording region IDs that have been recorded using buffering

Returns:The region numbers that have active recording
Return type:iterable(int)
get_recording_region_base_address(txrx, placement)[source]

Get the recording region base address

Parameters:
  • txrx (Transceiver) – the SpiNNMan instance
  • placement (Placement) – the placement object of the core to find the address of
Returns:

the base address of the recording region

Return type:

int

get_region_buffer_size(region)[source]

Get the size of the buffer to be used in SDRAM on the machine for the region in bytes

Parameters:region (int) – The region to get the buffer size of
Returns:The size of the buffer space in bytes
Return type:int
static get_sdram_usage(send_buffer_times, recording_enabled, machine_time_step, receive_rate, n_keys)[source]
Parameters:
  • send_buffer_times (numpy.ndarray(numpy.ndarray(numpy.int32)) or list(numpy.ndarray(numpy.int32)) or None) – When events will be sent
  • recording_enabled (bool) – Whether recording is done
  • machine_time_step (int) – What the machine timestep is
  • receive_rate (float) – What the expected message receive rate is
  • n_keys (int) – How many keys are being sent
is_in_injection_mode

Whether this vertex is actually in injection mode.

Return type:bool
is_recording()[source]

Deduce if the recorder is actually recording

Return type:bool
mask
resources_required

The resources required by the vertex

Return type:ResourceContainer
send_buffer_times
send_buffers
Return type:dict(int,BufferedSendingRegion)
update_buffer(arg)[source]
Updates the buffers on specification of the first machine timestep.
Note: This is called by injection.
Parameters:
  • first_machine_time_step (int) – The first machine time step in the simulation
  • run_until_timesteps (int) – The last machine time step in the simulation
virtual_key

Module contents

Indices and tables