Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Oct 16, 2023
2 parents 2587e1c + a7cde9c commit 6f4ea54
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spinnman/model/p2p_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ def get_route(self, x: int, y: int) -> P2PTableRoute:
:rtype: P2PTableRoute
"""
return self._routes.get((x, y), P2PTableRoute.NONE)

@property
def n_routes(self):
""" The number of routes in the table
:rtype: int
"""
return len(self._routes)
13 changes: 12 additions & 1 deletion spinnman/processes/get_machine_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from .abstract_multi_connection_process import AbstractMultiConnectionProcess
from .abstract_multi_connection_process_connection_selector import \
ConnectionSelector
from spinn_utilities.progress_bar import ProgressBar

logger = FormatAdapter(logging.getLogger(__name__))

Expand Down Expand Up @@ -69,7 +70,9 @@ class GetMachineProcess(AbstractMultiConnectionProcess):
# Holds a mapping from (x,y) to a mapping of physical to virtual core
"_virtual_to_physical_map",
# Holds a mapping from (x,y) to a mapping of virtual to physical core
"_physical_to_virtual_map")
"_physical_to_virtual_map",
# Progress bar to fill in as details are received
"_progress")

def __init__(self, connection_selector: ConnectionSelector):
"""
Expand Down Expand Up @@ -100,6 +103,8 @@ def _make_chip(self, chip_info: ChipSummaryInfo, machine: Machine) -> Chip:
:return: The created chip
:rtype: ~spinn_machine.Chip
"""
# Keep track of progress
self._progress = None
# Create the down cores set if any
n_cores = \
SpiNNManDataView.get_machine_version().max_cores_per_chip
Expand Down Expand Up @@ -177,6 +182,8 @@ def _receive_chip_info(
"""
chip_info = scp_read_chip_info_response.chip_info
self._chip_info[chip_info.x, chip_info.y] = chip_info
if self._progress is not None:
self._progress.update()

def _receive_p_maps(
self, x: int, y: int, scp_read_response: Response):
Expand Down Expand Up @@ -231,6 +238,9 @@ def get_machine_details(
p2p_table = P2PTable(width, height, self._p2p_column_data)

# Get the chip information for each chip
self._progress = ProgressBar(
p2p_table.n_routes,
f"Reading details from {p2p_table.n_routes} chips")
with suppress(Exception), self._collect_responses():
# Ignore errors, as any error here just means that a chip
# is down that wasn't marked as down
Expand All @@ -239,6 +249,7 @@ def get_machine_details(
self._send_request(
ReadMemory((x, y, 0), P_TO_V_ADDR, P_MAPS_SIZE),
functools.partial(self._receive_p_maps, x, y))
self._progress.end()

# Warn about unexpected missing chips
for (x, y) in p2p_table.iterchips():
Expand Down

0 comments on commit 6f4ea54

Please sign in to comment.