From ac3ab527842d1a50272793e1b657074a3db4676e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 10:40:14 +0100 Subject: [PATCH 01/16] default for cabinet and frame --- spinnman/transceiver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index 394f36877..7b6df616e 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -1139,7 +1139,8 @@ def _power(self, power_command, boards=0, cabinet=0, frame=0): if not self._machine_off: time.sleep(BMP_POST_POWER_ON_SLEEP_TIME) - def read_fpga_register(self, fpga_num, register, cabinet, frame, board): + def read_fpga_register( + self, fpga_num, register, cabinet=0, frame=0, board=0): """ Read a register on a FPGA of a board. The meaning of the register's contents will depend on the FPGA's configuration. From be423677e4ee33839e226f96424f9171f53a87f9 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 11:17:04 +0100 Subject: [PATCH 02/16] no cabinet or frame --- spinnman/transceiver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index 7b6df616e..fec34b01c 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -1161,8 +1161,8 @@ def read_fpga_register( ReadFPGARegister(fpga_num, register, board)) return response.fpga_register # pylint: disable=no-member - def write_fpga_register(self, fpga_num, register, value, cabinet, frame, - board): + def write_fpga_register(self, fpga_num, register, value, + cabinet=0, frame=0, board=0): """ Write a register on a FPGA of a board. The meaning of setting the register's contents will depend on the FPGA's configuration. From a4a38c75bb5dbb8bb88bfb0762cd833e39c8352e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 11:40:40 +0100 Subject: [PATCH 03/16] default params --- spinnman/transceiver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index fec34b01c..b8783e6b0 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -1181,7 +1181,7 @@ def write_fpga_register(self, fpga_num, register, value, process.execute( WriteFPGARegister(fpga_num, register, value, board)) - def read_bmp_version(self, board, cabinet, frame): + def read_bmp_version(self, board, cabinet=0, frame=0): """ Read the BMP version. From d74c763c933c433fc63af5c7fd814c2fc81b30f8 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 11:56:49 +0100 Subject: [PATCH 04/16] no cabinet or frame --- spinnman/board_test_configuration.py | 3 +-- .../udp_packet_connections/bmp_connection.py | 24 +------------------ spinnman/model/bmp_connection_data.py | 6 +---- spinnman/transceiver.py | 10 ++++---- spinnman/utilities/utility_functions.py | 2 +- 5 files changed, 8 insertions(+), 37 deletions(-) diff --git a/spinnman/board_test_configuration.py b/spinnman/board_test_configuration.py index b936c8603..173be15b4 100644 --- a/spinnman/board_test_configuration.py +++ b/spinnman/board_test_configuration.py @@ -57,8 +57,7 @@ def set_up_remote_board(self): if self.bmp_names == "None": self.bmp_names = None else: - self.bmp_names = [BMPConnectionData( - 0, 0, self.bmp_names, [0], None)] + self.bmp_names = [BMPConnectionData(self.bmp_names, [0], None)] self.auto_detect_bmp = \ self._config.getboolean("Machine", "auto_detect_bmp") self.localport = _PORT diff --git a/spinnman/connections/udp_packet_connections/bmp_connection.py b/spinnman/connections/udp_packet_connections/bmp_connection.py index 458327a99..11c728fb1 100644 --- a/spinnman/connections/udp_packet_connections/bmp_connection.py +++ b/spinnman/connections/udp_packet_connections/bmp_connection.py @@ -29,9 +29,7 @@ class BMPConnection(UDPConnection, AbstractSCPConnection): A BMP connection which supports queries to the BMP of a SpiNNaker machine. """ __slots__ = [ - "_boards", - "_cabinet", - "_frame"] + "_boards"] def __init__(self, connection_data): """ @@ -42,28 +40,8 @@ def __init__(self, connection_data): else connection_data.port_num super().__init__( remote_host=connection_data.ip_address, remote_port=port) - self._cabinet = connection_data.cabinet - self._frame = connection_data.frame self._boards = connection_data.boards - @property - def cabinet(self): - """ - The cabinet ID of the BMP. - - :rtype: int - """ - return self._cabinet - - @property - def frame(self): - """ - The frame ID of the BMP. - - :rtype: int - """ - return self._frame - @property def boards(self): """ diff --git a/spinnman/model/bmp_connection_data.py b/spinnman/model/bmp_connection_data.py index 0439fd6ca..e7b1e8658 100644 --- a/spinnman/model/bmp_connection_data.py +++ b/spinnman/model/bmp_connection_data.py @@ -19,15 +19,11 @@ class BMPConnectionData(object): """ __slots__ = [ "_boards", - "_cabinet", - "_frame", "_ip_address", "_port_num"] - def __init__(self, cabinet, frame, ip_address, boards, port_num): + def __init__(self, ip_address, boards, port_num): # pylint: disable=too-many-arguments - self._cabinet = cabinet - self._frame = frame self._ip_address = ip_address self._boards = boards self._port_num = port_num diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index b8783e6b0..f0c109fd0 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -289,7 +289,7 @@ def __identify_connections(self, connections): if isinstance(conn, BMPConnection): # If it is a BMP conn, add it here self._bmp_connections.append(conn) - self._bmp_connection_selectors[conn.cabinet, conn.frame] =\ + self._bmp_connection_selectors[0, 0] =\ FixedConnectionSelector(conn) # Otherwise, check if it can send and receive SCP (talk to SCAMP) elif isinstance(conn, SCAMPConnection): @@ -312,7 +312,7 @@ def __check_bmp_connections(self): try: version_info = self._get_scamp_version( conn.chip_x, conn.chip_y, - self._bmp_connection_selectors[conn.cabinet, conn.frame]) + self._bmp_connection_selectors[0, 0]) fail_version_name = version_info.name != _BMP_NAME fail_version_num = \ version_info.version_number[0] not in _BMP_MAJOR_VERSIONS @@ -1057,8 +1057,7 @@ def _power_on_machine(self): logger.warning("No BMP connections, so can't power on") return False for bmp_connection in self._bmp_connections: - self.power_on(bmp_connection.boards, bmp_connection.cabinet, - bmp_connection.frame) + self.power_on(bmp_connection.boards) return True def power_on(self, boards=0, cabinet=0, frame=0): @@ -1085,8 +1084,7 @@ def power_off_machine(self): return False logger.info("Turning off machine") for bmp_connection in self._bmp_connections: - self.power_off(bmp_connection.boards, bmp_connection.cabinet, - bmp_connection.frame) + self.power_off(bmp_connection.boards) return True def power_off(self, boards=0, cabinet=0, frame=0): diff --git a/spinnman/utilities/utility_functions.py b/spinnman/utilities/utility_functions.py index 31320dcbc..014b670c5 100644 --- a/spinnman/utilities/utility_functions.py +++ b/spinnman/utilities/utility_functions.py @@ -50,7 +50,7 @@ def work_out_bmp_from_machine_details(hostname, number_of_boards): board_range = range(number_of_boards) # Assume a single board with no cabinet or frame specified - return BMPConnectionData(cabinet=0, frame=0, ip_address=bmp_ip_address, + return BMPConnectionData(ip_address=bmp_ip_address, boards=board_range, port_num=SCP_SCAMP_PORT) From 647cc6da9c9ca78f42dd3e33d05cd00c2d576b7c Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 12:34:41 +0100 Subject: [PATCH 05/16] assert (conn.cabinet == conn.frame == 0) --- spinnman/transceiver.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index f0c109fd0..a3e3daa91 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -1105,10 +1105,11 @@ def _bmp_connection(self, cabinet, frame): :param int frame: :rtype: FixedConnectionSelector """ - key = (cabinet, frame) + assert (cabinet==frame==0) + key = (0, 0) if key not in self._bmp_connection_selectors: raise SpinnmanInvalidParameterException( - "cabinet and frame", f"{cabinet} and {frame}", + "cabinet and frame", f"{0} and {0}", "Unknown combination") return self._bmp_connection_selectors[key] From 58b7d171b46d7cda43eb3078865b96a7499ee2fc Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 12:43:14 +0100 Subject: [PATCH 06/16] 1 bmp_selector --- spinnman/extended/extended_transceiver.py | 20 ++----------- spinnman/transceiver.py | 36 ++++++----------------- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/spinnman/extended/extended_transceiver.py b/spinnman/extended/extended_transceiver.py index f2120267f..ba922ac9e 100644 --- a/spinnman/extended/extended_transceiver.py +++ b/spinnman/extended/extended_transceiver.py @@ -450,8 +450,7 @@ def set_led(self, led, action, board, cabinet, frame): """ warn_once(logger, "The set_led method is deprecated and " "untested due to no known use.") - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) process.execute(BMPSetLed(led, action, board)) def read_adc_data(self, board, cabinet, frame): @@ -471,8 +470,7 @@ def read_adc_data(self, board, cabinet, frame): """ warn_once(logger, "The read_adc_data method is deprecated and " "untested due to no known use.") - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) response = process.execute(ReadADC(board)) return response.adc_info # pylint: disable=no-member @@ -798,20 +796,6 @@ def number_of_boards_located(self): # if no BMPs are available, then there's still at least one board return max(1, boards) - @property - def bmp_connection(self): - """ - The BMP connections. - - .. warning:: - This property is currently deprecated and likely to be removed. - - :rtype: dict(tuple(int,int),MostDirectConnectionSelector) - """ - warn_once(logger, "The bmp_connection property is deprecated and " - "likely to be removed.") - return self._bmp_connection_selectors - def get_heap(self, x, y, heap=SystemVariableDefinition.sdram_heap_address): """ Get the contents of the given heap on a given chip. diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index a3e3daa91..3af4a0494 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -174,7 +174,7 @@ class Transceiver(AbstractContextManager): """ __slots__ = [ "_all_connections", - "_bmp_connection_selectors", + "_bmp_selector", "_bmp_connections", "_boot_send_connection", "_chip_execute_lock_condition", @@ -237,7 +237,7 @@ def __init__( self._bmp_connections = list() # build connection selectors for the processes. - self._bmp_connection_selectors = dict() + self._bmp_selector = None self._scamp_connection_selector = \ self.__identify_connections(connections) @@ -289,8 +289,8 @@ def __identify_connections(self, connections): if isinstance(conn, BMPConnection): # If it is a BMP conn, add it here self._bmp_connections.append(conn) - self._bmp_connection_selectors[0, 0] =\ - FixedConnectionSelector(conn) + assert (self._bmp_selector is None) + self._bmp_selector = FixedConnectionSelector(conn) # Otherwise, check if it can send and receive SCP (talk to SCAMP) elif isinstance(conn, SCAMPConnection): self._scamp_connections.append(conn) @@ -311,8 +311,7 @@ def __check_bmp_connections(self): # try to send a BMP sver to check if it responds as expected try: version_info = self._get_scamp_version( - conn.chip_x, conn.chip_y, - self._bmp_connection_selectors[0, 0]) + conn.chip_x, conn.chip_y, self._bmp_selector) fail_version_name = version_info.name != _BMP_NAME fail_version_num = \ version_info.version_number[0] not in _BMP_MAJOR_VERSIONS @@ -1099,20 +1098,6 @@ def power_off(self, boards=0, cabinet=0, frame=0): """ self._power(PowerCommand.POWER_OFF, boards, cabinet, frame) - def _bmp_connection(self, cabinet, frame): - """ - :param int cabinet: - :param int frame: - :rtype: FixedConnectionSelector - """ - assert (cabinet==frame==0) - key = (0, 0) - if key not in self._bmp_connection_selectors: - raise SpinnmanInvalidParameterException( - "cabinet and frame", f"{0} and {0}", - "Unknown combination") - return self._bmp_connection_selectors[key] - def _power(self, power_command, boards=0, cabinet=0, frame=0): """ Send a power request to the machine. @@ -1124,7 +1109,7 @@ def _power(self, power_command, boards=0, cabinet=0, frame=0): :param int frame: the ID of the frame in the cabinet containing the board(s), or 0 if the board is not in a frame """ - connection_selector = self._bmp_connection(cabinet, frame) + connection_selector = self._bmp_selector timeout = ( BMP_POWER_ON_TIMEOUT if power_command == PowerCommand.POWER_ON @@ -1154,8 +1139,7 @@ def read_fpga_register( :return: the register data :rtype: int """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame), timeout=1.0) + process = SendSingleCommandProcess(self._bmp_selector, timeout=1.0) response = process.execute( ReadFPGARegister(fpga_num, register, board)) return response.fpga_register # pylint: disable=no-member @@ -1175,8 +1159,7 @@ def write_fpga_register(self, fpga_num, register, value, :param int frame: the frame this is targeting :param int board: which board to write the FPGA register to """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) process.execute( WriteFPGARegister(fpga_num, register, value, board)) @@ -1189,8 +1172,7 @@ def read_bmp_version(self, board, cabinet=0, frame=0): :param int board: which board to request the data from :return: the sver from the BMP """ - process = SendSingleCommandProcess( - self._bmp_connection(cabinet, frame)) + process = SendSingleCommandProcess(self._bmp_selector) response = process.execute(BMPGetVersion(board)) return response.version_info # pylint: disable=no-member From 524467cac5bf70d5afd2897f27cecddaaece029b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 13:00:32 +0100 Subject: [PATCH 07/16] no cabinet or frame --- spinnman/transceiver.py | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index 3af4a0494..16c9e3b39 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -1059,17 +1059,13 @@ def _power_on_machine(self): self.power_on(bmp_connection.boards) return True - def power_on(self, boards=0, cabinet=0, frame=0): + def power_on(self, boards=0): """ Power on a set of boards in the machine. :param int boards: The board or boards to power on - :param int cabinet: the ID of the cabinet containing the frame, or 0 - if the frame is not in a cabinet - :param int frame: the ID of the frame in the cabinet containing the - board(s), or 0 if the board is not in a frame """ - self._power(PowerCommand.POWER_ON, boards, cabinet, frame) + self._power(PowerCommand.POWER_ON, boards) def power_off_machine(self): """ @@ -1086,28 +1082,20 @@ def power_off_machine(self): self.power_off(bmp_connection.boards) return True - def power_off(self, boards=0, cabinet=0, frame=0): + def power_off(self, boards=0): """ Power off a set of boards in the machine. :param int boards: The board or boards to power off - :param int cabinet: the ID of the cabinet containing the frame, or 0 - if the frame is not in a cabinet - :param int frame: the ID of the frame in the cabinet containing the - board(s), or 0 if the board is not in a frame """ - self._power(PowerCommand.POWER_OFF, boards, cabinet, frame) + self._power(PowerCommand.POWER_OFF, boards) - def _power(self, power_command, boards=0, cabinet=0, frame=0): + def _power(self, power_command, boards=0): """ Send a power request to the machine. :param PowerCommand power_command: The power command to send :param boards: The board or boards to send the command to - :param int cabinet: the ID of the cabinet containing the frame, or 0 - if the frame is not in a cabinet - :param int frame: the ID of the frame in the cabinet containing the - board(s), or 0 if the board is not in a frame """ connection_selector = self._bmp_selector timeout = ( @@ -1124,7 +1112,7 @@ def _power(self, power_command, boards=0, cabinet=0, frame=0): time.sleep(BMP_POST_POWER_ON_SLEEP_TIME) def read_fpga_register( - self, fpga_num, register, cabinet=0, frame=0, board=0): + self, fpga_num, register, board=0): """ Read a register on a FPGA of a board. The meaning of the register's contents will depend on the FPGA's configuration. @@ -1133,8 +1121,6 @@ def read_fpga_register( :param int register: Register address to read to (will be rounded down to the nearest 32-bit word boundary). - :param int cabinet: cabinet: the cabinet this is targeting - :param int frame: the frame this is targeting :param int board: which board to request the FPGA register from :return: the register data :rtype: int @@ -1144,8 +1130,7 @@ def read_fpga_register( ReadFPGARegister(fpga_num, register, board)) return response.fpga_register # pylint: disable=no-member - def write_fpga_register(self, fpga_num, register, value, - cabinet=0, frame=0, board=0): + def write_fpga_register(self, fpga_num, register, value, board=0): """ Write a register on a FPGA of a board. The meaning of setting the register's contents will depend on the FPGA's configuration. @@ -1155,20 +1140,16 @@ def write_fpga_register(self, fpga_num, register, value, Register address to read to (will be rounded down to the nearest 32-bit word boundary). :param int value: the value to write into the FPGA register - :param int cabinet: cabinet: the cabinet this is targeting - :param int frame: the frame this is targeting :param int board: which board to write the FPGA register to """ process = SendSingleCommandProcess(self._bmp_selector) process.execute( WriteFPGARegister(fpga_num, register, value, board)) - def read_bmp_version(self, board, cabinet=0, frame=0): + def read_bmp_version(self, board): """ Read the BMP version. - :param int cabinet: cabinet: the cabinet this is targeting - :param int frame: the frame this is targeting :param int board: which board to request the data from :return: the sver from the BMP """ From b375ff7a860e6c35a00439de4ce8c177ec03ef49 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 13:19:54 +0100 Subject: [PATCH 08/16] fix repr --- spinnman/connections/udp_packet_connections/bmp_connection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spinnman/connections/udp_packet_connections/bmp_connection.py b/spinnman/connections/udp_packet_connections/bmp_connection.py index 11c728fb1..43ad50002 100644 --- a/spinnman/connections/udp_packet_connections/bmp_connection.py +++ b/spinnman/connections/udp_packet_connections/bmp_connection.py @@ -84,7 +84,7 @@ def send_scp_request(self, scp_request): def __repr__(self): return ( - f"BMPConnection(cabinet={self._cabinet}, frame={self._frame}, " + f"BMPConnection(" f"boards={self._boards}, local_host={self.local_ip_address}, " f"local_port={self.local_port}, " f"remote_host={self.remote_ip_address}, " From 0354ea4653878b40eaa4fa3243b2541cc0980450 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 13:50:43 +0100 Subject: [PATCH 09/16] no cabinet or frame --- spinnman/extended/extended_transceiver.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/spinnman/extended/extended_transceiver.py b/spinnman/extended/extended_transceiver.py index ba922ac9e..7321699c5 100644 --- a/spinnman/extended/extended_transceiver.py +++ b/spinnman/extended/extended_transceiver.py @@ -427,7 +427,7 @@ def execute_application(self, executable_targets, app_id): # Send a signal telling the application to start self.send_signal(app_id, Signal.START) - def set_led(self, led, action, board, cabinet, frame): + def set_led(self, led, action, board): """ Set the LED state of a board in the machine. @@ -442,18 +442,16 @@ def set_led(self, led, action, board, cabinet, frame): :param LEDAction action: State to set the LED to, either on, off or toggle :param board: Specifies the board to control the LEDs of. This may - also be an iterable of multiple boards (in the same frame). The + also be an iterable of multiple boards. The command will actually be sent to the first board in the iterable. :type board: int or iterable(int) - :param int cabinet: the cabinet this is targeting - :param int frame: the frame this is targeting """ warn_once(logger, "The set_led method is deprecated and " "untested due to no known use.") process = SendSingleCommandProcess(self._bmp_selector) process.execute(BMPSetLed(led, action, board)) - def read_adc_data(self, board, cabinet, frame): + def read_adc_data(self, board): """ Read the BMP ADC data. @@ -462,8 +460,6 @@ def read_adc_data(self, board, cabinet, frame): known use. Same functionality provided by ybug and bmpc. Retained in case needed for hardware debugging. - :param int cabinet: cabinet: the cabinet this is targeting - :param int frame: the frame this is targeting :param int board: which board to request the ADC data from :return: the FPGA's ADC data object :rtype: ADCInfo From 3a67966d1c7ee24455dc151265d6f20a61ff6fde Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 13:59:29 +0100 Subject: [PATCH 10/16] only 1 BMPConnectionData --- spinnman/transceiver.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index 16c9e3b39..b8f486334 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -109,7 +109,7 @@ def create_transceiver_from_hostname( :param int version: the type of SpiNNaker board used within the SpiNNaker machine being used. If a Spinn-5 board, then the version will be 5, Spinn-3 would equal 3 and so on. - :param list(BMPConnectionData) bmp_connection_data: + :param BMPConnectionData bmp_connection_data: the details of the BMP connections used to boot multi-board systems :param bool auto_detect_bmp: ``True`` if the BMP of version 4 or 5 boards should be @@ -141,12 +141,10 @@ def create_transceiver_from_hostname( # handle BMP connections if bmp_connection_data is not None: - bmp_ip_list = list() - for conn_data in bmp_connection_data: - bmp_connection = BMPConnection(conn_data) - connections.append(bmp_connection) - bmp_ip_list.append(bmp_connection.remote_ip_address) - logger.info("Transceiver using BMPs: {}", bmp_ip_list) + bmp_connection = BMPConnection(bmp_connection_data) + connections.append(bmp_connection) + logger.info("Transceiver using BMP: {}", + bmp_connection.remote_ip_address) connections.append(SCAMPConnection(remote_host=hostname)) From 191229f1ded23eee39e3f236241d40ff4d216242 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 14:15:48 +0100 Subject: [PATCH 11/16] no cabinet or frame --- spinnman/model/bmp_connection_data.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/spinnman/model/bmp_connection_data.py b/spinnman/model/bmp_connection_data.py index e7b1e8658..41f6ed6ba 100644 --- a/spinnman/model/bmp_connection_data.py +++ b/spinnman/model/bmp_connection_data.py @@ -28,24 +28,6 @@ def __init__(self, ip_address, boards, port_num): self._boards = boards self._port_num = port_num - @property - def cabinet(self): - """ - The cabinet number. - - :rtype: int - """ - return self._cabinet - - @property - def frame(self): - """ - The frame number. - - :rtype: int - """ - return self._frame - @property def ip_address(self): """ From 5cf774c8b7c4ca044b90b5d48d19243566ef2412 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 14:27:25 +0100 Subject: [PATCH 12/16] 1 _bmp_connection and not a list --- spinnman/transceiver.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/spinnman/transceiver.py b/spinnman/transceiver.py index b8f486334..5f58a9b7c 100644 --- a/spinnman/transceiver.py +++ b/spinnman/transceiver.py @@ -173,7 +173,7 @@ class Transceiver(AbstractContextManager): __slots__ = [ "_all_connections", "_bmp_selector", - "_bmp_connections", + "_bmp_connection", "_boot_send_connection", "_chip_execute_lock_condition", "_chip_execute_locks", @@ -232,7 +232,7 @@ def __init__( self._scamp_connections = list() # The BMP connections - self._bmp_connections = list() + self._bmp_connection = None # build connection selectors for the processes. self._bmp_selector = None @@ -249,7 +249,7 @@ def __init__( self._n_chip_execute_locks = 0 # Check that the BMP connections are valid - self.__check_bmp_connections() + self.__check_bmp_connection() self._machine_off = False @@ -286,8 +286,10 @@ def __identify_connections(self, connections): # Locate any connections that talk to a BMP if isinstance(conn, BMPConnection): # If it is a BMP conn, add it here - self._bmp_connections.append(conn) - assert (self._bmp_selector is None) + if self._bmp_connection is not None: + raise NotImplementedError( + "Only one BMP connection supported") + self._bmp_connection = conn self._bmp_selector = FixedConnectionSelector(conn) # Otherwise, check if it can send and receive SCP (talk to SCAMP) elif isinstance(conn, SCAMPConnection): @@ -296,7 +298,7 @@ def __identify_connections(self, connections): # update the transceiver with the conn selectors. return MostDirectConnectionSelector(self._scamp_connections) - def __check_bmp_connections(self): + def __check_bmp_connection(self): """ Check that the BMP connections are actually connected to valid BMPs. @@ -304,7 +306,8 @@ def __check_bmp_connections(self): """ # check that the UDP BMP conn is actually connected to a BMP # via the sver command - for conn in self._bmp_connections: + if self._bmp_connection is not None: + conn = self._bmp_connection # try to send a BMP sver to check if it responds as expected try: @@ -667,7 +670,7 @@ def ensure_board_is_ready(self, n_retries=5, extra_boot_values=None): INITIAL_FIND_SCAMP_RETRIES_COUNT, extra_boot_values) # If we fail to get a SCAMP version this time, try other things - if version_info is None and self._bmp_connections: + if version_info is None and self._bmp_connection is not None: # start by powering up each BMP connection logger.info("Attempting to power on machine") @@ -1050,11 +1053,10 @@ def _power_on_machine(self): :rtype bool :return success of failure to power on machine """ - if not self._bmp_connections: + if self._bmp_connection is None: logger.warning("No BMP connections, so can't power on") return False - for bmp_connection in self._bmp_connections: - self.power_on(bmp_connection.boards) + self.power_on(self._bmp_connection) return True def power_on(self, boards=0): @@ -1072,12 +1074,11 @@ def power_off_machine(self): :rtype bool :return success or failure to power off the machine """ - if not self._bmp_connections: + if self._bmp_connection is None: logger.warning("No BMP connections, so can't power off") return False logger.info("Turning off machine") - for bmp_connection in self._bmp_connections: - self.power_off(bmp_connection.boards) + self.power_off(self._bmp_connection) return True def power_off(self, boards=0): @@ -1936,7 +1937,7 @@ def close(self): """ Close the transceiver and any threads that are running. """ - if self._bmp_connections: + if self._bmp_connection is not None: if get_config_bool("Machine", "turn_off_machine"): self.power_off_machine() From 194e09d815ee20620bbe6701b9ddb2a901b32351 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 14:39:55 +0100 Subject: [PATCH 13/16] only 1 bmp_connection --- spinnman/extended/extended_transceiver.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spinnman/extended/extended_transceiver.py b/spinnman/extended/extended_transceiver.py index 7321699c5..5ae7038f5 100644 --- a/spinnman/extended/extended_transceiver.py +++ b/spinnman/extended/extended_transceiver.py @@ -785,12 +785,11 @@ def number_of_boards_located(self): """ warn_once(logger, "The number_of_boards_located method is deprecated " "and likely to be removed.") - boards = 0 - for bmp_connection in self._bmp_connections: - boards += len(bmp_connection.boards) - - # if no BMPs are available, then there's still at least one board - return max(1, boards) + if self._bmp_connection is not None: + return max(1, len(self._bmp_connection.boards)) + else: + # if no BMPs are available, then there's still at least one board + return 1 def get_heap(self, x, y, heap=SystemVariableDefinition.sdram_heap_address): """ From 47f2f416d7286e9aea72ff53d9dbdebbf518a478 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 14:56:13 +0100 Subject: [PATCH 14/16] fix str --- spinnman/model/bmp_connection_data.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spinnman/model/bmp_connection_data.py b/spinnman/model/bmp_connection_data.py index 41f6ed6ba..4b2507190 100644 --- a/spinnman/model/bmp_connection_data.py +++ b/spinnman/model/bmp_connection_data.py @@ -56,8 +56,7 @@ def port_num(self): return self._port_num def __str__(self): - return (f"{self._cabinet}:{self._frame}:{self._ip_address}:" - f"{self._boards}:{self._port_num}") + return (f"{self._ip_address}:{self._boards}:{self._port_num}") def __repr__(self): return self.__str__() From efa523fc1afd0ccb820ae6dcdb51a1521d1a3271 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 14:58:08 +0100 Subject: [PATCH 15/16] simplfy cfg bmp_names --- spinnman/spinnman.cfg | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spinnman/spinnman.cfg b/spinnman/spinnman.cfg index 118829780..e97f9352b 100644 --- a/spinnman/spinnman.cfg +++ b/spinnman/spinnman.cfg @@ -13,12 +13,9 @@ report_waiting_logs = False turn_off_machine = False # format is: -# bmp_names = [:]* -# = [[;];][/(|board_id[,board_id]*)] +# bmp_names = [/(|board_id[,board_id]*) # = - # where: -# is the ID of a cabinet -# is the ID of a frame in a cabinet # is the hostname or IP address of the BMP # is a range of boards that the BMP can speak to # is the ID of a single board in a frame From 01ae2e7066dae6f1b5bab54cba28e265226bbe67 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 1 Aug 2023 15:28:34 +0100 Subject: [PATCH 16/16] comment on bmp_names change --- spinnman/spinnman.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/spinnman/spinnman.cfg b/spinnman/spinnman.cfg index e97f9352b..e530f855f 100644 --- a/spinnman/spinnman.cfg +++ b/spinnman/spinnman.cfg @@ -19,6 +19,7 @@ turn_off_machine = False # is the hostname or IP address of the BMP # is a range of boards that the BMP can speak to # is the ID of a single board in a frame +# Note this no longer supports multiple host nor cabinet or frame bmp_names = None auto_detect_bmp = False