Skip to content

Commit

Permalink
Merge branch 'master' into transciever_minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Oct 10, 2023
2 parents 87dbe62 + 9f90f97 commit a690150
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from spinn_utilities.config_holder import set_config
from spalloc_client.job import JobDestroyedError
from spinn_utilities.ping import Ping
from spinnman.exceptions import SpinnmanIOException
import spinnman.transceiver as transceiver
from spinn_front_end_common.data.fec_data_writer import FecDataWriter
from spinn_front_end_common.interface.config_setup import unittest_setup
Expand Down Expand Up @@ -111,10 +110,6 @@ def testSpin4(self):
if not Ping.host_is_reachable(self.spin4Host):
raise unittest.SkipTest(self.spin4Host + " appears to be down")
trans = transceiver.create_transceiver_from_hostname(self.spin4Host, 5)
try:
trans.ensure_board_is_ready()
except (SpinnmanIOException):
self.skipTest("Skipping as getting Job failed")

machine = trans.get_machine_details()
FecDataWriter.mock().set_machine(machine)
Expand Down Expand Up @@ -156,7 +151,6 @@ def testSpin2(self):
self.skipTest("Skipping as getting Job failed")

trans = transceiver.create_transceiver_from_hostname(hostname, 5)
trans.ensure_board_is_ready()
writer.set_machine(trans.get_machine_details())

m_allocation_controller.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def create_transceiver(self):
hostname=self.__hostname,
bmp_connection_data=None,
version=5, auto_detect_bmp=False)
txrx.ensure_board_is_ready()
txrx.discover_scamp_connections()
return txrx

