From 894a5bc729421b479616af081306227dba9668fb Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Mon, 8 Apr 2024 07:08:50 +0100 Subject: [PATCH 1/4] 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 2/4] 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 3/4] 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 a07c23354d4e043bdfc6c2f08f4e61e016d70705 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 17 Apr 2024 07:05:23 +0100 Subject: [PATCH 4/4] 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)