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..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,14 +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.__pacman_data._ethernet_monitor_cores += 1 + self.add_monitor_core(all_chips) self.__pacman_data._ethernet_monitor_vertices.append(vertex) - if all_cores: - self.__pacman_data._all_monitor_cores += 1 + if all_chips: self.__pacman_data._all_monitor_vertices.append(vertex) 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..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 @@ -15,6 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version.version_strings import VersionStrings 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", 5) + 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 fa016d42f..83bad6205 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.version_strings import VersionStrings 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", 5) + 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 bc1d2a0f1..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 @@ -15,6 +15,7 @@ import unittest from spinn_utilities.config_holder import set_config +from spinn_machine.version.version_strings import VersionStrings 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", 5) + 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 f4fb92432..fb3f51e04 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.version_strings import VersionStrings 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", 5) + 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 2da335dce..fc502da36 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,8 @@ # 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 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 ( @@ -93,7 +94,7 @@ def _make_vertices( def test_application_placer(): unittest_setup() - set_config("Machine", "version", 5) + 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) @@ -103,29 +104,36 @@ 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_by_cores( + n_cores=writer.get_n_machine_vertices() * 1.2)) place_application_graph(Placements()) def test_application_placer_large_groups(): unittest_setup() - set_config("Machine", "version", 5) + 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 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_by_cores( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) def test_application_placer_too_few_boards(): unittest_setup() - set_config("Machine", "version", 5) + 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) @@ -135,7 +143,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_by_cores( + n_cores=writer.get_n_machine_vertices() / 2)) try: place_application_graph(Placements()) raise AssertionError("Error not raise") @@ -145,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", "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) @@ -156,13 +166,14 @@ 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_by_cores( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) def test_application_placer_late_fixed(): unittest_setup() - set_config("Machine", "version", 5) + 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}") @@ -173,13 +184,14 @@ 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_by_cores( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) def test_application_placer_fill_chips(): unittest_setup() - set_config("Machine", "version", 5) + 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) @@ -187,17 +199,20 @@ 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_by_cores( + n_cores=writer.get_n_machine_vertices())) place_application_graph(Placements()) def test_sdram_bigger_than_chip(): unittest_setup() - set_config("Machine", "version", 5) + 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", @@ -211,7 +226,7 @@ def test_sdram_bigger_than_chip(): def test_sdram_bigger_monitors(): unittest_setup() - set_config("Machine", "version", 5) + 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)) @@ -227,9 +242,10 @@ def test_sdram_bigger_monitors(): def test_more_cores_than_chip(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.ANY.text) 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") @@ -239,9 +255,10 @@ def test_more_cores_than_chip(): def test_more_cores_than_user(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.ANY.text) 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") @@ -251,14 +268,15 @@ def test_more_cores_than_user(): def test_more_cores_with_monitor(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() 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)) @@ -266,9 +284,10 @@ def test_more_cores_with_monitor(): def test_could_fit(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() 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..b77d178e7 100644 --- a/unittests/operations_tests/router_algorithms_tests/test_routers.py +++ b/unittests/operations_tests/router_algorithms_tests/test_routers.py @@ -13,7 +13,9 @@ # 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.version.version_strings import VersionStrings +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 @@ -434,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", "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") @@ -448,6 +450,8 @@ def test_simple(params): def test_self(params): algorithm, _n_vertices, n_m_vertices = params unittest_setup() + # 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") @@ -461,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", 5) + 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") @@ -477,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", 5) + 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}") @@ -494,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", 5) + 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}") @@ -510,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", 5) + 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, @@ -520,7 +524,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_by_cores( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -529,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", 5) + 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, @@ -538,7 +543,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_by_cores( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -547,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", 5) + 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}") @@ -603,13 +609,14 @@ 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", "versions", VersionStrings.ANY.text) writer = PacmanDataWriter.mock() _make_vertices_split( writer, 1000, 3, 2, 2, "app_vertex", internal_multicast=True) - writer.set_machine(virtual_machine(24, 24)) + 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) _check_edges(routing_tables) @@ -618,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", 5) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) writer = PacmanDataWriter.mock() for i in range(n_vertices): _make_vertices_split( @@ -629,7 +636,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_by_cores( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -638,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", 5) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() in_device = ApplicationSpiNNakerLinkVertex(100, 0) in_device.splitter = SplitterExternalDevice() @@ -662,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", 5) + set_config("Machine", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() in_device = ApplicationFPGAVertex( 100, [FPGAConnection(0, 0, None, None)], None) @@ -689,10 +697,9 @@ 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", "versions", VersionStrings.BIG.text) 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 +710,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_by_cores( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(place_application_graph(Placements())) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -711,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", 5) + 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") @@ -736,6 +745,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_by_cores( + n_cores=writer.get_n_machine_vertices())) writer.set_placements(placements) routing_tables = _route_and_time(algorithm) _check_edges(routing_tables) @@ -747,9 +758,9 @@ 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", "versions", VersionStrings.BIG.text) writer = PacmanDataWriter.mock() - writer.set_machine(virtual_machine(16, 16)) + 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") @@ -790,14 +801,14 @@ def _check_path(source, nodes_fixed, machine, target): def test_route_around(): unittest_setup() - set_config("Machine", "version", 5) + 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 # 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/router_compressor_tests/test_checked_unordered_pair_compression.py b/unittests/operations_tests/router_compressor_tests/test_checked_unordered_pair_compression.py index 67747d97c..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 @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +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) @@ -30,7 +31,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_onordered_pair_big(self): @@ -41,6 +42,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_compressors.py b/unittests/operations_tests/router_compressor_tests/test_compressors.py index 36cc57365..39d4ff8d9 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, RoutingEntry +from spinn_machine.version.version_strings import VersionStrings + from pacman.config_setup import unittest_setup from pacman.data import PacmanDataView from pacman.data.pacman_data_writer import PacmanDataWriter @@ -61,7 +63,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", "versions", VersionStrings.ANY.text) 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 1205c8436..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 @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +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 +32,7 @@ class TestOrderedCoveringCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_oc_big(self): class_file = sys.modules[self.__module__].__file__ @@ -41,6 +42,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..0b69868f3 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.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) @@ -30,7 +31,7 @@ class TestPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def do_pair_big(self, c_sort): class_file = sys.modules[self.__module__].__file__ @@ -39,6 +40,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_range_compressor.py b/unittests/operations_tests/router_compressor_tests/test_range_compressor.py index ce029feee..7aabbf7eb 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.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 @@ -31,7 +32,7 @@ class TestRangeCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + 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 f0dbf32e9..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 @@ -18,6 +18,7 @@ from spinn_utilities.config_holder import set_config from spinn_machine import virtual_machine +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 +32,7 @@ class TestUnorderedPairCompressor(unittest.TestCase): def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.WRAPPABLE.text) def test_onordered_pair_big(self): class_file = sys.modules[self.__module__].__file__ @@ -40,6 +41,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/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 302f99d88..8b353378d 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 190973db4..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 @@ -15,8 +15,10 @@ import unittest from collections import defaultdict from spinn_utilities.config_holder import set_config -from spinn_machine import virtual_machine +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 from pacman.data.pacman_data_writer import PacmanDataWriter from pacman.exceptions import PacmanNotFoundError from pacman.model.placements import Placement, Placements @@ -31,11 +33,11 @@ class TestTagsBoardAddresses(unittest.TestCase): """ def setUp(self): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "versions", VersionStrings.MULTIPLE_BOARDS.text) def test_ip_tags(self): writer = PacmanDataWriter.mock() - machine = virtual_machine(12, 12) + machine = virtual_machine_by_boards(3) writer.set_machine(machine) eth_chips = machine.ethernet_connected_chips vertices = [ @@ -119,8 +121,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 +159,22 @@ 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)) + machine = virtual_machine_by_boards(3) + 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)) + machine = virtual_machine_by_boards(3) + self.do_fixed_repeat_tag(machine) def do_reverse(self, machine): writer = PacmanDataWriter.mock() @@ -187,4 +192,5 @@ 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)) + machine = virtual_machine_by_boards(3) + self.do_reverse(machine) diff --git a/unittests/test_fixed_route_router.py b/unittests/test_fixed_route_router.py index aa93c3937..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 @@ -71,7 +72,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), @@ -103,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)