def get_core_subsets(core_infos): """ Convert core information from get_cores_in_state to core_subset objects """ core_subsets = CoreSubsets() for (x, y, p) in core_infos: core_subsets.add_processor(x, y, p) return core_subsets
def add_binary(self, binary): """ Add a binary to the list of things to execute :param binary: The binary to add """ if binary not in self._targets: self._targets[binary] = CoreSubsets() else: raise exceptions.ConfigurationException( "Binary {} already added".format(binary))
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)
def spinnaker_based_data_specification_execution(self, write_memory_map_report, dsg_targets, transceiver, dse_app_id, app_id): """ :param write_memory_map_report: :param dsg_targets: :param transceiver: :param dse_app_id: :param app_id: :return: """ # create a progress bar for end users progress_bar = ProgressBar(len(dsg_targets), "Loading data specifications") number_of_cores_used = 0 core_subset = CoreSubsets() for (x, y, p, label) in dsg_targets: core_subset.add_processor(x, y, p) dse_data_struct_address = transceiver.malloc_sdram( x, y, constants.DSE_DATA_STRUCT_SIZE, dse_app_id) data_spec_file_path = dsg_targets[x, y, p, label] data_spec_file_size = os.path.getsize(data_spec_file_path) application_data_file_reader = FileDataReader(data_spec_file_path) base_address = transceiver.malloc_sdram(x, y, data_spec_file_size, dse_app_id) dse_data_struct_data = struct.pack("<4I", base_address, data_spec_file_size, app_id, write_memory_map_report) transceiver.write_memory(x, y, dse_data_struct_address, dse_data_struct_data, len(dse_data_struct_data)) transceiver.write_memory(x, y, base_address, application_data_file_reader, data_spec_file_size) # data spec file is written at specific address (base_address) # this is encapsulated in a structure with four fields: # 1 - data specification base address # 2 - data specification file size # 3 - future application ID # 4 - store data for memory map report (True / False) # If the memory map report is going to be produced, the # address of the structure is returned in user1 user_0_address = transceiver.\ get_user_0_register_address_from_core(x, y, p) transceiver.write_memory(x, y, user_0_address, dse_data_struct_address, 4) progress_bar.update() progress_bar.end() # Execute the DSE on all the cores logger.info("Loading the Data Specification Executor") dse_exec = os.path.join(os.path.dirname(spec_sender.__file__), 'data_specification_executor.aplx') file_reader = FileDataReader(dse_exec) size = os.stat(dse_exec).st_size transceiver.execute_flood(core_subset, file_reader, app_id, size) logger.info( "Waiting for On-chip Data Specification Executor to complete") processors_exited = transceiver.get_core_state_count( dse_app_id, CPUState.FINISHED) while processors_exited < number_of_cores_used: processors_errored = transceiver.get_core_state_count( dse_app_id, CPUState.RUN_TIME_EXCEPTION) if processors_errored > 0: error_cores = helpful_functions.get_cores_in_state( core_subset, CPUState, transceiver) if len(error_cores) > 0: error = helpful_functions.get_core_status_string( error_cores) raise Exception( "Data Specification Execution has failed: {}".format( error)) time.sleep(1) processors_exited = transceiver.get_core_state_count( dse_app_id, CPUState.FINISHED) transceiver.stop_application(dse_app_id) logger.info("On-chip Data Specification Executor completed") return {"LoadedApplicationDataToken": True}
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, ]), ])) binaries.add_subsets( "C:\\Python27\\lib\\site-packages\\spynnaker\\pyNN\\model_binaries\\IF_curr_exp_stdp_mad_nearest_pair_multiplicative.aplx", CoreSubsets([ CoreSubset(0, 1, [ 8,
def __init__(self): self._targets = dict() self._total_processors = 0 self._all_core_subsets = CoreSubsets()
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, ]),]))