spinn_front_end_common.interface.buffer_management.storage_objects package

Submodules

spinn_front_end_common.interface.buffer_management.storage_objects.buffered_receiving_data module

class spinn_front_end_common.interface.buffer_management.storage_objects.buffered_receiving_data.BufferedReceivingData(store_to_file=False)[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:store_to_file (bool) – A boolean to identify if the data will be stored in memory using a byte array or in a temporary file on the disk
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 – placement x coord
  • y – placement y coord
  • p – placement p coord
  • region_id – 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:

(bytearray, bool)

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

Get the data received during the simulation for a region of a 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:

all the data received during the simulation, and a flag indicating if any data was lost

Return type:

(spinn_front_end_common.interface.buffer_management.buffer_models.AbstractBufferedDataStorage, bool)

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.spinnaker_request_read_data.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.host_data_read.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

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

spinn_front_end_common.interface.buffer_management.storage_objects.buffered_sending_region module

class spinn_front_end_common.interface.buffer_management.storage_objects.buffered_sending_region.BufferedSendingRegion(max_buffer_size)[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 of int) – The keys to send
buffer_size

property method for getting the max size of this buffer

clear()[source]

Clears the buffer

current_timestamp

Get the current timestamp in the iterator

get_n_bytes(n_keys)[source]

Get the number of bytes used by a given number of keys

Parameters:n_keys (int) – The number of keys
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

Returns:True if the region is empty, false otherwise
Return type:bool
max_buffer_size_possible

Get the max possible size of a buffer from this region

max_packets_in_timestamp

The maximum number of packets in any time stamp

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 of int
total_region_size

Get the max size of this region

spinn_front_end_common.interface.buffer_management.storage_objects.buffers_sent_deque module

class spinn_front_end_common.interface.buffer_management.storage_objects.buffers_sent_deque.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 of spinnman.messages.eieio.command_messages.host_send_sequenced_data.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

spinn_front_end_common.interface.buffer_management.storage_objects.channel_buffer_state module

class spinn_front_end_common.interface.buffer_management.storage_objects.channel_buffer_state.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 – start buffering area memory address (32 bits)
  • current_write – address where data was last written (32 bits)
  • current_read – address where data was last read (32 bits)
  • end_address – The address of first byte after the buffer (32 bits)
  • region_id – The id of the region (8 bits)
  • missing_info – True if the region overflowed during the simulation (8 bits)
  • last_buffer_operation – Last operation performed on the buffer - read or write (8 bits)
ChannelBufferStateSize = 24
static create_from_bytearray(data)[source]
current_read
current_write
end_address
is_state_updated
last_buffer_operation
missing_info
region_id
set_update_completed()[source]
static size_of_channel_state()[source]
start_address
update_last_operation(operation)[source]
update_read_pointer(read_ptr)[source]

spinn_front_end_common.interface.buffer_management.storage_objects.end_buffering_state module

class spinn_front_end_common.interface.buffer_management.storage_objects.end_buffering_state.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 – Final sequence number received
  • list_channel_buffer_state – a list of channel state, where each channel is stored in a ChannelBufferState object
buffering_out_fsm_state
channel_buffer_state(i)[source]
get_missing_info_for_region(region_id)[source]
get_state_for_region(region_id)[source]
static size_of_region(n_regions_to_record)[source]

Module contents

class spinn_front_end_common.interface.buffer_management.storage_objects.BufferedReceivingData(store_to_file=False)[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:store_to_file (bool) – A boolean to identify if the data will be stored in memory using a byte array or in a temporary file on the disk
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 – placement x coord
  • y – placement y coord
  • p – placement p coord
  • region_id – 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:

(bytearray, bool)

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

Get the data received during the simulation for a region of a 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:

all the data received during the simulation, and a flag indicating if any data was lost

Return type:

(spinn_front_end_common.interface.buffer_management.buffer_models.AbstractBufferedDataStorage, bool)

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.spinnaker_request_read_data.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.host_data_read.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

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(max_buffer_size)[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 of int) – The keys to send
buffer_size

property method for getting the max size of this buffer

clear()[source]

Clears the buffer

current_timestamp

Get the current timestamp in the iterator

get_n_bytes(n_keys)[source]

Get the number of bytes used by a given number of keys

Parameters:n_keys (int) – The number of keys
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

Returns:True if the region is empty, false otherwise
Return type:bool
max_buffer_size_possible

Get the max possible size of a buffer from this region

max_packets_in_timestamp

The maximum number of packets in any time stamp

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 of int
total_region_size

Get the max size of this region

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 of spinnman.messages.eieio.command_messages.host_send_sequenced_data.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 – start buffering area memory address (32 bits)
  • current_write – address where data was last written (32 bits)
  • current_read – address where data was last read (32 bits)
  • end_address – The address of first byte after the buffer (32 bits)
  • region_id – The id of the region (8 bits)
  • missing_info – True if the region overflowed during the simulation (8 bits)
  • last_buffer_operation – Last operation performed on the buffer - read or write (8 bits)
ChannelBufferStateSize = 24
static create_from_bytearray(data)[source]
current_read
current_write
end_address
is_state_updated
last_buffer_operation
missing_info
region_id
set_update_completed()[source]
static size_of_channel_state()[source]
start_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 – Final sequence number received
  • list_channel_buffer_state – a list of channel state, where each channel is stored in a ChannelBufferState object
buffering_out_fsm_state
channel_buffer_state(i)[source]
get_missing_info_for_region(region_id)[source]
get_state_for_region(region_id)[source]
static size_of_region(n_regions_to_record)[source]