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:
-
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
-
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: - x (int) – x coordinate of the chip
- y (int) – y coordinate of the chip
- p (int) – Core within the specified chip
- packet (
spinnman.messages.eieio.command_messages.SpinnakerRequestReadData
) – SpinnakerRequestReadData packet received
-
store_last_sent_packet_to_core
(x, y, p, packet)[source]¶ Store the last packet sent to the given core.
Parameters: - x (int) – x coordinate of the chip
- y (int) – y coordinate of the chip
- p (int) – Core within the specified chip
- packet (
spinnman.messages.eieio.command_messages.HostDataRead
) – last HostDataRead packet sent
-
-
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
-
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
-
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_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
)
-
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
-
start_address
¶ start buffering area memory address
-
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_state_for_region
(region_id)[source]¶ Parameters: region_id (int) – The region identifier Return type: None or ChannelBufferState
-
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
-