def test_create_empty_core_subset_add_processor(self): proc_list = [0,1,2,3,5,8,13] cs = CoreSubset(0,0,[]) self.assertEqual(cs.x,0) self.assertEqual(cs.y,0) for proc in proc_list: cs.add_processor(proc) for proc in cs.processor_ids: self.assertIn(proc, proc_list) self.assertEqual(len(cs.processor_ids),len(proc_list))
def get_core_subset_for_chip(self, x, y): """ Get the core subset for a chip :param x: The x-coordinate of a chip :type x: int :param y: The y-coordinate of a chip :type y: int :return: The core subset of a chip, which will be empty if not added :rtype: :py:class:`spinnman.model.core_subset.CoreSubset` """ if (x, y) not in self._core_subsets: return CoreSubset(x, y, []) return self._core_subsets[(x, y)]
def add_processor(self, x, y, processor_id): """ Add a processor on a given chip to the set :param x: The x-coordinate of the chip :type x: int :param y: The y-coordinate of the chip :type y: int :param processor_id: A processor id :type processor_id: int :return: Nothing is returned :rtype: None :raise spinnman.exceptions.SpinnmanInvalidParameterException: If there\ is already a processor on the given chip with the same id """ if (x, y) not in self._core_subsets: self.add_core_subset(CoreSubset(x, y, [])) self._core_subsets[(x, y)].add_processor(processor_id)
def _sort_out_downed_chips_cores(downed_chips, downed_cores): """ Translate the down cores and down chips string into a form that \ spinnman can understand :param downed_cores: string representing down cores :type downed_cores: str :param downed_chips: string representing down chips :type: downed_chips: str :return: a list of down cores and down chips in processor and \ core subset format """ ignored_chips = None ignored_cores = None if downed_chips is not None and downed_chips != "None": ignored_chips = CoreSubsets() for downed_chip in downed_chips.split(":"): x, y = downed_chip.split(",") ignored_chips.add_core_subset(CoreSubset(int(x), int(y), [])) if downed_cores is not None and downed_cores != "None": ignored_cores = CoreSubsets() for downed_core in downed_cores.split(":"): x, y, processor_id = downed_core.split(",") ignored_cores.add_processor(int(x), int(y), int(processor_id)) return ignored_chips, ignored_cores
enable_reinjection = True iptags.append(IPTag("192.168.240.253", 0, "0.0.0.0", 17896, True)) application_data.append( ReloadApplicationData("192.168.240.253_appData_0_0_1.dat", 0, 0, 1, 1612972032)) application_data.append( ReloadApplicationData("192.168.240.253_appData_0_0_2.dat", 0, 0, 2, 1612989276)) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table( reload_routing_table.reload("picked_routing_table_for_0_0")) binaries.add_subsets( "C:\\Python27\\lib\\site-packages\\spynnaker\\pyNN\\model_binaries\\IF_curr_exp.aplx", CoreSubsets([ CoreSubset(0, 0, [ 2, ]), ])) binaries.add_subsets( "C:\\Python27\\lib\\site-packages\\spinn_front_end_common\\common_model_binaries\\reverse_iptag_multicast_source.aplx", CoreSubsets([ CoreSubset(0, 0, [ 1, ]), ])) vertex = ReloadBufferedVertex("inputSpikes_On:0:255", [(2, "inputSpikes_On_0_255_2", 1048576)]) buffered_placements.add_placement(Placement(vertex, 0, 0, 1)) buffered_tags.add_ip_tag(IPTag("192.168.240.253", 0, "0.0.0.0", 17896, True), vertex)
number_of_boards = 1 height = None width = None auto_detect_bmp = False enable_reinjection = True iptags.append( IPTag("192.168.240.253", 0, "0.0.0.0", 17896, True)) application_data.append(ReloadApplicationData( "192.168.240.253_appData_0_0_1.dat", 0, 0, 1, 1612972032)) application_data.append(ReloadApplicationData( "192.168.240.253_appData_0_0_2.dat", 0, 0, 2, 1612987952)) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table(reload_routing_table.reload("picked_routing_table_for_0_0")) binaries.add_subsets("C:\\Python27\\lib\\site-packages\\spynnaker\\pyNN\\model_binaries\\IF_curr_exp.aplx", CoreSubsets([CoreSubset(0, 0, [2, ]),])) binaries.add_subsets("C:\\Python27\\lib\\site-packages\\spinn_front_end_common\\common_model_binaries\\reverse_iptag_multicast_source.aplx", CoreSubsets([CoreSubset(0, 0, [1, ]),])) vertex = ReloadBufferedVertex("inputSpikes_On:0:255", [(2, "inputSpikes_On_0_255_2", 1048576) ]) buffered_placements.add_placement(Placement(vertex, 0, 0, 1)) buffered_tags.add_ip_tag(IPTag("192.168.240.253", 0, "0.0.0.0", 17896, True), vertex) reloader = Reload(machine_name, machine_version, reports_states, bmp_details, down_chips, down_cores, number_of_boards, height, width, auto_detect_bmp,enable_reinjection) if len(socket_addresses) > 0: reloader.execute_notification_protocol_read_messages(socket_addresses, None, os.path.join(os.path.dirname(os.path.abspath(__file__)), "input_output_database.db")) reloader.reload_application_data(application_data) reloader.reload_routes(routing_tables) reloader.reload_tags(iptags, reverse_iptags) reloader.reload_binaries(binaries) reloader.enable_buffer_manager(buffered_placements, buffered_tags) reloader.restart(binaries, 4000, 1, turn_off_machine=True)
reload_routing_table.reload("picked_routing_table_for_0_0")) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table( reload_routing_table.reload("picked_routing_table_for_1_1")) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table( reload_routing_table.reload("picked_routing_table_for_0_1")) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table( reload_routing_table.reload("picked_routing_table_for_1_0")) binaries.add_subsets( "C:\\Python27\\lib\\site-packages\\spynnaker\\pyNN\\model_binaries\\IF_curr_exp.aplx", CoreSubsets([ CoreSubset(0, 1, [ 1, 3, 5, 7, ]), CoreSubset(1, 1, [ 1, 3, 5, 7, 9, 11, 13, 15, ]), CoreSubset(1, 0, [ 13, 15,
buffered_tags = Tags() buffered_placements = Placements() routing_tables = MulticastRoutingTables() # database params socket_addresses = list() reports_states = ReportState(False, False, False, False, False, False, False, False, False, False) machine_name = "192.168.240.253" machine_version = 3 bmp_details = "None" down_chips = "None" down_cores = "None" number_of_boards = 1 height = None width = None auto_detect_bmp = False enable_reinjection = True iptags.append( IPTag("192.168.240.253", 0, "0.0.0.0", 17896, True)) application_data.append(ReloadApplicationData( "192.168.240.253_appData_0_0_1.dat", 0, 0, 1, 1612972032)) application_data.append(ReloadApplicationData( "192.168.240.253_appData_0_0_2.dat", 0, 0, 2, 1612991232)) reload_routing_table = ReloadRoutingTable() routing_tables.add_routing_table(reload_routing_table.reload("picked_routing_table_for_0_0")) binaries.add_subsets("C:\\Python27\\lib\\site-packages\\spynnaker\\pyNN\\model_binaries\\IF_curr_exp.aplx", CoreSubsets([CoreSubset(0, 0, [2, ]),]))