Skip to content

Commit fdb809d

Browse files
authored
Merge branch 'master' into docker-compose
2 parents a1b25a9 + bf93119 commit fdb809d

15 files changed

Lines changed: 45 additions & 100 deletions

File tree

spinn_front_end_common/interface/buffer_management/buffer_manager.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import logging
2020
from typing import (
2121
Dict, Iterable, List, Optional, Set, Tuple, cast, TYPE_CHECKING)
22+
from typing_extensions import Never
23+
2224
from spinn_utilities.config_holder import get_config_bool
2325
from spinn_utilities.log import FormatAdapter
2426
from spinn_utilities.ordered_set import OrderedSet
@@ -132,7 +134,7 @@ def __init__(self) -> None:
132134

133135
def _request_data(
134136
self, placement_x: int, placement_y: int, address: int,
135-
length: int) -> bytes:
137+
length: int) -> bytearray:
136138
"""
137139
Uses the extra monitor cores for data extraction.
138140
@@ -176,7 +178,7 @@ def _request_data(
176178
return extra_mon_data
177179

178180
@staticmethod
179-
def _verify_data(extra_mon_data: bytes, txrx_data: bytes) -> None:
181+
def _verify_data(extra_mon_data: bytearray, txrx_data: bytearray) -> None:
180182
sm = difflib.SequenceMatcher(a=extra_mon_data, b=txrx_data)
181183
failed_index = -1
182184
for (tag, i1, i2, j1, j2) in sm.get_opcodes():
@@ -406,8 +408,9 @@ def __python_extract_no_monitors(
406408
for placement in progress.over(recording_placements):
407409
self._retreive_by_placement(placement)
408410

409-
def get_data_by_placement(self, placement: Placement,
410-
recording_region_id: int) -> Tuple[bytes, bool]:
411+
def get_data_by_placement(
412+
self, placement: Placement,
413+
recording_region_id: int) -> Tuple[memoryview, bool]:
411414
"""
412415
Deprecated use get_recording or get_download
413416
@@ -432,7 +435,7 @@ def get_data_by_placement(self, placement: Placement,
432435
f"Unable to get data for vertex {placement.vertex}")
433436

434437
def get_recording(self, placement: Placement,
435-
recording_region_id: int) -> Tuple[bytes, bool]:
438+
recording_region_id: int) -> Tuple[memoryview, bool]:
436439
"""
437440
Get the data container for the data retrieved
438441
during the simulation from a specific region area of a core.
@@ -457,7 +460,7 @@ def get_recording(self, placement: Placement,
457460
placement, recording_region_id, lookup_error)
458461

459462
def get_download(self, placement: Placement,
460-
recording_region_id: int) -> Tuple[bytes, bool]:
463+
recording_region_id: int) -> Tuple[memoryview, bool]:
461464
"""
462465
Get the data container for the data retrieved
463466
during the simulation from a specific region area of a core.
@@ -479,11 +482,11 @@ def get_download(self, placement: Placement,
479482
placement.x, placement.y, placement.p,
480483
recording_region_id, -1)
481484
except LookupError as lookup_error:
482-
return self._raise_error(
485+
self._raise_error(
483486
placement, recording_region_id, lookup_error)
484487

485488
def _raise_error(self, placement: Placement, recording_region_id: int,
486-
lookup_error: LookupError) -> Tuple[bytes, bool]:
489+
lookup_error: LookupError) -> Never:
487490
"""
488491
Raises the correct exception-
489492
"""

spinn_front_end_common/interface/buffer_management/storage_objects/buffer_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def get_last_extraction_id(self) -> int:
338338
raise LookupError("No Extraction id found")
339339

340340
def store_recording(self, x: int, y: int, p: int, region: int,
341-
missing: bool, data: bytes) -> None:
341+
missing: bool, data: bytearray | bytes) -> None:
342342
"""
343343
Store some information in the corresponding buffer for a
344344
specific chip, core and recording region.
@@ -368,7 +368,7 @@ def store_recording(self, x: int, y: int, p: int, region: int,
368368

369369
def store_download(
370370
self, x: int, y: int, p: int, region: int, missing: bool,
371-
data: bytes) -> None:
371+
data: bytearray | bytes) -> None:
372372
"""
373373
Store some information in the corresponding buffer for a
374374
specific chip, core and recording region.

spinn_front_end_common/interface/ds/ds_sqllite_database.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def get_double_region(self) -> Iterable[Tuple[int, int, int, int]]:
287287
yield (row["x"], row["y"], row["p"], row["region_num"])
288288

