spinn_front_end_common.interface.buffer_management.storage_objects package¶
Module contents¶
- class spinn_front_end_common.interface.buffer_management.storage_objects.BufferDatabase(database_file: str | None = None, *, read_only: bool = False, row_factory: type | None = <class 'sqlite3.Row'>, text_factory: type | None = <class 'memoryview'>)¶
Bases:
BaseDatabaseSpecific implementation of the Database for SQLite 3.
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.
If 2 database objects where opened with the database_file they hold the same data. Unless someone else deletes that file.
Note
Not thread safe on the same database file! Threads can access different DBs just fine.
- Parameters:
database_file – The name of a file that contains (or will contain) an SQLite database holding the data. If omitted the default location will be used.
- clear_recording_region(x: int, y: int, p: int, region: int) bool[source]¶
Clears the data for a single region.
Note
This method loses information!
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – Region containing the data to be cleared
- Returns:
True if any region was changed
- get_core_name(x: int, y: int, p: int) str | None[source]¶
Gets the label (typically vertex label) for this core.
Returns None if the core at x, y, p is not known.
- Parameters:
x – core x
y – core y
p – core p
- Returns:
label for (vertex on) this core or None
- get_download_by_extraction_id(x: int, y: int, p: int, region: int, extraction_id: int) Tuple[memoryview, bool][source]¶
Get the data stored for a given region of a given core.
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – Region containing the data
extraction_id – ID of the extraction top get data for. Negative values will be counted from the end.
- 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.
- get_recording(x: int, y: int, p: int, region: int) Tuple[memoryview, bool][source]¶
Get the data stored for a given region of a given core.
If this is a recoding region the data for all extractions is combined.
For none recording regions only the last data extracted is returned.
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – 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.
- Raises:
LookupErrror – If no data is available nor marked missing.
- get_recording_by_extraction_id(x: int, y: int, p: int, region: int, extraction_id: int) Tuple[memoryview, bool][source]¶
Get the data stored for a given region of a given core.
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – Region containing the data
extraction_id – ID of the extraction top get data for. Negative values will be counted from the end.
- 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.
- start_new_extraction() int[source]¶
Stores the metadata for the extractions about to occur
- Returns:
Id for this extraction
- store_download(x: int, y: int, p: int, region: int, missing: bool, data: bytearray | bytes) None[source]¶
Store some information in the corresponding buffer for a specific chip, core and recording region.
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – Region containing the data to be stored
missing – Whether any data is missing
data –
data to be stored
Note
Must be shorter than 1GB
- store_recording(x: int, y: int, p: int, region: int, missing: bool, data: bytearray | bytes) None[source]¶
Store some information in the corresponding buffer for a specific chip, core and recording region.
- Parameters:
x – x coordinate of the chip
y – y coordinate of the chip
p – Core within the specified chip
region – Region containing the data to be stored
missing – Whether any data is missing
data – data to be stored
Note
Must be shorter than 1GB
- class spinn_front_end_common.interface.buffer_management.storage_objects.BufferedSendingRegion¶
Bases:
objectA set of keys to be sent at given timestamps for a given region of data.
Note
Keys must be added in timestamp order or else an exception will be raised.
- add_key(timestamp: int, key: int) None[source]¶
Add a key to be sent at a given time.
- Parameters:
timestamp – The time at which the key is to be sent
key – The key to send
- add_keys(timestamp: int, keys: Iterable[int]) None[source]¶
Add a set of keys to be sent at the given time.
- Parameters:
timestamp – The time at which the keys are to be sent
keys – The keys to send
- get_n_keys(timestamp: int) int[source]¶
- Returns:
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: int) bool[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
- Returns:
True if there is at least on key still to send for this timestamp.
- property is_next_timestamp: bool¶
Whether the region is empty.
True if the region is empty, false otherwise.
- next_key() int[source]¶
The next key to be sent. Only call if
is_next_key()returns True.- Returns:
The next key
- class spinn_front_end_common.interface.buffer_management.storage_objects.BuffersSentDeque(region: int, sent_stop_message: bool = False, n_sequences_per_tranmission: int = 64)¶
Bases:
objectA tracker of buffers sent / to send for a region
- Parameters:
region – The region being managed
sent_stop_message – True if the stop message has been sent
n_sequences_per_tranmission – The number of sequences allowed in each transmission set
- add_message_to_send(message: AbstractEIEIOMessage) None[source]¶
Add a message to send. The message is converted to a sequenced message.
- Parameters:
message – The message to be added
- property is_full: bool¶
Whether the number of messages sent is at the limit for the sequencing system.
- update_last_received_sequence_number(last_received_sequence_no: int) bool[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 – The new sequence number
- Returns:
True if update went ahead, False if it was ignored