From 0923ac59ebb0892b46b850024abf0d5cac0494c1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 10 Apr 2024 16:28:20 +0100 Subject: [PATCH 1/5] test with as many versions as possible --- unittests/model_tests/neuron/test_synaptic_manager.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/unittests/model_tests/neuron/test_synaptic_manager.py b/unittests/model_tests/neuron/test_synaptic_manager.py index aefd540c23..9f88db2f26 100644 --- a/unittests/model_tests/neuron/test_synaptic_manager.py +++ b/unittests/model_tests/neuron/test_synaptic_manager.py @@ -21,6 +21,7 @@ from spinn_utilities.overrides import overrides from spinn_utilities.config_holder import set_config +from spinn_machine.version import ANY_VERSION, FOUR_PLUS_CHIPS from spinnman.transceiver.mockable_transceiver import MockableTransceiver from spinnman.transceiver import Transceiver from pacman.model.placements import Placement @@ -103,7 +104,7 @@ def say_false(self, *args, **kwargs): def test_write_data_spec(): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", ANY_VERSION) writer = SpynnakerDataWriter.mock() # UGLY but the mock transceiver NEED generate_on_machine to be False AbstractGenerateConnectorOnMachine.generate_on_machine = say_false @@ -433,7 +434,7 @@ def test_pop_based_master_pop_table_standard( undelayed_indices_connected, delayed_indices_connected, n_pre_neurons, neurons_per_core, max_delay): unittest_setup() - set_config("Machine", "version", 5) + set_config("Machine", "version", FOUR_PLUS_CHIPS) writer = SpynnakerDataWriter.mock() # Build a from list connector with the delays we want @@ -476,7 +477,7 @@ def test_pop_based_master_pop_table_standard( # Generate the data with DsSqlliteDatabase() as db: - spec = DataSpecificationGenerator(1, 2, 3, post_mac_vertex, db) + spec = DataSpecificationGenerator(1, 0, 3, post_mac_vertex, db) regions = SynapseRegions( synapse_params=5, synapse_dynamics=6, structural_dynamics=7, @@ -494,7 +495,7 @@ def test_pop_based_master_pop_table_standard( spec, post_vertex_slice, references) # Read the population table and check entries - info = list(db.get_region_pointers_and_content(1, 2, 3)) + info = list(db.get_region_pointers_and_content(1, 0, 3)) region, _, region_data = info[1] assert region == 3 mpop_data = numpy.frombuffer(region_data, dtype="uint8").view("uint32") From 14631d16dbd25c4244419e61004b24a62f8bd812 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 11 Apr 2024 17:03:34 +0100 Subject: [PATCH 2/5] get board size from script --- unittests/test_integration_using_virtual_board/spynnaker.cfg | 2 -- unittests/test_using_virtual_board/spynnaker.cfg | 2 -- .../test_using_virtual_board/test_debug_mode/spynnaker.cfg | 2 -- .../test_do_not_allow_violate/spynnaker.cfg | 2 -- .../test_virtual_board_no_vertices_supported/spynnaker.cfg | 2 -- 5 files changed, 10 deletions(-) diff --git a/unittests/test_integration_using_virtual_board/spynnaker.cfg b/unittests/test_integration_using_virtual_board/spynnaker.cfg index 335162ae6a..c59b9f799f 100644 --- a/unittests/test_integration_using_virtual_board/spynnaker.cfg +++ b/unittests/test_integration_using_virtual_board/spynnaker.cfg @@ -1,7 +1,5 @@ [Machine] machine_spec_file = None -width = 8 -height = 8 version = 5 virtual_board = True machineName = None diff --git a/unittests/test_using_virtual_board/spynnaker.cfg b/unittests/test_using_virtual_board/spynnaker.cfg index 4dba76cacc..55e93a4de2 100644 --- a/unittests/test_using_virtual_board/spynnaker.cfg +++ b/unittests/test_using_virtual_board/spynnaker.cfg @@ -1,6 +1,4 @@ [Machine] -width = 8 -height = 8 version = 5 virtual_board = True machineName = None diff --git a/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg b/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg index e9fddb84e1..1da9d921fe 100644 --- a/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg +++ b/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg @@ -1,6 +1,4 @@ [Machine] -width = 8 -height = 8 version = 5 virtual_board = True machineName = None diff --git a/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg b/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg index 9a51f0d386..3b71a848b0 100644 --- a/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg +++ b/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg @@ -1,7 +1,5 @@ [Machine] machine_spec_file = None -width = 8 -height = 8 version = 5 virtual_board = True machineName = None diff --git a/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg b/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg index 091aad3dda..317467ceb0 100644 --- a/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg +++ b/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg @@ -1,7 +1,5 @@ [Machine] virtual_board = True -width = 8 -height = 8 version = 5 machine_name = None remote_spinnaker_url = None From c25a43160e30a9d0ddf5014f5ec825040608ea93 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 07:47:38 +0100 Subject: [PATCH 3/5] use n_boards_required for size of virtual board --- unittests/test_sata_connectors/spynnaker.cfg | 4 +--- .../test_sata_2_different_boards_valid_board_address.py | 2 +- unittests/test_spinnaker_link_connectors/spynnaker.cfg | 4 +--- ...t_spinnaker_link_2_different_boards_valid_board_address.py | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/unittests/test_sata_connectors/spynnaker.cfg b/unittests/test_sata_connectors/spynnaker.cfg index e057b5fbba..5c9fd4dce3 100644 --- a/unittests/test_sata_connectors/spynnaker.cfg +++ b/unittests/test_sata_connectors/spynnaker.cfg @@ -2,7 +2,7 @@ machine_spec_file = None machineName = None -version = None +version = 5 remote_spinnaker_url = None @@ -14,8 +14,6 @@ virtual_board = True down_cores = None down_chips = None down_links = 2,5,2:2,5,3:6,1,2:6,1,3:10,9,2:10,9,3 -width = 12 -height = 12 [Mode] # mode = Production or Debug diff --git a/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py b/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py index 7c92f55dab..95412d191f 100644 --- a/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py +++ b/unittests/test_sata_connectors/test_sata_2_different_boards_valid_board_address.py @@ -22,7 +22,7 @@ def do_run(): # Setup - p.setup(timestep=1.0) + p.setup(timestep=1.0, n_boards_required=3) src_1 = p.Population( None, diff --git a/unittests/test_spinnaker_link_connectors/spynnaker.cfg b/unittests/test_spinnaker_link_connectors/spynnaker.cfg index 19f5a4c7da..59830f0282 100644 --- a/unittests/test_spinnaker_link_connectors/spynnaker.cfg +++ b/unittests/test_spinnaker_link_connectors/spynnaker.cfg @@ -1,13 +1,11 @@ [Machine] spalloc_server = None machineName = None -version = None +version = 5 virtual_board = True down_cores = None down_chips = None down_links = 0,0,4:4,8,4:8,4,4 -width = 12 -height = 12 [Mode] # mode = Production or Debug diff --git a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py index 8d6a8fc0ec..18245762ac 100644 --- a/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py +++ b/unittests/test_spinnaker_link_connectors/test_spinnaker_link_2_different_boards_valid_board_address.py @@ -22,7 +22,7 @@ def do_run(): # Setup - p.setup(timestep=1.0) + p.setup(timestep=1.0, n_boards_required=3) # FPGA Retina retina_device = p.external_devices.ExternalFPGARetinaDevice From 8ef9f6ad67ce91ca2996fa37a85c4cbe5cfb1f81 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 15:10:07 +0100 Subject: [PATCH 4/5] VersionStrings --- unittests/model_tests/neuron/test_synaptic_manager.py | 6 +++--- .../test_integration_using_virtual_board/spynnaker.cfg | 3 ++- unittests/test_sata_connectors/spynnaker.cfg | 3 ++- unittests/test_spinnaker_link_connectors/spynnaker.cfg | 3 ++- unittests/test_using_virtual_board/spynnaker.cfg | 3 ++- unittests/test_using_virtual_board/test_constraint.py | 10 +++++++--- .../test_debug_mode/spynnaker.cfg | 3 ++- .../test_do_not_allow_violate/spynnaker.cfg | 3 ++- .../spynnaker.cfg | 3 ++- 9 files changed, 24 insertions(+), 13 deletions(-) diff --git a/unittests/model_tests/neuron/test_synaptic_manager.py b/unittests/model_tests/neuron/test_synaptic_manager.py index 9f88db2f26..ba1685b469 100644 --- a/unittests/model_tests/neuron/test_synaptic_manager.py +++ b/unittests/model_tests/neuron/test_synaptic_manager.py @@ -21,7 +21,7 @@ from spinn_utilities.overrides import overrides from spinn_utilities.config_holder import set_config -from spinn_machine.version import ANY_VERSION, FOUR_PLUS_CHIPS +from spinn_machine.version.version_strings import VersionStrings from spinnman.transceiver.mockable_transceiver import MockableTransceiver from spinnman.transceiver import Transceiver from pacman.model.placements import Placement @@ -104,7 +104,7 @@ def say_false(self, *args, **kwargs): def test_write_data_spec(): unittest_setup() - set_config("Machine", "version", ANY_VERSION) + set_config("Machine", "versions", VersionStrings.ANY.value) writer = SpynnakerDataWriter.mock() # UGLY but the mock transceiver NEED generate_on_machine to be False AbstractGenerateConnectorOnMachine.generate_on_machine = say_false @@ -434,7 +434,7 @@ def test_pop_based_master_pop_table_standard( undelayed_indices_connected, delayed_indices_connected, n_pre_neurons, neurons_per_core, max_delay): unittest_setup() - set_config("Machine", "version", FOUR_PLUS_CHIPS) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) writer = SpynnakerDataWriter.mock() # Build a from list connector with the delays we want diff --git a/unittests/test_integration_using_virtual_board/spynnaker.cfg b/unittests/test_integration_using_virtual_board/spynnaker.cfg index c59b9f799f..25e99500e4 100644 --- a/unittests/test_integration_using_virtual_board/spynnaker.cfg +++ b/unittests/test_integration_using_virtual_board/spynnaker.cfg @@ -1,6 +1,7 @@ [Machine] machine_spec_file = None -version = 5 +version = None +versions = Any virtual_board = True machineName = None spalloc_server = None diff --git a/unittests/test_sata_connectors/spynnaker.cfg b/unittests/test_sata_connectors/spynnaker.cfg index 5c9fd4dce3..774cf00ae8 100644 --- a/unittests/test_sata_connectors/spynnaker.cfg +++ b/unittests/test_sata_connectors/spynnaker.cfg @@ -2,7 +2,8 @@ machine_spec_file = None machineName = None -version = 5 +version = None +versions = Multiple boards remote_spinnaker_url = None diff --git a/unittests/test_spinnaker_link_connectors/spynnaker.cfg b/unittests/test_spinnaker_link_connectors/spynnaker.cfg index 59830f0282..d48942d7ae 100644 --- a/unittests/test_spinnaker_link_connectors/spynnaker.cfg +++ b/unittests/test_spinnaker_link_connectors/spynnaker.cfg @@ -1,7 +1,8 @@ [Machine] spalloc_server = None machineName = None -version = 5 +version = None +versions = Multiple boards virtual_board = True down_cores = None down_chips = None diff --git a/unittests/test_using_virtual_board/spynnaker.cfg b/unittests/test_using_virtual_board/spynnaker.cfg index 55e93a4de2..3cb76baf25 100644 --- a/unittests/test_using_virtual_board/spynnaker.cfg +++ b/unittests/test_using_virtual_board/spynnaker.cfg @@ -1,5 +1,6 @@ [Machine] -version = 5 +version = None +versions = ANY virtual_board = True machineName = None spalloc_server = None diff --git a/unittests/test_using_virtual_board/test_constraint.py b/unittests/test_using_virtual_board/test_constraint.py index 5fb64d3531..1749879397 100644 --- a/unittests/test_using_virtual_board/test_constraint.py +++ b/unittests/test_using_virtual_board/test_constraint.py @@ -28,11 +28,15 @@ def test_placement_constraint(self): """ sim.setup(timestep=1.0) + width, height = SpynnakerDataView.get_machine_version().board_shape + # pick and XY in the middle of the board + x = (width + 1) // 3 + y = (height + 1) // 3 set_config("Reports", "write_application_graph_placer_report", True) sim.set_number_of_neurons_per_core(sim.IF_curr_exp, 50) pop_1 = sim.Population(200, sim.IF_curr_exp(), label="pop_1") - pop_1.add_placement_constraint(x=1, y=1) + pop_1.add_placement_constraint(x=x, y=y) input = sim.Population(1, sim.SpikeSourceArray(spike_times=[0]), label="input") sim.Projection(input, pop_1, sim.AllToAllConnector(), @@ -44,5 +48,5 @@ def test_placement_constraint(self): sim.end() self.assertGreater(len(placements), 0) for pl in placements: - self.assertEqual(1, pl.x) - self.assertEqual(1, pl.y) + self.assertEqual(x, pl.x) + self.assertEqual(y, pl.y) diff --git a/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg b/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg index 1da9d921fe..4b658fa4ea 100644 --- a/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg +++ b/unittests/test_using_virtual_board/test_debug_mode/spynnaker.cfg @@ -1,5 +1,6 @@ [Machine] -version = 5 +version = None +versions = Any virtual_board = True machineName = None spalloc_server = None diff --git a/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg b/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg index 3b71a848b0..7eafa70775 100644 --- a/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg +++ b/unittests/test_using_virtual_board/test_do_not_allow_violate/spynnaker.cfg @@ -1,6 +1,7 @@ [Machine] machine_spec_file = None -version = 5 +version = None +versions = Any virtual_board = True machineName = None spalloc_server = None diff --git a/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg b/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg index 317467ceb0..2b66f0fd3d 100644 --- a/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg +++ b/unittests/test_virtual_board_no_vertices_supported/spynnaker.cfg @@ -1,6 +1,7 @@ [Machine] virtual_board = True -version = 5 +version = None +versions = Any machine_name = None remote_spinnaker_url = None spalloc_server = None From 79e174cc372e969622125540ac3c8f7fa992d903 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 12 Apr 2024 15:27:26 +0100 Subject: [PATCH 5/5] VersionStrings as simple Enum --- unittests/model_tests/neuron/test_synaptic_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittests/model_tests/neuron/test_synaptic_manager.py b/unittests/model_tests/neuron/test_synaptic_manager.py index ba1685b469..de49650bc6 100644 --- a/unittests/model_tests/neuron/test_synaptic_manager.py +++ b/unittests/model_tests/neuron/test_synaptic_manager.py @@ -104,7 +104,7 @@ def say_false(self, *args, **kwargs): def test_write_data_spec(): unittest_setup() - set_config("Machine", "versions", VersionStrings.ANY.value) + set_config("Machine", "versions", VersionStrings.ANY.text) writer = SpynnakerDataWriter.mock() # UGLY but the mock transceiver NEED generate_on_machine to be False AbstractGenerateConnectorOnMachine.generate_on_machine = say_false @@ -434,7 +434,7 @@ def test_pop_based_master_pop_table_standard( undelayed_indices_connected, delayed_indices_connected, n_pre_neurons, neurons_per_core, max_delay): unittest_setup() - set_config("Machine", "versions", VersionStrings.FOUR_PLUS.value) + set_config("Machine", "versions", VersionStrings.FOUR_PLUS.text) writer = SpynnakerDataWriter.mock() # Build a from list connector with the delays we want