289289
def set_region_content(
290-
self, x: int, y: int, p: int, region_num: int, content: bytes,
290+
self, x: int, y: int, p: int, region_num: int, content: bytearray,
291291
content_debug: Optional[str]) -> None:
292292
"""
293293
Sets the content for this region
@@ -458,7 +458,7 @@ def set_region_pointer(self, x: int, y: int, p: int, region_num: int,
458458

459459
def get_region_pointers_and_content(
460460
self, x: int, y: int, p: int) -> Iterable[Tuple[
461-
int, int, Optional[bytes]]]:
461+
int, int, Optional[bytearray]]]:
462462
"""
463463
Yields the number, pointers and content for each reserved region
464464
@@ -485,8 +485,8 @@ def get_region_pointers_and_content(
485485
content = None
486486
yield row["region_num"], row["pointer"], content
487487

488-
def get_regions_content(
489-
self, x: int, y: int, p: int) -> Iterable[Tuple[int, int, bytes]]:
488+
def get_regions_content(self, x: int, y: int,
489+
p: int) -> Iterable[Tuple[int, int, bytearray]]:
490490
"""
491491
Yields the number, pointers and content for each region
492492

spinn_front_end_common/interface/interface_functions/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
system_multicast_routing_generator)
2525
from .dsg_region_reloader import reload_dsg_regions
2626
from .energy_provenance_reporter import energy_provenance_reporter
27-
from .find_application_chips_used import FindApplicationChipsUsed
2827
from .graph_binary_gatherer import graph_binary_gatherer
2928
from .graph_data_specification_writer import (
3029
graph_data_specification_writer)
@@ -61,7 +60,6 @@
6160
"reload_dsg_regions",
6261
"energy_provenance_reporter", "load_application_data_specs",
6362
"load_system_data_specs", "load_using_advanced_monitors",
64-
"FindApplicationChipsUsed",
6563
"graph_binary_gatherer", "graph_data_specification_writer",
6664
"hbp_allocator",
6765
"insert_chip_power_monitors_to_graphs",

spinn_front_end_common/interface/interface_functions/find_application_chips_used.py

Lines changed: 0 additions & 66 deletions
This file was deleted.

spinn_front_end_common/interface/interface_functions/host_no_bitfield_router_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,4 @@ def _build_data(self, table: AbstractMulticastRoutingTable) -> bytes:
228228
entry.key, entry.mask,
229229
Router.convert_routing_table_entry_to_spinnaker_route(entry),
230230
get_defaultable_source_id(entry))
231-
return bytearray(data)
231+
return data

spinn_front_end_common/interface/interface_functions/load_data_specification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from spinn_front_end_common.interface.ds import DsSqlliteDatabase
3535

3636
logger = FormatAdapter(logging.getLogger(__name__))
37-
_Writer: TypeAlias = Callable[[int, int, int, bytes], Any]
37+
_Writer: TypeAlias = Callable[[int, int, int, bytearray | bytes], Any]
3838

3939
MONITOR_CUTOFF = 12800 # 50 packets of 256 bytes
4040

spinn_front_end_common/interface/profiling/profile_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, tag_labels: Mapping[int, str]):
5858
self._tags: Dict[str, Tuple[numpy.ndarray, numpy.ndarray]] = dict()
5959
self._max_time: float = 0.0
6060

61-
def add_data(self, data: bytes) -> None:
61+
def add_data(self, data: bytearray) -> None:
6262
"""
6363
Add profiling data read from the profile section.
6464

spinn_front_end_common/interface/spinnaker.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ run_compression_checker = Debug
316316
Mainly used for testing changes to the algorithms or bugs.
317317
path_compression_checker = routing_compression_checker_report.rpt
318318

319-
validate_routes_uncompressed = False
319+
validate_routes_uncompressed = Debug
320320
@validate_routes_uncompressed = Runs a check that the routing tables are correct before compresssion.
321321
Mainly used for testing changes to the algorithms or bugs.
322322

spinn_front_end_common/utilities/database/database_writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __insert(self, sql: str, *args: Union[str, int, None]) -> int:
102102
return self.lastrowid
103103
except Exception:
104104
logger.exception("problem with insertion; argument types are {}",
105-
str(map(type, args)))
105+
str(list(map(type, args))))
106106
raise
107107

108108
def add_machine_objects(self) -> None:

0 commit comments

Comments
 (0)