From a9b3a6274fd09c7cd76e412ca1cf84990cec26e8 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 14:41:21 +0100 Subject: [PATCH] VersionStrings --- .../test_database_interface.py | 4 +-- unittests/data/test_simulator_data.py | 6 ++-- .../test_buffered_database.py | 6 ++-- unittests/interface/ds/test_ds.py | 30 +++++++++---------- ...st_front_end_common_dsg_region_reloader.py | 4 +-- .../test_load_data_specification.py | 12 ++++---- 6 files changed, 30 insertions(+), 32 deletions(-) diff --git a/fec_integration_tests/interface/interface_functions/test_database_interface.py b/fec_integration_tests/interface/interface_functions/test_database_interface.py index 8905e3dc24..34202c2254 100644 --- a/fec_integration_tests/interface/interface_functions/test_database_interface.py +++ b/fec_integration_tests/interface/interface_functions/test_database_interface.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from spinn_machine.tags.iptag import IPTag from pacman.model.graphs.application import ApplicationVertex, ApplicationEdge from pacman.model.graphs.machine import SimpleMachineVertex @@ -116,7 +116,7 @@ def _place_vertices(app_vertexes, placements): def test_database_interface(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) set_config("Database", "create_database", "True") set_config("Database", "create_routing_info_to_neuron_id_mapping", "True") diff --git a/unittests/data/test_simulator_data.py b/unittests/data/test_simulator_data.py index d1de385fe4..a7c719c2b1 100644 --- a/unittests/data/test_simulator_data.py +++ b/unittests/data/test_simulator_data.py @@ -21,7 +21,7 @@ from spinn_utilities.data.utils_data_writer import _UtilsDataModel from spinn_utilities.exceptions import ( DataNotYetAvialable, NotSetupException) -from spinn_machine.version import FOUR_PLUS_CHIPS +from spinn_machine.version.version_strings import VersionStrings from spinnman.messages.scp.enums.signal import Signal from spinn_utilities.socket_address import SocketAddress from spinnman.model import ExecutableTargets @@ -575,7 +575,7 @@ def test_executable_targets(self): def test_gatherer_map(self): writer = FecDataWriter.mock() - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) with self.assertRaises(DataNotYetAvialable): FecDataView.get_gatherer_by_xy(0, 0) with self.assertRaises(DataNotYetAvialable): @@ -624,7 +624,7 @@ def test_gatherer_map(self): def test_monitor_map(self): writer = FecDataWriter.mock() - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) self.assertFalse(FecDataView.has_monitors()) with self.assertRaises(DataNotYetAvialable): FecDataView.get_monitor_by_xy(0, 0) diff --git a/unittests/interface/buffer_management/test_buffered_database.py b/unittests/interface/buffer_management/test_buffered_database.py index 6be9e54cdc..e03279039b 100644 --- a/unittests/interface/buffer_management/test_buffered_database.py +++ b/unittests/interface/buffer_management/test_buffered_database.py @@ -15,7 +15,7 @@ import unittest import os from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION, BIG_MACHINE +from spinn_machine.version.version_strings import VersionStrings from pacman.model.graphs.machine import SimpleMachineVertex from pacman.model.placements import Placement, Placements from spinn_front_end_common.data.fec_data_writer import FecDataWriter @@ -30,7 +30,7 @@ def setUp(self): unittest_setup() def test_use_database(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) f = BufferDatabase.default_database_file() self.assertFalse(os.path.isfile(f), "no existing DB at first") @@ -52,7 +52,7 @@ def test_use_database(self): self.assertTrue(os.path.isfile(f), "DB still exists") def test_placements(self): - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = FecDataWriter.mock() info = Placements([]) p1 = Placement(SimpleMachineVertex(None, label="V1"), 1, 2, 3) diff --git a/unittests/interface/ds/test_ds.py b/unittests/interface/ds/test_ds.py index d8e3470c4d..c1061fd73f 100644 --- a/unittests/interface/ds/test_ds.py +++ b/unittests/interface/ds/test_ds.py @@ -17,8 +17,7 @@ from spinn_utilities.config_holder import set_config from spinn_utilities.overrides import overrides from spinn_machine import Chip, Router -from spinn_machine.version import ( - ANY_VERSION, FOUR_PLUS_CHIPS, MULTIPLE_BOARDS) +from spinn_machine.version.version_strings import VersionStrings from spinn_machine.virtual_machine import virtual_machine_by_min_size from spinnman.model.enums import ExecutableType from pacman.model.graphs.machine import SimpleMachineVertex @@ -54,10 +53,9 @@ class TestDataSpecification(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 201) def test_init(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex1 = _TestVertexWithBinary( "off_board__system", ExecutableType.SYSTEM) with DsSqlliteDatabase() as db: @@ -65,14 +63,14 @@ def test_init(self): DataSpecificationReloader(0, 1, 2, db) def test_none_ds_vertex(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = SimpleMachineVertex(0) with DsSqlliteDatabase() as db: with self.assertRaises(AttributeError): DataSpecificationGenerator(0, 1, 2, vertex, db) def test_bad_x_y_ds_vertex(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = _TestVertexWithBinary( "off_board__system", ExecutableType.SYSTEM) width, height = FecDataView.get_machine_version().board_shape @@ -82,7 +80,7 @@ def test_bad_x_y_ds_vertex(self): DataSpecificationGenerator(width, height, 2, vertex, db) def test_repeat_x_y_ds_vertex(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex1 = _TestVertexWithBinary( "v1", ExecutableType.SYSTEM) vertex2 = _TestVertexWithBinary( @@ -93,7 +91,7 @@ def test_repeat_x_y_ds_vertex(self): DataSpecificationGenerator(0, 1, 2, vertex2, db) def test_core_infos(self): - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = FecDataWriter.mock() writer.set_machine(virtual_machine_by_min_size(9, 9)) with DsSqlliteDatabase() as db: @@ -117,7 +115,7 @@ def test_core_infos(self): self.assertEqual(app_infos, db.get_core_infos(False)) def test_bad_ethernet(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) router = Router([], 123) width, height = FecDataView.get_machine_version().board_shape bad = Chip(width, height, 15, router, 100, 8, 8) @@ -129,7 +127,7 @@ def test_bad_ethernet(self): DataSpecificationGenerator(width, height, 2, vertex, db) def test_reserve_memory_region(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = _TestVertexWithBinary( "binary", ExecutableType.SYSTEM) with DsSqlliteDatabase() as db: @@ -171,11 +169,11 @@ def test_reserve_memory_region(self): self.assertEqual(0, db.get_total_regions_size(0, 1, 3)) def test_switch_write_focus(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.ANY.value) vertex = _TestVertexWithBinary( "binary", ExecutableType.SYSTEM) with DsSqlliteDatabase() as db: - dsg = DataSpecificationGenerator(0, 1, 2, vertex, db) + dsg = DataSpecificationGenerator(0, 0, 2, vertex, db) dsg.reserve_memory_region(10, 123456, "test_region") dsg.switch_write_focus(10) # check internal fields used later are correct @@ -185,7 +183,7 @@ def test_switch_write_focus(self): dsg.switch_write_focus(8) def test_pointers(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) # You can use a reference before defining it vertex = _TestVertexWithBinary( "binary1", ExecutableType.SYSTEM) @@ -251,7 +249,7 @@ def test_pointers(self): db.get_region_pointer(1, 2, 3, 9) def test_write(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = _TestVertexWithBinary( "binary", ExecutableType.SYSTEM) @@ -304,7 +302,7 @@ def test_write(self): 0, 1, 4, 5, bytearray(b'\x0c\x00\x00\x00'), "test") def test_ds_cores(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = _TestVertexWithBinary( "binary", ExecutableType.SYSTEM) with DsSqlliteDatabase() as db: @@ -322,7 +320,7 @@ def test_ds_cores(self): self.assertIn((1, 0, 3), cores) def test_memory_to_write(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) vertex = _TestVertexWithBinary( "binary", ExecutableType.SYSTEM) with DsSqlliteDatabase() as db: diff --git a/unittests/interface/interface_functions/test_front_end_common_dsg_region_reloader.py b/unittests/interface/interface_functions/test_front_end_common_dsg_region_reloader.py index 6bd6916ce1..df781a8797 100644 --- a/unittests/interface/interface_functions/test_front_end_common_dsg_region_reloader.py +++ b/unittests/interface/interface_functions/test_front_end_common_dsg_region_reloader.py @@ -17,7 +17,7 @@ from typing import BinaryIO, Optional, Sequence, Tuple, Union from spinn_utilities.config_holder import set_config from spinn_utilities.overrides import overrides -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from spinnman.model.enums import ExecutableType from pacman.model.placements import Placements, Placement from spinn_front_end_common.abstract_models import ( @@ -130,7 +130,7 @@ class TestFrontEndCommonDSGRegionReloader(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) def test_with_good_sizes(self): """ Test that an application vertex's data is rewritten correctly diff --git a/unittests/interface/interface_functions/test_load_data_specification.py b/unittests/interface/interface_functions/test_load_data_specification.py index 0793e1e273..22dd96cf16 100644 --- a/unittests/interface/interface_functions/test_load_data_specification.py +++ b/unittests/interface/interface_functions/test_load_data_specification.py @@ -18,7 +18,7 @@ import unittest from spinn_utilities.config_holder import set_config from spinn_utilities.overrides import overrides -from spinn_machine.version import ANY_VERSION, FOUR_PLUS_CHIPS +from spinn_machine.version.version_strings import VersionStrings from spinnman.transceiver.version5transceiver import Version5Transceiver from spinnman.model.enums import ExecutableType from pacman.model.graphs.machine import SimpleMachineVertex @@ -96,7 +96,7 @@ def setUp(self): set_config("Machine", "enable_advanced_monitor_support", "False") def test_call(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = FecDataWriter.mock() transceiver = _MockTransceiver() writer.set_transceiver(transceiver) @@ -163,7 +163,7 @@ def test_call(self): header_and_table_size + 16) def test_multi_spec_with_references(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = FecDataWriter.mock() transceiver = _MockTransceiver() writer.set_transceiver(transceiver) @@ -237,7 +237,7 @@ def test_multi_spec_with_references(self): self.assertEqual(header_data[2][2 * 3], header_data[1][2 * 3]) def test_multispec_with_reference_error(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = FecDataWriter.mock() transceiver = _MockTransceiver() writer.set_transceiver(transceiver) @@ -265,7 +265,7 @@ def test_multispec_with_reference_error(self): load_application_data_specs() def test_multispec_with_double_reference(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = FecDataWriter.mock() transceiver = _MockTransceiver() writer.set_transceiver(transceiver) @@ -279,7 +279,7 @@ def test_multispec_with_double_reference(self): spec.reserve_memory_region(1, 12, reference=1) def test_multispec_with_wrong_chip_reference(self): - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) writer = FecDataWriter.mock() transceiver = _MockTransceiver() writer.set_transceiver(transceiver)