def __call__(self, router_tables, target_length=None): # build storage compressed_pacman_router_tables = MulticastRoutingTables() # create progress bar progress_bar = ProgressBar( len(router_tables.routing_tables), "Compressing routing Tables") # compress each router for router_table in router_tables.routing_tables: # convert to rig format entries = self._convert_to_mundy_format(router_table) # compress the router entries compressed_router_table_entries = \ rigs_compressor.minimise(entries, target_length) # convert back to pacman model compressed_pacman_table = self._convert_to_pacman_router_table( compressed_router_table_entries, router_table.x, router_table.y) # add to new compressed routing tables compressed_pacman_router_tables.add_routing_table( compressed_pacman_table) progress_bar.update() progress_bar.end() # return return {'routing_tables': compressed_pacman_router_tables}
def __call__(self, routing_infos, routing_table_by_partitions, machine): """ :param routing_infos: :param routing_table_by_partitions: :param machine: :return: """ progress_bar = ProgressBar(len(list(machine.chips)), "Generating routing tables") routing_tables = MulticastRoutingTables() for chip in machine.chips: partitions_in_table = routing_table_by_partitions.\ get_entries_for_router(chip.x, chip.y) if len(partitions_in_table) != 0: routing_table = MulticastRoutingTable(chip.x, chip.y) for partition in partitions_in_table: keys_and_masks = routing_infos.\ get_keys_and_masks_from_partition(partition) entry = partitions_in_table[partition] for key_and_mask in keys_and_masks: multicast_routing_entry = MulticastRoutingEntry( routing_entry_key=key_and_mask.key_combo, defaultable=entry.defaultable, mask=key_and_mask.mask, link_ids=entry.out_going_links, processor_ids=entry.out_going_processors) routing_table.add_mutlicast_routing_entry( multicast_routing_entry) routing_tables.add_routing_table(routing_table) progress_bar.update() progress_bar.end() return {"router_tables": routing_tables}
def test_new_multicast_routing_tables(self): key_combo = 0xff35 mask = 0xffff proc_ids = list() link_ids = list() for i in range(18): proc_ids.append(i) for i in range(6): link_ids.append(i) multicast_entries1 = MulticastRoutingEntry( key_combo, mask, proc_ids, link_ids, True) multicast_entries2 = MulticastRoutingEntry( key_combo - 1, mask - 1, proc_ids, link_ids, True) mrt = list() t1 = MulticastRoutingTable(0, 0, [multicast_entries1]) t2 = MulticastRoutingTable(1, 0, [multicast_entries2]) mrt.append(t1) mrt.append(t2) tables = MulticastRoutingTables(mrt) retrieved_tables = tables.routing_tables self.assertEqual(len(retrieved_tables), len(mrt)) for tab in retrieved_tables: self.assertIn(tab, mrt) self.assertEqual(tables.get_routing_table_for_chip(0, 0), t1) self.assertEqual(tables.get_routing_table_for_chip(1, 0), t2) self.assertEqual(tables.get_routing_table_for_chip(2, 0), None)
def __call__(self, router_tables): tables = MulticastRoutingTables() previous_masks = dict() progress = ProgressBar( len(router_tables.routing_tables) * 2, "Compressing Routing Tables") # Create all masks without holes allowed_masks = [0xFFFFFFFFL - ((2**i) - 1) for i in range(33)]
logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) for handler in logging.root.handlers: handler.setFormatter( logging.Formatter(fmt="%(asctime)-15s %(levelname)s: %(message)s", datefmt="%Y-%m-%d %H:%M:%S")) application_data = list() binaries = ExecutableTargets() iptags = list() reverse_iptags = list() 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
machine_name = "192.168.240.253" version = 3 bmp_details = "None" down_chips = "None" down_cores = "None" number_of_boards = None height = None width = None auto_detect_bmp = False enable_reinjection = True scamp_connection_data = "None" boot_port_num = None reset_machine_on_start_up = False max_sdram_per_chip = None router_tables = MulticastRoutingTables() iptags = list() reverse_iptags = list() app_data_runtime_folder = os.path.abspath( os.path.join(os.path.realpath("__file__"), os.pardir)) dsg_targets = dict() exec_dse_on_host = True dse_app_id = 31 buffered_tags = Tags() buffered_placements = Placements() wait_for_read_confirmation = True database_socket_addresses = list() database_file_path = r"/disk/users/mateev/catkin_ws/src/spinn_wrapper/src/spinn_wrapper/application_generated_data_files/latest/input_output_database.db" send_start_notification = True
def __call__(self, subgraph, placements, n_keys_map, routing_paths): """ Allocates routing information to the partitioned edges in a\ partitioned graph :param subgraph: The partitioned graph to allocate the routing info for :type subgraph:\ :py:class:`pacman.model.partitioned_graph.partitioned_graph.PartitionedGraph` :param placements: The placements of the subvertices :type placements:\ :py:class:`pacman.model.placements.placements.Placements` :param n_keys_map: A map between the partitioned edges and the number\ of keys required by the edges :type n_keys_map:\ :py:class:`pacman.model.routing_info.abstract_partitioned_edge_n_keys_map.AbstractPartitionedEdgeNKeysMap` :param routing_paths: the paths each partitioned edge takes to get\ from source to destination. :type routing_paths: :py:class:`pacman.model.routing_paths.multicast_routing_paths.MulticastRoutingPaths :return: The routing information :rtype: :py:class:`pacman.model.routing_info.routing_info.RoutingInfo`, :py:class:`pacman.model.routing_tables.multicast_routing_table.MulticastRoutingTable :raise pacman.exceptions.PacmanRouteInfoAllocationException: If\ something goes wrong with the allocation """ # check that this algorithm supports the constraints put onto the # partitioned_edges supported_constraints = [] utility_calls.check_algorithm_can_support_constraints( constrained_vertices=subgraph.subedges, supported_constraints=supported_constraints, abstract_constraint_type=AbstractKeyAllocatorConstraint) # take each subedge and create keys from its placement progress_bar = ProgressBar(len(subgraph.subedges), "Allocating routing keys") routing_infos = RoutingInfo() routing_tables = MulticastRoutingTables() for subedge in subgraph.subedges: destination = subedge.post_subvertex placement = placements.get_placement_of_subvertex(destination) key = self._get_key_from_placement(placement) keys_and_masks = list( [BaseKeyAndMask(base_key=key, mask=self.MASK)]) n_keys = n_keys_map.n_keys_for_partitioned_edge(subedge) if n_keys > self.MAX_KEYS_SUPPORTED: raise exceptions.PacmanConfigurationException( "Only edges which require less than {} keys are supported". format(self.MAX_KEYS_SUPPORTED)) partition_info = PartitionRoutingInfo(keys_and_masks, subedge) routing_infos.add_partition_info(partition_info) progress_bar.update() progress_bar.end() return { 'routing_infos': routing_infos, 'routing_tables': routing_tables }