Expand Down
5 changes: 1 addition & 4 deletions spinn_front_end_common/interface/abstract_spinnaker_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2270,11 +2270,8 @@ def __recover_from_error(self, exception):
if not unsuccessful_cores:
for executable_type, core_subsets in \
self._data_writer.get_executable_types().items():
failed_cores = transceiver.get_cpu_infos(
unsuccessful_cores = transceiver.get_cpu_infos(
core_subsets, executable_type.end_state, False)
for (x, y, p) in failed_cores:
unsuccessful_cores.add_processor(
x, y, p, failed_cores.get_cpu_info(x, y, p))

# Print the details of error cores
logger.error(unsuccessful_cores.get_status_string())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
from time import sleep
from spinn_utilities.progress_bar import ProgressBar
from spinn_utilities.log import FormatAdapter
from spinnman.messages.sdp import SDPFlag, SDPHeader, SDPMessage
from spinnman.model.enums import (
CPUState, SDP_PORTS, SDP_RUNNING_MESSAGE_CODES)
from spinnman.model.enums import CPUState
from spinn_front_end_common.data import FecDataView
from spinn_front_end_common.utilities.exceptions import ConfigurationException

Expand Down Expand Up @@ -98,7 +96,7 @@ def _update_provenance(
self.__all_cores, CPUState.FINISHED, False)

for (x, y, p) in unsuccessful_cores.keys():
self._send_chip_update_provenance_and_exit(x, y, p)
self.__txrx.send_chip_update_provenance_and_exit(x, y, p)

processors_completed = self.__txrx.get_core_state_count(
self.__app_id, CPUState.FINISHED)
Expand All @@ -113,19 +111,3 @@ def _update_provenance(
logger.error("Unable to Finish getting provenance data. "
"Abandoned after too many retries. "
"Board may be left in an unstable state!")

def _send_chip_update_provenance_and_exit(self, x, y, p):
"""
:param int x:
:param int y:
:param int p:
"""
cmd = SDP_RUNNING_MESSAGE_CODES.SDP_UPDATE_PROVENCE_REGION_AND_EXIT
port = SDP_PORTS.RUNNING_COMMAND_SDP_PORT

self.__txrx.send_sdp_message(SDPMessage(
SDPHeader(
flags=SDPFlag.REPLY_NOT_EXPECTED,
destination_port=port.value, destination_cpu=p,
destination_chip_x=x, destination_chip_y=y),
data=_ONE_WORD.pack(cmd.value)))
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,14 @@
import re

from spinn_utilities.log import FormatAdapter
from spinnman.constants import POWER_CYCLE_WAIT_TIME_IN_SECONDS
from spinnman.transceiver import create_transceiver_from_hostname
from spinnman.model import BMPConnectionData
from spinn_front_end_common.data import FecDataView
from spinn_front_end_common.utilities.exceptions import ConfigurationException
import time
import logging

logger = FormatAdapter(logging.getLogger(__name__))

POWER_CYCLE_WARNING = (
"When power-cycling a board, it is recommended that you wait for 30 "
"seconds before attempting a reboot. Therefore, the tools will now "
"wait for 30 seconds. If you wish to avoid this wait, please set "
"reset_machine_on_startup = False in the [Machine] section of the "
"relevant configuration (cfg) file.")

POWER_CYCLE_FAILURE_WARNING = (
"The end user requested the power-cycling of the board. But the "
"tools did not have the required BMP connection to facilitate a "
"power-cycling, and therefore will not do so. please set the "
"bmp_names accordingly in the [Machine] section of the relevant "
"configuration (cfg) file. Or use a machine assess process which "
"provides the BMP data (such as a spalloc system) or finally set "
"reset_machine_on_startup = False in the [Machine] section of the "
"relevant configuration (cfg) file to avoid this warning in future.")


def machine_generator(
bmp_details, board_version, auto_detect_bmp,
Expand Down Expand Up @@ -80,23 +61,14 @@ def machine_generator(
hostname=FecDataView.get_ipaddress(),
bmp_connection_data=_parse_bmp_details(bmp_details),
version=board_version,
auto_detect_bmp=auto_detect_bmp)

if reset_machine_on_start_up:
success = txrx.power_off_machine()
if success:
logger.warning(POWER_CYCLE_WARNING)
time.sleep(POWER_CYCLE_WAIT_TIME_IN_SECONDS)
logger.warning("Power cycle wait complete")
else:
logger.warning(POWER_CYCLE_FAILURE_WARNING)
auto_detect_bmp=auto_detect_bmp,
power_cycle=reset_machine_on_start_up)

# do auto boot if possible
if board_version is None:
raise ConfigurationException(
"Please set a machine version number in the "
"corresponding configuration (cfg) file")
txrx.ensure_board_is_ready()
if scamp_connection_data:
txrx.add_scamp_connections(scamp_connection_data)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def create_transceiver(self):
if not self.__use_proxy:
return super(SpallocJobController, self).create_transceiver()
txrx = self._job.create_transceiver()
txrx.ensure_board_is_ready()
return txrx

@overrides(AbstractMachineAllocationController.open_sdp_connection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def _get_provenance_region_address(self, transceiver, placement):
:rtype: int
"""
# Get the App Data for the core
region_table_address = transceiver.get_cpu_information_from_core(
placement.x, placement.y, placement.p).user[0]
region_table_address = transceiver.get_region_base_address(
placement.x, placement.y, placement.p)

# Get the provenance region base address
prov_region_entry_address = get_region_base_address_offset(
Expand Down
8 changes: 3 additions & 5 deletions spinn_front_end_common/utilities/emergency_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ def _emergency_state_check():
for chip in machine.chips:
for p in chip.processors:
try:
info = txrx.get_cpu_information_from_core(
chip.x, chip.y, p)
if info.state in (
CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG):
infos.add_processor(chip.x, chip.y, p, info)
txrx.add_cpu_information_from_core(
chip.x, chip.y, p,
[CPUState.RUN_TIME_EXCEPTION, CPUState.WATCHDOG])
except Exception:
errors.append((chip.x, chip.y, p))
if len(infos):
Expand Down
4 changes: 2 additions & 2 deletions spinn_front_end_common/utilities/helpful_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def locate_memory_region_for_placement(placement, region):
:rtype: int
"""
transceiver = FecDataView.get_transceiver()
regions_base_address = transceiver.get_cpu_information_from_core(
placement.x, placement.y, placement.p).user[0]
regions_base_address = transceiver.get_region_base_address(
placement.x, placement.y, placement.p)

# Get the position of the region in the pointer table
element_addr = get_region_base_address_offset(regions_base_address, region)
Expand Down

0 comments on commit a690150

Please sign in to comment.