From 3649bc903b680930ab21ac41f9f3273e4004f886 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 3 Apr 2024 13:52:47 +0100 Subject: [PATCH 01/16] test will work with any version --- .../model_tests/splitter_tests/test_one_app_one_machine.py | 2 +- .../model_tests/splitter_tests/test_splitter_fixed_legacy.py | 2 +- .../splitter_tests/test_splitter_one_to_one_legacy.py | 2 +- .../partition_algorithms_tests/test_basic_partitioner.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py index f7b24348a..2ae0fd022 100644 --- a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py +++ b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py @@ -34,7 +34,7 @@ def setUp(self): unittest_setup() def test_legacy(self): - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) splitter = SplitterOneAppOneMachine() v1 = NonLegacyApplicationVertex("v1") a = str(splitter) diff --git a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py index fa016d42f..d147292d7 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py @@ -29,7 +29,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) splitter = SplitterFixedLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py index bc1d2a0f1..874c9fc8c 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py @@ -30,7 +30,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) splitter = SplitterOneToOneLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py index f4fb92432..7a48b5238 100644 --- a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py +++ b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py @@ -44,7 +44,7 @@ def setUp(self): setup for all basic partitioner tests """ unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) def test_partition_with_no_fixed(self): """ From 1d3c35d026a009be85c53d439a278edac07377ca Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 3 Apr 2024 13:53:05 +0100 Subject: [PATCH 02/16] test version 201 --- unittests/test_fixed_route_router.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unittests/test_fixed_route_router.py b/unittests/test_fixed_route_router.py index aa93c3937..06ca405e8 100644 --- a/unittests/test_fixed_route_router.py +++ b/unittests/test_fixed_route_router.py @@ -71,7 +71,8 @@ def _check_setup(width, height): [(3, 2, 2), (5, 8, 8), (5, 12, 12), - (5, 16, 16)]) + (5, 16, 16), + (201, 1, 1)]) @pytest.mark.parametrize( "with_down_links,with_down_chips", [(False, False), From 97c0bd2e25357abe4ea920daa8a63ca2aefe11c6 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 3 Apr 2024 13:53:24 +0100 Subject: [PATCH 03/16] make test work with any version where possible --- .../test_application_placer.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 2da335dce..4b3abcb85 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -197,7 +197,7 @@ def test_application_placer_fill_chips(): def test_sdram_bigger_than_chip(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip _make_vertices(writer, 1, 1, 5, "big_app_vertex", @@ -211,7 +211,7 @@ def test_sdram_bigger_than_chip(): def test_sdram_bigger_monitors(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip monitor = SimpleMachineVertex(ConstantSDRAM(max_sdram // 2)) @@ -227,9 +227,11 @@ def test_sdram_bigger_monitors(): def test_more_cores_than_chip(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() - _make_vertices(writer, 1, 1, 19, "big_app_vertex") + version = writer.get_machine_version() + _make_vertices( + writer, 1, 1, version.max_cores_per_chip + 1, "big_app_vertex") try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -239,9 +241,10 @@ def test_more_cores_than_chip(): def test_more_cores_than_user(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() - _make_vertices(writer, 1, 1, 18, "big_app_vertex") + version = writer.get_machine_version() + _make_vertices(writer, 1, 1, version.max_cores_per_chip, "big_app_vertex") try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -251,14 +254,15 @@ def test_more_cores_than_user(): def test_more_cores_with_monitor(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() + version = writer.get_machine_version() monitor = SimpleMachineVertex(ConstantSDRAM(4000)) # This is purely an info call so test check directly writer.add_sample_monitor_vertex(monitor, True) try: placer = ApplicationPlacer(Placements()) - placer._check_could_fit(17, 500000) + placer._check_could_fit(version.max_cores_per_chip-1, 500000) raise AssertionError("Error not raise") except PacmanTooBigToPlace as ex: assert ("reserved for monitors" in str(ex)) @@ -266,7 +270,7 @@ def test_more_cores_with_monitor(): def test_could_fit(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(0)) writer.add_sample_monitor_vertex(monitor, True) From bdf8e3964e5769051108e852a690a743b619a79a Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 3 Apr 2024 14:04:59 +0100 Subject: [PATCH 04/16] test will work with any version --- .../router_compressor_tests/test_compressors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/operations_tests/router_compressor_tests/test_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index d477196ae..9d7bfcc18 100644 --- a/unittests/operations_tests/router_compressor_tests/test_compressors.py +++ b/unittests/operations_tests/router_compressor_tests/test_compressors.py @@ -69,7 +69,7 @@ def setUp(self): unittest_setup() set_config( "Mapping", "router_table_compress_as_far_as_possible", True) - set_config("Machine", "version", 5) + set_config("Machine", "version", -1) writer = PacmanDataWriter.mock() writer.set_uncompressed(original_tables) writer.set_precompressed(original_tables) From c79679d348a2e361457d869a55bcc812d0de3f23 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 3 Apr 2024 15:21:01 +0100 Subject: [PATCH 05/16] ANY_VERSION --- .../splitter_tests/test_one_app_one_machine.py | 3 ++- .../splitter_tests/test_splitter_fixed_legacy.py | 3 ++- .../test_splitter_one_to_one_legacy.py | 3 ++- .../test_basic_partitioner.py | 3 ++- .../test_application_placer.py | 13 +++++++------ .../router_compressor_tests/test_compressors.py | 4 +++- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py index 2ae0fd022..41efdce39 100644 --- a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py +++ b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py @@ -15,6 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -34,7 +35,7 @@ def setUp(self): unittest_setup() def test_legacy(self): - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) splitter = SplitterOneAppOneMachine() v1 = NonLegacyApplicationVertex("v1") a = str(splitter) diff --git a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py index d147292d7..7bad970c4 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py @@ -15,6 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -29,7 +30,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) splitter = SplitterFixedLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py index 874c9fc8c..217a96933 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py @@ -15,6 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -30,7 +31,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) splitter = SplitterOneToOneLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py index 7a48b5238..d02af84ed 100644 --- a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py +++ b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py @@ -19,6 +19,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView @@ -44,7 +45,7 @@ def setUp(self): setup for all basic partitioner tests """ unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) def test_partition_with_no_fixed(self): """ diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 4b3abcb85..7c3980a3f 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -12,6 +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.virtual_machine import virtual_machine from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import (PacmanPlaceException, PacmanTooBigToPlace) @@ -197,7 +198,7 @@ def test_application_placer_fill_chips(): def test_sdram_bigger_than_chip(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip _make_vertices(writer, 1, 1, 5, "big_app_vertex", @@ -211,7 +212,7 @@ def test_sdram_bigger_than_chip(): def test_sdram_bigger_monitors(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip monitor = SimpleMachineVertex(ConstantSDRAM(max_sdram // 2)) @@ -227,7 +228,7 @@ def test_sdram_bigger_monitors(): def test_more_cores_than_chip(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() version = writer.get_machine_version() _make_vertices( @@ -241,7 +242,7 @@ def test_more_cores_than_chip(): def test_more_cores_than_user(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() version = writer.get_machine_version() _make_vertices(writer, 1, 1, version.max_cores_per_chip, "big_app_vertex") @@ -254,7 +255,7 @@ def test_more_cores_than_user(): def test_more_cores_with_monitor(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() version = writer.get_machine_version() monitor = SimpleMachineVertex(ConstantSDRAM(4000)) @@ -270,7 +271,7 @@ def test_more_cores_with_monitor(): def test_could_fit(): unittest_setup() - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(0)) writer.add_sample_monitor_vertex(monitor, True) diff --git a/unittests/operations_tests/router_compressor_tests/test_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index 9d7bfcc18..7bded5f5d 100644 --- a/unittests/operations_tests/router_compressor_tests/test_compressors.py +++ b/unittests/operations_tests/router_compressor_tests/test_compressors.py @@ -15,6 +15,8 @@ import unittest from spinn_utilities.config_holder import set_config from spinn_machine import MulticastRoutingEntry +from spinn_machine.version import ANY_VERSION + from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter @@ -69,7 +71,7 @@ def setUp(self): unittest_setup() set_config( "Mapping", "router_table_compress_as_far_as_possible", True) - set_config("Machine", "version", -1) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() writer.set_uncompressed(original_tables) writer.set_precompressed(original_tables) From 894a5bc729421b479616af081306227dba9668fb Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 8 Apr 2024 07:08:50 +0100 Subject: [PATCH 06/16] Move monitor core count to Machine level --- pacman/data/pacman_data_view.py | 33 ------------------------------- pacman/data/pacman_data_writer.py | 3 +-- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/pacman/data/pacman_data_view.py b/pacman/data/pacman_data_view.py index 7b51c7101..04f135647 100644 --- a/pacman/data/pacman_data_view.py +++ b/pacman/data/pacman_data_view.py @@ -69,9 +69,7 @@ class _PacmanDataModel(object): "_plan_n_timesteps", "_precompressed", "_all_monitor_vertices", - "_all_monitor_cores", "_ethernet_monitor_vertices", - "_ethernet_monitor_cores", "_routing_infos", "_routing_table_by_partition", "_tags", @@ -103,9 +101,7 @@ def _hard_reset(self) -> None: self._placements: Optional[Placements] = None self._precompressed: Optional[MulticastRoutingTables] = None self._all_monitor_vertices: List[MachineVertex] = [] - self._all_monitor_cores: int = 0 self._ethernet_monitor_vertices: List[MachineVertex] = [] - self._ethernet_monitor_cores: int = 0 self._uncompressed: Optional[MulticastRoutingTables] = None self._routing_infos: Optional[RoutingInfo] = None self._routing_table_by_partition: Optional[ @@ -541,20 +537,6 @@ def get_routing_table_by_partition( raise cls._exception("routing_table_by_partition") return cls.__pacman_data._routing_table_by_partition - @classmethod - def get_all_monitor_cores(cls) -> int: - """ - The number of cores on every chip reported to be used by \ - monitor vertices. - - Ethernet-enabled chips may have more. - - Does not include the system core reserved by the machine/ scamp. - - :rtype: int - """ - return cls.__pacman_data._all_monitor_cores - @classmethod def get_all_monitor_sdram(cls) -> AbstractSDRAM: """ @@ -574,21 +556,6 @@ def get_all_monitor_sdram(cls) -> AbstractSDRAM: sdram += vertex.sdram_required return sdram - @classmethod - def get_ethernet_monitor_cores(cls) -> int: - """ - The number of cores on every Ethernet chip reported to be used by \ - monitor vertices. - - This includes the one returned by get_all_monitor_cores unless for - some reason these are not on Ethernet chips. - - Does not include the system core reserved by the machine/ scamp. - - :rtype: int - """ - return cls.__pacman_data._ethernet_monitor_cores - @classmethod def get_ethernet_monitor_sdram(cls) -> AbstractSDRAM: """ diff --git a/pacman/data/pacman_data_writer.py b/pacman/data/pacman_data_writer.py index a7a9e5e66..0ad116b69 100644 --- a/pacman/data/pacman_data_writer.py +++ b/pacman/data/pacman_data_writer.py @@ -198,8 +198,7 @@ def add_sample_monitor_vertex( If False assumes that this Vertex type will only be placed on Ethernet Vertices """ - self.__pacman_data._ethernet_monitor_cores += 1 + self.add_monitor_core(all_cores) self.__pacman_data._ethernet_monitor_vertices.append(vertex) if all_cores: - self.__pacman_data._all_monitor_cores += 1 self.__pacman_data._all_monitor_vertices.append(vertex) From d75fefab12e96c26613fac987f3ca6146c19d1bc Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 8 Apr 2024 15:37:36 +0100 Subject: [PATCH 07/16] remove hard coded values from tests --- .../test_application_placer.py | 44 +++++++++++++------ .../router_algorithms_tests/test_routers.py | 23 +++++++--- .../test_tags_board_addresses.py | 29 ++++++++---- 3 files changed, 68 insertions(+), 28 deletions(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 2da335dce..11e412d8b 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -103,7 +103,9 @@ def test_application_placer(): fixed.splitter.create_machine_vertices(ChipCounter()) for i in range(61): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") - writer.set_machine(virtual_machine(24, 12)) + # Fudge factor needed as not filling chips well + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices() * 1.2)) place_application_graph(Placements()) @@ -111,15 +113,20 @@ def test_application_placer_large_groups(): unittest_setup() set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() + version = writer.get_machine_version() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) fixed.splitter = SplitterFixedLegacy() fixed.set_fixed_location(0, 0) writer.add_vertex(fixed) fixed.splitter.create_machine_vertices(ChipCounter()) + # make groups to fill chips + n_machine_vertices = version.max_cores_per_chip - 2 for i in range(17): - _make_vertices(writer, 1000, 14, 17, f"app_vertex_{i}") - writer.set_machine(virtual_machine(24, 12)) + _make_vertices( + writer, 1000, 14, n_machine_vertices, f"app_vertex_{i}") + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -135,7 +142,9 @@ def test_application_placer_too_few_boards(): fixed.splitter.create_machine_vertices(ChipCounter()) for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") - writer.set_machine(virtual_machine(12, 12)) + # intentionally too small + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices() / 2)) try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -156,7 +165,8 @@ def test_application_placer_restart_needed(): for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") # Don't use a full wrap machine - writer.set_machine(virtual_machine(28, 16)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -173,7 +183,8 @@ def test_application_placer_late_fixed(): writer.add_vertex(fixed) fixed.splitter.create_machine_vertices(ChipCounter()) - writer.set_machine(virtual_machine(24, 12)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -187,11 +198,14 @@ def test_application_placer_fill_chips(): fixed.set_fixed_location(0, 0) writer.add_vertex(fixed) fixed.splitter.create_machine_vertices(ChipCounter()) + version = writer.get_machine_version() + half = version.max_cores_per_chip // 2 for i in range(17): - _make_vertices(writer, 1000, 14, 9, f"app_vertex_{i}") + _make_vertices(writer, 1000, 14, half, f"app_vertex_{i}") for i in range(17): - _make_vertices(writer, 1000, 14, 8, f"app_vertex_{i}") - writer.set_machine(virtual_machine(24, 12)) + _make_vertices(writer, 1000, 14, half - 1, f"app_vertex_{i}") + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -229,7 +243,8 @@ def test_more_cores_than_chip(): unittest_setup() set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() - _make_vertices(writer, 1, 1, 19, "big_app_vertex") + many = writer.get_machine_version().max_cores_per_chip + 1 + _make_vertices(writer, 1, 1, many, "big_app_vertex") try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -241,7 +256,8 @@ def test_more_cores_than_user(): unittest_setup() set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() - _make_vertices(writer, 1, 1, 18, "big_app_vertex") + many = writer.get_machine_version().max_cores_per_chip + _make_vertices(writer, 1, 1, many, "big_app_vertex") try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -256,9 +272,10 @@ def test_more_cores_with_monitor(): monitor = SimpleMachineVertex(ConstantSDRAM(4000)) # This is purely an info call so test check directly writer.add_sample_monitor_vertex(monitor, True) + many = writer.get_machine_version().max_cores_per_chip - 1 try: placer = ApplicationPlacer(Placements()) - placer._check_could_fit(17, 500000) + placer._check_could_fit(many, 500000) raise AssertionError("Error not raise") except PacmanTooBigToPlace as ex: assert ("reserved for monitors" in str(ex)) @@ -271,4 +288,5 @@ def test_could_fit(): monitor = SimpleMachineVertex(ConstantSDRAM(0)) writer.add_sample_monitor_vertex(monitor, True) placer = ApplicationPlacer(Placements()) - placer._check_could_fit(16, 500000) + many = writer.get_machine_version().max_cores_per_chip - 2 + placer._check_could_fit(many, 500000) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index 00e204ef6..01c0f09c8 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -520,7 +520,8 @@ def test_multi_split(params): if source != target: writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine(24, 24)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -538,7 +539,8 @@ def test_multi_self_split(params): for target in writer.iterate_vertices(): writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine(24, 24)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -609,7 +611,8 @@ def test_internal_only(params): writer, 1000, 3, 2, 2, "app_vertex", internal_multicast=True) - writer.set_machine(virtual_machine(24, 24)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -629,7 +632,8 @@ def test_internal_and_split(params): if source != target: writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine(24, 24)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -692,7 +696,6 @@ def test_fpga_link_overlap(params): set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() set_config("Machine", "down_chips", "6,1") - writer.set_machine(virtual_machine(12, 12)) in_device = ApplicationFPGAVertex( 100, [FPGAConnection(0, i, None, None) for i in range(15, 0, -2)], None) @@ -703,6 +706,8 @@ def test_fpga_link_overlap(params): writer, 1000, 60 * 16, "app_vertex") writer.add_edge(ApplicationEdge(in_device, app_vertex), "Test") + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -736,6 +741,8 @@ def test_odd_case(params): x, y, p = next(core_iter) placements.add_placement(Placement(m_vertex, x, y, p)) + writer.set_machine(virtual_machine( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(placements) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -749,7 +756,9 @@ def test_with_ethernet_system_placements(params): unittest_setup() set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() - writer.set_machine(virtual_machine(16, 16)) + version = writer.get_machine_version() + width, height = version.size_from_n_boards(4) + writer.set_machine(virtual_machine(width, height)) source_vertex = _make_vertices(writer, 200, 3, "app_vertex") target_vertex = _make_ethernet_vertices(writer, 1, "eth_vertex") writer.add_edge(ApplicationEdge(source_vertex, target_vertex), "Test") @@ -797,7 +806,7 @@ def test_route_around(): # 2,3 3,3 4,3 # 2,2 3,2 set_config("Machine", "down_chips", "2,3:3,2:3,4:4,4:4,3") - machine = virtual_machine(8, 8) + machine = PacmanDataView.get_machine() vector = machine.get_vector((0, 0), (6, 6)) PacmanDataWriter.mock().set_machine(machine) nodes = longest_dimension_first(vector, (0, 0)) diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 190973db4..899d9962a 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -17,6 +17,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine from pacman.config_setup import unittest_setup +from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import PacmanNotFoundError from pacman.model.placements import Placement, Placements @@ -35,7 +36,9 @@ def setUp(self): def test_ip_tags(self): writer = PacmanDataWriter.mock() - machine = virtual_machine(12, 12) + version = writer.get_machine_version() + width, heigth = version.size_from_n_boards(3) + machine = virtual_machine(width, heigth) writer.set_machine(machine) eth_chips = machine.ethernet_connected_chips vertices = [ @@ -119,8 +122,7 @@ def do_too_many_ip_tags_for_1_board(self, machine): def test_fixed_tag(self): writer = PacmanDataWriter.mock() - machine = virtual_machine(8, 8) - writer.set_machine(machine) + machine = writer.get_machine() chip00 = machine.get_chip_at(0, 0) procs = chip00.placable_processors_ids placements = Placements() @@ -158,18 +160,26 @@ def do_fixed_repeat_tag(self, machine): self.assertEqual(6, len(list(tags.ip_tags_vertices))) def test_too_many_ip_tags_for_1_board(self): + machine = PacmanDataView.get_machine() with self.assertRaises(PacmanNotFoundError): - self.do_too_many_ip_tags_for_1_board(virtual_machine(8, 8)) + self.do_too_many_ip_tags_for_1_board(machine) def test_spread_ip_tags(self): - self.do_too_many_ip_tags_for_1_board(virtual_machine(12, 12)) + version = PacmanDataView.get_machine_version() + width, heigth = version.size_from_n_boards(3) + machine = virtual_machine(width, heigth) + self.do_too_many_ip_tags_for_1_board(machine) def test_fixed_repeat_tag_1_board(self): + machine = PacmanDataView.get_machine() with self.assertRaises(PacmanNotFoundError): - self.do_fixed_repeat_tag(virtual_machine(8, 8)) + self.do_fixed_repeat_tag(machine) def test_fixed_repeat_tag_3_boards(self): - self.do_fixed_repeat_tag(virtual_machine(12, 12)) + version = PacmanDataView.get_machine_version() + width, heigth = version.size_from_n_boards(3) + machine = virtual_machine(width, heigth) + self.do_fixed_repeat_tag(machine) def do_reverse(self, machine): writer = PacmanDataWriter.mock() @@ -187,4 +197,7 @@ def do_reverse(self, machine): self.assertEqual(1, len(list(tags.reverse_ip_tags))) def test_do_reverse_3_boards(self): - self.do_reverse(virtual_machine(12, 12)) + version = PacmanDataView.get_machine_version() + width, heigth = version.size_from_n_boards(3) + machine = virtual_machine(width, heigth) + self.do_reverse(machine) From 424c430f5eae633e8fb419fabe28b7ab2de1fcfd Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 9 Apr 2024 10:30:06 +0100 Subject: [PATCH 08/16] virtual_machine_by --- .../test_application_placer.py | 14 +++++++------- .../router_algorithms_tests/test_routers.py | 18 ++++++++---------- .../test_checked_unordered_pair_compression.py | 2 ++ .../test_ordered_covering_compression.py | 2 ++ .../test_pair_compression.py | 2 ++ .../test_unordered_pair_compression.py | 2 ++ .../test_tags_board_addresses.py | 18 +++++------------- 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 11e412d8b..2a8913a3e 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.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.virtual_machine import virtual_machine +from spinn_machine.virtual_machine import virtual_machine_by_cores from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import (PacmanPlaceException, PacmanTooBigToPlace) from pacman.model.partitioner_splitters import ( @@ -104,7 +104,7 @@ def test_application_placer(): for i in range(61): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") # Fudge factor needed as not filling chips well - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices() * 1.2)) place_application_graph(Placements()) @@ -125,7 +125,7 @@ def test_application_placer_large_groups(): for i in range(17): _make_vertices( writer, 1000, 14, n_machine_vertices, f"app_vertex_{i}") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -143,7 +143,7 @@ def test_application_placer_too_few_boards(): for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") # intentionally too small - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices() / 2)) try: place_application_graph(Placements()) @@ -165,7 +165,7 @@ def test_application_placer_restart_needed(): for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") # Don't use a full wrap machine - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -183,7 +183,7 @@ def test_application_placer_late_fixed(): writer.add_vertex(fixed) fixed.splitter.create_machine_vertices(ChipCounter()) - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) @@ -204,7 +204,7 @@ def test_application_placer_fill_chips(): _make_vertices(writer, 1000, 14, half, f"app_vertex_{i}") for i in range(17): _make_vertices(writer, 1000, 14, half - 1, f"app_vertex_{i}") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index 01c0f09c8..c49018b96 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -13,7 +13,7 @@ # limitations under the License. from spinn_utilities.timer import Timer from spinn_utilities.config_holder import set_config -from spinn_machine import virtual_machine +from spinn_machine import (virtual_machine_by_boards, virtual_machine_by_cores) from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import PacmanRoutingException @@ -520,7 +520,7 @@ def test_multi_split(params): if source != target: writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) @@ -539,7 +539,7 @@ def test_multi_self_split(params): for target in writer.iterate_vertices(): writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) @@ -611,7 +611,7 @@ def test_internal_only(params): writer, 1000, 3, 2, 2, "app_vertex", internal_multicast=True) - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) @@ -632,7 +632,7 @@ def test_internal_and_split(params): if source != target: writer.add_edge(ApplicationEdge(source, target), "Test") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) @@ -706,7 +706,7 @@ def test_fpga_link_overlap(params): writer, 1000, 60 * 16, "app_vertex") writer.add_edge(ApplicationEdge(in_device, app_vertex), "Test") - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) @@ -741,7 +741,7 @@ def test_odd_case(params): x, y, p = next(core_iter) placements.add_placement(Placement(m_vertex, x, y, p)) - writer.set_machine(virtual_machine( + writer.set_machine(virtual_machine_by_cores( n_cores=writer.get_n_machine_vertices())) writer.set_placements(placements) routing_tables = _route_and_time(algorithm) @@ -756,9 +756,7 @@ def test_with_ethernet_system_placements(params): unittest_setup() set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() - version = writer.get_machine_version() - width, height = version.size_from_n_boards(4) - writer.set_machine(virtual_machine(width, height)) + writer.set_machine(virtual_machine_by_boards(4)) source_vertex = _make_vertices(writer, 200, 3, "app_vertex") target_vertex = _make_ethernet_vertices(writer, 1, "eth_vertex") writer.add_edge(ApplicationEdge(source_vertex, target_vertex), "Test") diff --git a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index 67747d97c..9ae556f67 100644 --- a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py @@ -41,6 +41,8 @@ def test_onordered_pair_big(self): writer = PacmanDataWriter.mock() writer.set_precompressed(original_tables) + # This tests requires a full wrap machine + # The input includes Chips like 3, 8 writer.set_machine(virtual_machine(24, 24)) with self.assertRaises(PacmanElementAllocationException): pair_compressor( diff --git a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py index 1205c8436..c1444fa50 100644 --- a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py @@ -41,6 +41,8 @@ def test_oc_big(self): original_tables = from_json(j_router) writer = PacmanDataWriter.mock() writer.set_precompressed(original_tables) + # This tests requires a full wrap machine + # The input includes Chips like 3, 8 writer.set_machine(virtual_machine(24, 24)) compressed_tables = ordered_covering_compressor() diff --git a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py index 86ec3de3c..959d4fb7b 100644 --- a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py @@ -39,6 +39,8 @@ def do_pair_big(self, c_sort): original_tables = from_json(j_router) writer = PacmanDataWriter.mock() writer.set_precompressed(original_tables) + # This tests requires a full wrap machine + # The input includes Chips like 3, 8 writer.set_machine(virtual_machine(24, 24)) compressed_tables = pair_compressor(c_sort=c_sort) diff --git a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py index f0dbf32e9..d9c24acc1 100644 --- a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py @@ -40,6 +40,8 @@ def test_onordered_pair_big(self): original_tables = from_json(j_router) writer = PacmanDataWriter.mock() writer.set_precompressed(original_tables) + # This tests requires a full wrap machine + # The input includes Chips like 3, 8 writer.set_machine(virtual_machine(24, 24)) # Hack to stop it throwing a wobly for too many entries diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 899d9962a..03b79a7bd 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -15,7 +15,7 @@ import unittest from collections import defaultdict from spinn_utilities.config_holder import set_config -from spinn_machine import virtual_machine +from spinn_machine import virtual_machine_by_boards from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter @@ -36,9 +36,7 @@ def setUp(self): def test_ip_tags(self): writer = PacmanDataWriter.mock() - version = writer.get_machine_version() - width, heigth = version.size_from_n_boards(3) - machine = virtual_machine(width, heigth) + machine = virtual_machine_by_boards(3) writer.set_machine(machine) eth_chips = machine.ethernet_connected_chips vertices = [ @@ -165,9 +163,7 @@ def test_too_many_ip_tags_for_1_board(self): self.do_too_many_ip_tags_for_1_board(machine) def test_spread_ip_tags(self): - version = PacmanDataView.get_machine_version() - width, heigth = version.size_from_n_boards(3) - machine = virtual_machine(width, heigth) + machine = virtual_machine_by_boards(3) self.do_too_many_ip_tags_for_1_board(machine) def test_fixed_repeat_tag_1_board(self): @@ -176,9 +172,7 @@ def test_fixed_repeat_tag_1_board(self): self.do_fixed_repeat_tag(machine) def test_fixed_repeat_tag_3_boards(self): - version = PacmanDataView.get_machine_version() - width, heigth = version.size_from_n_boards(3) - machine = virtual_machine(width, heigth) + machine = virtual_machine_by_boards(3) self.do_fixed_repeat_tag(machine) def do_reverse(self, machine): @@ -197,7 +191,5 @@ def do_reverse(self, machine): self.assertEqual(1, len(list(tags.reverse_ip_tags))) def test_do_reverse_3_boards(self): - version = PacmanDataView.get_machine_version() - width, heigth = version.size_from_n_boards(3) - machine = virtual_machine(width, heigth) + machine = virtual_machine_by_boards(3) self.do_reverse(machine) From aa8f65692620e08630f547e92970296d3607bfa1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 10 Apr 2024 08:18:25 +0100 Subject: [PATCH 09/16] removed special virtual_machine methods from init file --- .../operations_tests/router_algorithms_tests/test_routers.py | 3 ++- .../tag_allocator_tests/test_tags_board_addresses.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index c49018b96..5b22126c2 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -13,7 +13,8 @@ # limitations under the License. from spinn_utilities.timer import Timer from spinn_utilities.config_holder import set_config -from spinn_machine import (virtual_machine_by_boards, virtual_machine_by_cores) +from spinn_machine.virtual_machine import ( + virtual_machine_by_boards, virtual_machine_by_cores) from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import PacmanRoutingException diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 03b79a7bd..01dc3d578 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -15,7 +15,7 @@ import unittest from collections import defaultdict from spinn_utilities.config_holder import set_config -from spinn_machine import virtual_machine_by_boards +from spinn_machine.virtual_machine import virtual_machine_by_boards from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter From c0155010e7be13746290ddc466b0618ee5a279ca Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 10 Apr 2024 10:54:58 +0100 Subject: [PATCH 10/16] test with ANY_VERSION or MULTIPLE_BOARDS --- .../test_application_placer.py | 14 ++++---- .../router_algorithms_tests/test_routers.py | 33 ++++++++++--------- ...test_checked_unordered_pair_compression.py | 3 +- .../test_ordered_covering_compression.py | 3 +- .../test_pair_compression.py | 3 +- .../test_range_compressor.py | 3 +- .../test_unordered_pair_compression.py | 3 +- .../test_basic.py | 2 ++ .../test_merged.py | 2 ++ .../test_tags_board_addresses.py | 3 +- unittests/test_fixed_route_router.py | 3 +- 11 files changed, 42 insertions(+), 30 deletions(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 13269a5f5..889dc5e51 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -13,7 +13,7 @@ # limitations under the License. from spinn_utilities.config_holder import set_config from spinn_machine.virtual_machine import virtual_machine_by_cores -from spinn_machine.version import ANY_VERSION +from spinn_machine.version import ANY_VERSION, MULTIPLE_BOARDS from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import (PacmanPlaceException, PacmanTooBigToPlace) from pacman.model.partitioner_splitters import ( @@ -94,7 +94,7 @@ def _make_vertices( def test_application_placer(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -112,7 +112,7 @@ def test_application_placer(): def test_application_placer_large_groups(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() version = writer.get_machine_version() # fixed early works as this vertex is looked at first @@ -133,7 +133,7 @@ def test_application_placer_large_groups(): def test_application_placer_too_few_boards(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -155,7 +155,7 @@ def test_application_placer_too_few_boards(): def test_application_placer_restart_needed(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() for (x, y) in [(1, 0), (1, 1), (0, 1)]: fixed = SimpleTestVertex(15, f"FIXED {x}:{y}", max_atoms_per_core=1) @@ -173,7 +173,7 @@ def test_application_placer_restart_needed(): def test_application_placer_late_fixed(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") @@ -191,7 +191,7 @@ def test_application_placer_late_fixed(): def test_application_placer_fill_chips(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index 5b22126c2..183f71651 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -13,6 +13,7 @@ # limitations under the License. from spinn_utilities.timer import Timer from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION, BIG_MACHINE, MULTIPLE_BOARDS from spinn_machine.virtual_machine import ( virtual_machine_by_boards, virtual_machine_by_cores) from pacman.data import PacmanDataView @@ -435,7 +436,7 @@ def _route_and_time(algorithm): def test_simple(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -449,7 +450,7 @@ def test_simple(params): def test_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "self") writer.add_edge(ApplicationEdge(source_vertex, source_vertex), "Test") @@ -462,7 +463,7 @@ def test_self(params): def test_simple_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -478,7 +479,7 @@ def test_simple_self(params): def test_multi(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -495,7 +496,7 @@ def test_multi(params): def test_multi_self(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -511,7 +512,7 @@ def test_multi_self(params): def test_multi_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -531,7 +532,7 @@ def test_multi_split(params): def test_multi_self_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -550,7 +551,7 @@ def test_multi_self_split(params): def test_multi_down_chips_and_links(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -606,7 +607,7 @@ def test_multi_down_chips_and_links(params): def test_internal_only(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() _make_vertices_split( writer, 1000, 3, 2, 2, "app_vertex", @@ -622,7 +623,7 @@ def test_internal_only(params): def test_internal_and_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split( @@ -643,7 +644,7 @@ def test_internal_and_split(params): def test_spinnaker_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() in_device = ApplicationSpiNNakerLinkVertex(100, 0) in_device.splitter = SplitterExternalDevice() @@ -667,7 +668,7 @@ def test_spinnaker_link(params): def test_fpga_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() in_device = ApplicationFPGAVertex( 100, [FPGAConnection(0, 0, None, None)], None) @@ -694,7 +695,7 @@ def test_fpga_link(params): def test_fpga_link_overlap(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() set_config("Machine", "down_chips", "6,1") in_device = ApplicationFPGAVertex( @@ -717,7 +718,7 @@ def test_fpga_link_overlap(params): def test_odd_case(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() target_vertex = _make_vertices(writer, 200, 20, "app_vertex") delay_vertex = _make_one_to_one_vertices(writer, 200, 20, "delay_vtx") @@ -755,7 +756,7 @@ def test_with_ethernet_system_placements(params): # to one of them algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) writer = PacmanDataWriter.mock() writer.set_machine(virtual_machine_by_boards(4)) source_vertex = _make_vertices(writer, 200, 3, "app_vertex") @@ -798,7 +799,7 @@ def _check_path(source, nodes_fixed, machine, target): def test_route_around(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", BIG_MACHINE) # Take out all the chips around 3,3 except one then make a path that goes # through it # 3,4 4,4 diff --git a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index 9ae556f67..2a77a4c6e 100644 --- a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +from spinn_machine.version import WRAPPABLE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -30,7 +31,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", WRAPPABLE) def test_onordered_pair_big(self): diff --git a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py index c1444fa50..1a976e27c 100644 --- a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +from spinn_machine.version import WRAPPABLE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -31,7 +32,7 @@ class TestOrderedCoveringCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", WRAPPABLE) def test_oc_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py index 959d4fb7b..fcb7898e4 100644 --- a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +from spinn_machine.version import WRAPPABLE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -30,7 +31,7 @@ class TestPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", WRAPPABLE) def do_pair_big(self, c_sort): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py index ce029feee..78dcd18c4 100644 --- a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py +++ b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py @@ -16,6 +16,7 @@ import sys import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version import WRAPPABLE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables import MulticastRoutingTables @@ -31,7 +32,7 @@ class TestRangeCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", WRAPPABLE) set_config( "Mapping", "router_table_compress_as_far_as_possible", True) diff --git a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py index d9c24acc1..21a890d1c 100644 --- a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +from spinn_machine.version import WRAPPABLE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -31,7 +32,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", WRAPPABLE) def test_onordered_pair_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/routing_table_generator_tests/test_basic.py b/unittests/operations_tests/routing_table_generator_tests/test_basic.py index 90a6d3536..5f6cdffee 100644 --- a/unittests/operations_tests/routing_table_generator_tests/test_basic.py +++ b/unittests/operations_tests/routing_table_generator_tests/test_basic.py @@ -36,6 +36,8 @@ class TestBasic(unittest.TestCase): def setUp(self): unittest_setup() + # TODO check after + # https://github.com/SpiNNakerManchester/PACMAN/pull/555 set_config("Machine", "version", 5) def create_graphs3(self, writer): diff --git a/unittests/operations_tests/routing_table_generator_tests/test_merged.py b/unittests/operations_tests/routing_table_generator_tests/test_merged.py index d57ac6821..b3d8dcabb 100644 --- a/unittests/operations_tests/routing_table_generator_tests/test_merged.py +++ b/unittests/operations_tests/routing_table_generator_tests/test_merged.py @@ -38,6 +38,8 @@ class TestMerged(unittest.TestCase): def setUp(self): unittest_setup() + # TODO check after + # https://github.com/SpiNNakerManchester/PACMAN/pull/555 set_config("Machine", "version", 5) def create_graphs1(self, writer): diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 01dc3d578..43651051d 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -15,6 +15,7 @@ import unittest from collections import defaultdict from spinn_utilities.config_holder import set_config +from spinn_machine.version import MULTIPLE_BOARDS from spinn_machine.virtual_machine import virtual_machine_by_boards from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView @@ -32,7 +33,7 @@ class TestTagsBoardAddresses(unittest.TestCase): """ def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", MULTIPLE_BOARDS) def test_ip_tags(self): writer = PacmanDataWriter.mock() diff --git a/unittests/test_fixed_route_router.py b/unittests/test_fixed_route_router.py index 06ca405e8..b85a46393 100644 --- a/unittests/test_fixed_route_router.py +++ b/unittests/test_fixed_route_router.py @@ -15,6 +15,7 @@ import pytest from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +from spinn_machine.version import FIVE from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.placements import Placements, Placement @@ -104,7 +105,7 @@ def test_all_working( def test_unreachable(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", FIVE) set_config("Machine", "down_chips", "0,2:1,3:1,4") with pytest.raises(PacmanRoutingException): _check_setup(8, 8) From 74c62090b1ba70e11a7c9bdfbfb1704e4b00d64b Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 10 Apr 2024 11:09:22 +0100 Subject: [PATCH 11/16] back to 5 until router PR is in --- .../operations_tests/router_algorithms_tests/test_routers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index 183f71651..60bd3124c 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -450,7 +450,9 @@ def test_simple(params): def test_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", ANY_VERSION) + # TODO check after + # https://github.com/SpiNNakerManchester/PACMAN/pull/555 + set_config("Machine", "version", 5) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "self") writer.add_edge(ApplicationEdge(source_vertex, source_vertex), "Test") From dc8ea3423bfb0f7bcf197c579012f09a81658b96 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 10 Apr 2024 11:40:20 +0100 Subject: [PATCH 12/16] flake8 --- .../placer_algorithms_tests/test_application_placer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 889dc5e51..998900cb9 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -270,7 +270,6 @@ def test_more_cores_with_monitor(): unittest_setup() set_config("Machine", "version", ANY_VERSION) writer = PacmanDataWriter.mock() - version = writer.get_machine_version() monitor = SimpleMachineVertex(ConstantSDRAM(4000)) # This is purely an info call so test check directly writer.add_sample_monitor_vertex(monitor, True) From 8666ae3c20d897bbf3836856e4158cb0c0248021 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 14:37:40 +0100 Subject: [PATCH 13/16] VersionStrings --- .../test_one_app_one_machine.py | 4 +-- .../test_splitter_fixed_legacy.py | 4 +-- .../test_splitter_one_to_one_legacy.py | 4 +-- .../test_basic_partitioner.py | 4 +-- .../test_application_placer.py | 26 +++++++-------- .../router_algorithms_tests/test_routers.py | 32 +++++++++---------- ...test_checked_unordered_pair_compression.py | 4 +-- .../test_compressors.py | 4 +-- .../test_ordered_covering_compression.py | 4 +-- .../test_pair_compression.py | 4 +-- .../test_range_compressor.py | 4 +-- .../test_unordered_pair_compression.py | 4 +-- .../test_tags_board_addresses.py | 4 +-- 13 files changed, 51 insertions(+), 51 deletions(-) diff --git a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py index 41efdce39..4b4262f7c 100644 --- a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py +++ b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py @@ -15,7 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -35,7 +35,7 @@ def setUp(self): unittest_setup() def test_legacy(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) splitter = SplitterOneAppOneMachine() v1 = NonLegacyApplicationVertex("v1") a = str(splitter) diff --git a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py index 7bad970c4..12ebef2b5 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py @@ -15,7 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -30,7 +30,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) splitter = SplitterFixedLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py index 217a96933..e3c622ae1 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py @@ -15,7 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.exceptions import PacmanConfigurationException @@ -31,7 +31,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) splitter = SplitterOneToOneLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py index d02af84ed..5a50432fd 100644 --- a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py +++ b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py @@ -19,7 +19,7 @@ import unittest from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView @@ -45,7 +45,7 @@ def setUp(self): setup for all basic partitioner tests """ unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) def test_partition_with_no_fixed(self): """ diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 998900cb9..43da80288 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -13,7 +13,7 @@ # limitations under the License. from spinn_utilities.config_holder import set_config from spinn_machine.virtual_machine import virtual_machine_by_cores -from spinn_machine.version import ANY_VERSION, MULTIPLE_BOARDS +from spinn_machine.version.version_strings import VersionStrings from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import (PacmanPlaceException, PacmanTooBigToPlace) from pacman.model.partitioner_splitters import ( @@ -94,7 +94,7 @@ def _make_vertices( def test_application_placer(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -112,7 +112,7 @@ def test_application_placer(): def test_application_placer_large_groups(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() version = writer.get_machine_version() # fixed early works as this vertex is looked at first @@ -133,7 +133,7 @@ def test_application_placer_large_groups(): def test_application_placer_too_few_boards(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -155,7 +155,7 @@ def test_application_placer_too_few_boards(): def test_application_placer_restart_needed(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() for (x, y) in [(1, 0), (1, 1), (0, 1)]: fixed = SimpleTestVertex(15, f"FIXED {x}:{y}", max_atoms_per_core=1) @@ -173,7 +173,7 @@ def test_application_placer_restart_needed(): def test_application_placer_late_fixed(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") @@ -191,7 +191,7 @@ def test_application_placer_late_fixed(): def test_application_placer_fill_chips(): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -212,7 +212,7 @@ def test_application_placer_fill_chips(): def test_sdram_bigger_than_chip(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip _make_vertices(writer, 1, 1, 5, "big_app_vertex", @@ -226,7 +226,7 @@ def test_sdram_bigger_than_chip(): def test_sdram_bigger_monitors(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip monitor = SimpleMachineVertex(ConstantSDRAM(max_sdram // 2)) @@ -242,7 +242,7 @@ def test_sdram_bigger_monitors(): def test_more_cores_than_chip(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() many = writer.get_machine_version().max_cores_per_chip + 1 _make_vertices(writer, 1, 1, many, "big_app_vertex") @@ -255,7 +255,7 @@ def test_more_cores_than_chip(): def test_more_cores_than_user(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() many = writer.get_machine_version().max_cores_per_chip _make_vertices(writer, 1, 1, many, "big_app_vertex") @@ -268,7 +268,7 @@ def test_more_cores_than_user(): def test_more_cores_with_monitor(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(4000)) # This is purely an info call so test check directly @@ -284,7 +284,7 @@ def test_more_cores_with_monitor(): def test_could_fit(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(0)) writer.add_sample_monitor_vertex(monitor, True) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index 60bd3124c..e513b4128 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -13,7 +13,7 @@ # limitations under the License. from spinn_utilities.timer import Timer from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION, BIG_MACHINE, MULTIPLE_BOARDS +from spinn_machine.version.version_strings import VersionStrings from spinn_machine.virtual_machine import ( virtual_machine_by_boards, virtual_machine_by_cores) from pacman.data import PacmanDataView @@ -436,7 +436,7 @@ def _route_and_time(algorithm): def test_simple(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -465,7 +465,7 @@ def test_self(params): def test_simple_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -481,7 +481,7 @@ def test_simple_self(params): def test_multi(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -498,7 +498,7 @@ def test_multi(params): def test_multi_self(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -514,7 +514,7 @@ def test_multi_self(params): def test_multi_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -534,7 +534,7 @@ def test_multi_split(params): def test_multi_self_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -553,7 +553,7 @@ def test_multi_self_split(params): def test_multi_down_chips_and_links(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -609,7 +609,7 @@ def test_multi_down_chips_and_links(params): def test_internal_only(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() _make_vertices_split( writer, 1000, 3, 2, 2, "app_vertex", @@ -625,7 +625,7 @@ def test_internal_only(params): def test_internal_and_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split( @@ -646,7 +646,7 @@ def test_internal_and_split(params): def test_spinnaker_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() in_device = ApplicationSpiNNakerLinkVertex(100, 0) in_device.splitter = SplitterExternalDevice() @@ -670,7 +670,7 @@ def test_spinnaker_link(params): def test_fpga_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() in_device = ApplicationFPGAVertex( 100, [FPGAConnection(0, 0, None, None)], None) @@ -697,7 +697,7 @@ def test_fpga_link(params): def test_fpga_link_overlap(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() set_config("Machine", "down_chips", "6,1") in_device = ApplicationFPGAVertex( @@ -720,7 +720,7 @@ def test_fpga_link_overlap(params): def test_odd_case(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() target_vertex = _make_vertices(writer, 200, 20, "app_vertex") delay_vertex = _make_one_to_one_vertices(writer, 200, 20, "delay_vtx") @@ -758,7 +758,7 @@ def test_with_ethernet_system_placements(params): # to one of them algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) writer = PacmanDataWriter.mock() writer.set_machine(virtual_machine_by_boards(4)) source_vertex = _make_vertices(writer, 200, 3, "app_vertex") @@ -801,7 +801,7 @@ def _check_path(source, nodes_fixed, machine, target): def test_route_around(): unittest_setup() - set_config("Machine", "version", BIG_MACHINE) + set_config("Machine", "versions", VersionStrings.BIG.value) # Take out all the chips around 3,3 except one then make a path that goes # through it # 3,4 4,4 diff --git a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index 2a77a4c6e..e80018e48 100644 --- a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py @@ -18,7 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine -from spinn_machine.version import WRAPPABLE +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -31,7 +31,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", WRAPPABLE) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) def test_onordered_pair_big(self): diff --git a/unittests/operations_tests/router_compressor_tests/test_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index 7bded5f5d..4ba44bbf0 100644 --- a/unittests/operations_tests/router_compressor_tests/test_compressors.py +++ b/unittests/operations_tests/router_compressor_tests/test_compressors.py @@ -15,7 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config from spinn_machine import MulticastRoutingEntry -from spinn_machine.version import ANY_VERSION +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView @@ -71,7 +71,7 @@ def setUp(self): unittest_setup() set_config( "Mapping", "router_table_compress_as_far_as_possible", True) - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = PacmanDataWriter.mock() writer.set_uncompressed(original_tables) writer.set_precompressed(original_tables) diff --git a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py index 1a976e27c..1de9bfa58 100644 --- a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py @@ -18,7 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine -from spinn_machine.version import WRAPPABLE +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -32,7 +32,7 @@ class TestOrderedCoveringCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", WRAPPABLE) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) def test_oc_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py index fcb7898e4..d03f09dfb 100644 --- a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py @@ -18,7 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine -from spinn_machine.version import WRAPPABLE +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -31,7 +31,7 @@ class TestPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", WRAPPABLE) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) def do_pair_big(self, c_sort): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py index 78dcd18c4..8114fc4a3 100644 --- a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py +++ b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py @@ -16,7 +16,7 @@ import sys import unittest from spinn_utilities.config_holder import set_config -from spinn_machine.version import WRAPPABLE +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables import MulticastRoutingTables @@ -32,7 +32,7 @@ class TestRangeCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", WRAPPABLE) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) set_config( "Mapping", "router_table_compress_as_far_as_possible", True) diff --git a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py index 21a890d1c..01934f170 100644 --- a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py @@ -18,7 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine -from spinn_machine.version import WRAPPABLE +from spinn_machine.version.version_strings import VersionStrings from pacman.config_setup import unittest_setup from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.model.routing_tables.multicast_routing_tables import (from_json) @@ -32,7 +32,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", WRAPPABLE) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) def test_onordered_pair_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 43651051d..394e8edac 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -15,7 +15,7 @@ import unittest from collections import defaultdict from spinn_utilities.config_holder import set_config -from spinn_machine.version import MULTIPLE_BOARDS +from spinn_machine.version.version_strings import VersionStrings from spinn_machine.virtual_machine import virtual_machine_by_boards from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView @@ -33,7 +33,7 @@ class TestTagsBoardAddresses(unittest.TestCase): """ def setUp(self): unittest_setup() - set_config("Machine", "version", MULTIPLE_BOARDS) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) def test_ip_tags(self): writer = PacmanDataWriter.mock() From 54ae065205a809b8f698c0154cadecf856456e6e Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 15:27:26 +0100 Subject: [PATCH 14/16] VersionStrings as simple Enum --- .../test_one_app_one_machine.py | 2 +- .../test_splitter_fixed_legacy.py | 2 +- .../test_splitter_one_to_one_legacy.py | 2 +- .../test_basic_partitioner.py | 2 +- .../test_application_placer.py | 12 ++++---- .../router_algorithms_tests/test_routers.py | 28 +++++++++---------- .../test_compressors.py | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py index 4b4262f7c..32af06af6 100644 --- a/unittests/model_tests/splitter_tests/test_one_app_one_machine.py +++ b/unittests/model_tests/splitter_tests/test_one_app_one_machine.py @@ -35,7 +35,7 @@ def setUp(self): unittest_setup() def test_legacy(self): - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) splitter = SplitterOneAppOneMachine() v1 = NonLegacyApplicationVertex("v1") a = str(splitter) diff --git a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py index 12ebef2b5..83bad6205 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_fixed_legacy.py @@ -30,7 +30,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) splitter = SplitterFixedLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py index e3c622ae1..315be6820 100644 --- a/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py +++ b/unittests/model_tests/splitter_tests/test_splitter_one_to_one_legacy.py @@ -31,7 +31,7 @@ def setUp(self): unittest_setup() def test_api(self): - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) splitter = SplitterOneToOneLegacy() self.assertIsNotNone(str(splitter)) self.assertIsNotNone(repr(splitter)) diff --git a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py index 5a50432fd..fb3f51e04 100644 --- a/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py +++ b/unittests/operations_tests/partition_algorithms_tests/test_basic_partitioner.py @@ -45,7 +45,7 @@ def setUp(self): setup for all basic partitioner tests """ unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) def test_partition_with_no_fixed(self): """ diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 43da80288..90d0ac002 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -212,7 +212,7 @@ def test_application_placer_fill_chips(): def test_sdram_bigger_than_chip(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip _make_vertices(writer, 1, 1, 5, "big_app_vertex", @@ -226,7 +226,7 @@ def test_sdram_bigger_than_chip(): def test_sdram_bigger_monitors(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() max_sdram = writer.get_machine_version().max_sdram_per_chip monitor = SimpleMachineVertex(ConstantSDRAM(max_sdram // 2)) @@ -242,7 +242,7 @@ def test_sdram_bigger_monitors(): def test_more_cores_than_chip(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() many = writer.get_machine_version().max_cores_per_chip + 1 _make_vertices(writer, 1, 1, many, "big_app_vertex") @@ -255,7 +255,7 @@ def test_more_cores_than_chip(): def test_more_cores_than_user(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() many = writer.get_machine_version().max_cores_per_chip _make_vertices(writer, 1, 1, many, "big_app_vertex") @@ -268,7 +268,7 @@ def test_more_cores_than_user(): def test_more_cores_with_monitor(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(4000)) # This is purely an info call so test check directly @@ -284,7 +284,7 @@ def test_more_cores_with_monitor(): def test_could_fit(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() monitor = SimpleMachineVertex(ConstantSDRAM(0)) writer.add_sample_monitor_vertex(monitor, True) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index e513b4128..d27fa97f3 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -436,7 +436,7 @@ def _route_and_time(algorithm): def test_simple(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -465,7 +465,7 @@ def test_self(params): def test_simple_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() source_vertex = _make_vertices(writer, 1000, n_m_vertices, "source") target_vertex = _make_vertices(writer, 1000, n_m_vertices, "target") @@ -481,7 +481,7 @@ def test_simple_self(params): def test_multi(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -498,7 +498,7 @@ def test_multi(params): def test_multi_self(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -514,7 +514,7 @@ def test_multi_self(params): def test_multi_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -534,7 +534,7 @@ def test_multi_split(params): def test_multi_self_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split(writer, 1000, 3, 2, n_m_vertices, @@ -553,7 +553,7 @@ def test_multi_self_split(params): def test_multi_down_chips_and_links(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices(writer, 1000, n_m_vertices, f"app_vertex_{i}") @@ -609,7 +609,7 @@ def test_multi_down_chips_and_links(params): def test_internal_only(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() _make_vertices_split( writer, 1000, 3, 2, 2, "app_vertex", @@ -646,7 +646,7 @@ def test_internal_and_split(params): def test_spinnaker_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() in_device = ApplicationSpiNNakerLinkVertex(100, 0) in_device.splitter = SplitterExternalDevice() @@ -670,7 +670,7 @@ def test_spinnaker_link(params): def test_fpga_link(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() in_device = ApplicationFPGAVertex( 100, [FPGAConnection(0, 0, None, None)], None) @@ -697,7 +697,7 @@ def test_fpga_link(params): def test_fpga_link_overlap(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() set_config("Machine", "down_chips", "6,1") in_device = ApplicationFPGAVertex( @@ -720,7 +720,7 @@ def test_fpga_link_overlap(params): def test_odd_case(params): algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() target_vertex = _make_vertices(writer, 200, 20, "app_vertex") delay_vertex = _make_one_to_one_vertices(writer, 200, 20, "delay_vtx") @@ -758,7 +758,7 @@ def test_with_ethernet_system_placements(params): # to one of them algorithm, _n_vertices, _n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() writer.set_machine(virtual_machine_by_boards(4)) source_vertex = _make_vertices(writer, 200, 3, "app_vertex") @@ -801,7 +801,7 @@ def _check_path(source, nodes_fixed, machine, target): def test_route_around(): unittest_setup() - set_config("Machine", "versions", VersionStrings.BIG.value) + set_config("Machine", "versions", VersionStrings.BIG.text) # Take out all the chips around 3,3 except one then make a path that goes # through it # 3,4 4,4 diff --git a/unittests/operations_tests/router_compressor_tests/test_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index 4ba44bbf0..87e6e5dae 100644 --- a/unittests/operations_tests/router_compressor_tests/test_compressors.py +++ b/unittests/operations_tests/router_compressor_tests/test_compressors.py @@ -71,7 +71,7 @@ def setUp(self): unittest_setup() set_config( "Mapping", "router_table_compress_as_far_as_possible", True) - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() writer.set_uncompressed(original_tables) writer.set_precompressed(original_tables) From cfb89a1e9e9f6ddccd70f37fc10e1c6228d2fa1d Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 16:31:14 +0100 Subject: [PATCH 15/16] VersionStrings fixes --- .../test_application_placer.py | 12 ++++++------ .../router_algorithms_tests/test_routers.py | 2 +- .../test_checked_unordered_pair_compression.py | 2 +- .../test_ordered_covering_compression.py | 2 +- .../router_compressor_tests/test_pair_compression.py | 2 +- .../router_compressor_tests/test_range_compressor.py | 2 +- .../test_unordered_pair_compression.py | 2 +- .../tag_allocator_tests/test_tags_board_addresses.py | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py index 90d0ac002..fc502da36 100644 --- a/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py +++ b/unittests/operations_tests/placer_algorithms_tests/test_application_placer.py @@ -94,7 +94,7 @@ def _make_vertices( def test_application_placer(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -112,7 +112,7 @@ def test_application_placer(): def test_application_placer_large_groups(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() version = writer.get_machine_version() # fixed early works as this vertex is looked at first @@ -133,7 +133,7 @@ def test_application_placer_large_groups(): def test_application_placer_too_few_boards(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) @@ -155,7 +155,7 @@ def test_application_placer_too_few_boards(): def test_application_placer_restart_needed(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() for (x, y) in [(1, 0), (1, 1), (0, 1)]: fixed = SimpleTestVertex(15, f"FIXED {x}:{y}", max_atoms_per_core=1) @@ -173,7 +173,7 @@ def test_application_placer_restart_needed(): def test_application_placer_late_fixed(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() for i in range(56): _make_vertices(writer, 1000, 14, 5, f"app_vertex_{i}") @@ -191,7 +191,7 @@ def test_application_placer_late_fixed(): def test_application_placer_fill_chips(): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() # fixed early works as this vertex is looked at first fixed = SimpleTestVertex(10, "FIXED", max_atoms_per_core=1) diff --git a/unittests/operations_tests/router_algorithms_tests/test_routers.py b/unittests/operations_tests/router_algorithms_tests/test_routers.py index d27fa97f3..b77d178e7 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -625,7 +625,7 @@ def test_internal_only(params): def test_internal_and_split(params): algorithm, n_vertices, n_m_vertices = params unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split( diff --git a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index e80018e48..17d8ba794 100644 --- a/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py @@ -31,7 +31,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_onordered_pair_big(self): diff --git a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py index 1de9bfa58..455fee7b9 100644 --- a/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_ordered_covering_compression.py @@ -32,7 +32,7 @@ class TestOrderedCoveringCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_oc_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py index d03f09dfb..0b69868f3 100644 --- a/unittests/operations_tests/router_compressor_tests/test_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_pair_compression.py @@ -31,7 +31,7 @@ class TestPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def do_pair_big(self, c_sort): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py index 8114fc4a3..7aabbf7eb 100644 --- a/unittests/operations_tests/router_compressor_tests/test_range_compressor.py +++ b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py @@ -32,7 +32,7 @@ class TestRangeCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) set_config( "Mapping", "router_table_compress_as_far_as_possible", True) diff --git a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py index 01934f170..957286c13 100644 --- a/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py +++ b/unittests/operations_tests/router_compressor_tests/test_unordered_pair_compression.py @@ -32,7 +32,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.WRAPPABLE.value) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_onordered_pair_big(self): class_file = sys.modules[self.__module__].__file__ diff --git a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py index 394e8edac..a0826cb39 100644 --- a/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py +++ b/unittests/operations_tests/tag_allocator_tests/test_tags_board_addresses.py @@ -33,7 +33,7 @@ class TestTagsBoardAddresses(unittest.TestCase): """ def setUp(self): unittest_setup() - set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.value) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) def test_ip_tags(self): writer = PacmanDataWriter.mock() From a07c23354d4e043bdfc6c2f08f4e61e016d70705 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 17 Apr 2024 07:05:23 +0100 Subject: [PATCH 16/16] fix add_monitor_core to all_cores --- pacman/data/pacman_data_writer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pacman/data/pacman_data_writer.py b/pacman/data/pacman_data_writer.py index 0ad116b69..4f9aa2040 100644 --- a/pacman/data/pacman_data_writer.py +++ b/pacman/data/pacman_data_writer.py @@ -180,7 +180,7 @@ def add_edge(cls, edge: ApplicationEdge, cls.__pacman_data._graph.add_edge(edge, outgoing_edge_partition_name) def add_sample_monitor_vertex( - self, vertex: MachineVertex, all_cores: bool): + self, vertex: MachineVertex, all_chips: bool): """ Accepts a simple of the monitor cores to be added. @@ -192,13 +192,13 @@ def add_sample_monitor_vertex( :param ~pacman.model.graphs.machine.MachineVertex vertex: One of the vertices added to each core, assumed to be typical of all. - :param bool all_cores: - If True assumes that this Vertex will be placed on all cores + :param bool all_chips: + If True assumes that this Vertex will be placed on all chips including Ethernet ones. If False assumes that this Vertex type will only be placed on Ethernet Vertices """ - self.add_monitor_core(all_cores) + self.add_monitor_core(all_chips) self.__pacman_data._ethernet_monitor_vertices.append(vertex) - if all_cores: + if all_chips: self.__pacman_data._all_monitor_vertices.append(vertex)