def _request_data(self, transceiver, placement_x, placement_y, address, length): """ Uses the extra monitor cores for data extraction. :param transceiver: the spinnman interface :param placement_x: \ the placement x coord where data is to be extracted from :param placement_y: \ the placement y coord where data is to be extracted from :param address: the memory address to start at :param length: the number of bytes to extract :return: data as a byte array """ # pylint: disable=too-many-arguments if not self._uses_advanced_monitors: return transceiver.read_memory(placement_x, placement_y, address, length) sender = self._extra_monitor_cores_by_chip[placement_x, placement_y] receiver = funs.locate_extra_monitor_mc_receiver( self._machine, placement_x, placement_y, self._extra_monitor_cores_to_ethernet_connection_map) return receiver.get_data( transceiver, self._placements.get_placement_of_vertex(sender), address, length, self._fixed_routes)
def __get_projection_data(self, data_to_get, pre_vertex, post_vertex, connection_holder, handle_time_out_configuration): # pylint: disable=too-many-arguments, too-many-locals ctl = self._spinnaker_control # if using extra monitor functionality, locate extra data items if ctl.get_generated_output("UsingAdvancedMonitorSupport"): extra_monitors = ctl.get_generated_output( "MemoryExtraMonitorVertices") receivers = ctl.get_generated_output( "MemoryMCGatherVertexToEthernetConnectedChipMapping") extra_monitor_placements = ctl.get_generated_output( "MemoryExtraMonitorToChipMapping") else: extra_monitors = None receivers = None extra_monitor_placements = None edges = ctl.graph_mapper.get_machine_edges(self._projection_edge) progress = ProgressBar( edges, "Getting {}s for projection between {} and {}".format( data_to_get, pre_vertex.label, post_vertex.label)) for edge in progress.over(edges): placement = ctl.placements.get_placement_of_vertex( edge.post_vertex) # if using extra monitor data extractor find local receiver if extra_monitors is not None: receiver = helpful_functions.locate_extra_monitor_mc_receiver( placement_x=placement.x, placement_y=placement.y, machine=ctl.machine, extra_monitor_cores_to_ethernet_connection_map=receivers) sender_extra_monitor_core = extra_monitor_placements[ placement.x, placement.y] sender_monitor_place = ctl.placements.get_placement_of_vertex( sender_extra_monitor_core) else: receiver = None sender_monitor_place = None connections = post_vertex.get_connections_from_machine( ctl.transceiver, placement, edge, ctl.graph_mapper, ctl.routing_infos, self._synapse_information, ctl.machine_time_step, extra_monitors is not None, ctl.placements, receiver, sender_monitor_place, extra_monitors, handle_time_out_configuration, ctl.fixed_routes) if connections is not None: connection_holder.add_connections(connections) connection_holder.finish()
def __get_projection_data( self, data_to_get, pre_vertex, post_vertex, connection_holder, handle_time_out_configuration): # pylint: disable=too-many-arguments, too-many-locals ctl = self._spinnaker_control # if using extra monitor functionality, locate extra data items if ctl.get_generated_output("UsingAdvancedMonitorSupport"): extra_monitors = ctl.get_generated_output( "MemoryExtraMonitorVertices") receivers = ctl.get_generated_output( "MemoryMCGatherVertexToEthernetConnectedChipMapping") extra_monitor_placements = ctl.get_generated_output( "MemoryExtraMonitorToChipMapping") else: extra_monitors = None receivers = None extra_monitor_placements = None edges = ctl.graph_mapper.get_machine_edges(self._projection_edge) progress = ProgressBar( edges, "Getting {}s for projection between {} and {}".format( data_to_get, pre_vertex.label, post_vertex.label)) for edge in progress.over(edges): placement = ctl.placements.get_placement_of_vertex( edge.post_vertex) # if using extra monitor data extractor find local receiver if extra_monitors is not None: receiver = helpful_functions.locate_extra_monitor_mc_receiver( placement_x=placement.x, placement_y=placement.y, machine=ctl.machine, packet_gather_cores_to_ethernet_connection_map=receivers) sender_extra_monitor_core = extra_monitor_placements[ placement.x, placement.y] sender_monitor_place = ctl.placements.get_placement_of_vertex( sender_extra_monitor_core) else: receiver = None sender_monitor_place = None connections = post_vertex.get_connections_from_machine( ctl.transceiver, placement, edge, ctl.graph_mapper, ctl.routing_infos, self._synapse_information, ctl.machine_time_step, extra_monitors is not None, ctl.placements, receiver, sender_monitor_place, extra_monitors, handle_time_out_configuration, ctl.fixed_routes) if connections is not None: connection_holder.add_connections(connections) connection_holder.finish()
def __old_get_data_for_placements_with_monitors(self, placements, progress): # locate receivers receivers = list( OrderedSet( locate_extra_monitor_mc_receiver( self._machine, placement.x, placement.y, self._packet_gather_cores_to_ethernet_connection_map) for placement in placements)) # Ugly, to avoid an import loop... with receivers[0].streaming(receivers, self._transceiver, self._extra_monitor_cores, self._placements): # get data self.__old_get_data_for_placements(placements, progress)
def _get_data_for_vertices_locked(self, vertices, progress=None): receivers = OrderedSet() if self._uses_advanced_monitors: # locate receivers for vertex in vertices: placement = self._placements.get_placement_of_vertex(vertex) receivers.add( funs.locate_extra_monitor_mc_receiver( self._machine, placement.x, placement.y, self._extra_monitor_cores_to_ethernet_connection_map)) # set time out for receiver in receivers: receiver.set_cores_for_data_extraction( transceiver=self._transceiver, placements=self._placements, extra_monitor_cores_for_router_timeout=( self._extra_monitor_cores)) # get data for vertex in vertices: placement = self._placements.get_placement_of_vertex(vertex) for recording_region_id in vertex.get_recorded_region_ids(): self.get_data_for_vertex(placement, recording_region_id) if progress is not None: progress.update() # revert time out if self._uses_advanced_monitors: for receiver in receivers: receiver.unset_cores_for_data_extraction( transceiver=self._transceiver, placements=self._placements, extra_monitor_cores_for_router_timeout=( self._extra_monitor_cores))