def _make_chip(self, chip_info, machine): """ Creates a chip from a ChipSummaryInfo structure. :param ChipSummaryInfo chip_info: The ChipSummaryInfo structure to create the chip from :return: The created chip :rtype: ~spinn_machine.Chip """ # Create the down cores set if any n_cores = min(chip_info.n_cores, Machine.max_cores_per_chip()) core_states = chip_info.core_states down_cores = self._ignore_cores_map.get((chip_info.x, chip_info.y), None) for i in range(1, n_cores): if core_states[i] != CPUState.IDLE: self._report_ignore("Not using core {}, {}, {} in state {}", chip_info.x, chip_info.y, i, core_states[i]) if down_cores is None: down_cores = set() down_cores.add(i) # Create the router router = self._make_router(chip_info, machine) # Create the chip's SDRAM object sdram_size = chip_info.largest_free_sdram_block max_sdram_size = get_config_int("Machine", "max_sdram_allowed_per_chip") if (max_sdram_size is not None and sdram_size > max_sdram_size): sdram_size = max_sdram_size sdram = SDRAM(size=sdram_size) # Create the chip return Chip(x=chip_info.x, y=chip_info.y, n_processors=n_cores, router=router, sdram=sdram, ip_address=chip_info.ethernet_ip_address, nearest_ethernet_x=chip_info.nearest_ethernet_x, nearest_ethernet_y=chip_info.nearest_ethernet_y, down_cores=down_cores, parent_link=chip_info.parent_link)
def __locate_destination(self, chip): """ Locate destination vertex on (Ethernet-connected) chip to send fixed data to :param ~spinn_machine.Chip chip: :return: processor ID as a int :rtype: int :raises PacmanConfigurationException: if no placement processor found """ x = chip.x y = chip.y for p in range(Machine.max_cores_per_chip()): # check if occupied and by the right vertex type if self._placements.is_processor_occupied(x, y, p) and isinstance( self._placements.get_vertex_on_processor(x, y, p), self._destination_class): return p raise PacmanConfigurationException( "no destination vertex found on Ethernet chip {}:{}".format( chip.x, chip.y))
def __call__(self, hbp_server_url, total_run_time, max_machine_core_reduction=0): """ :param str hbp_server_url: :param int total_run_time: :param int max_machine_core_reduction: :rtype: ~.Machine """ max_machine = self._max_machine_request(hbp_server_url, total_run_time) n_cpus_per_chip = (Machine.max_cores_per_chip() - max_machine_core_reduction) # Return the width and height and assume that it has wrap arounds return virtual_machine(width=max_machine["width"], height=max_machine["height"], n_cpus_per_chip=n_cpus_per_chip, validate=False)
def __call__( self, width=None, height=None, version=None, down_chips=None, down_cores=None, down_links=None, max_sdram_size=None, router_entries_per_chip=Router.ROUTER_DEFAULT_AVAILABLE_ENTRIES, json_path=None): """ :param int width: :param int height: :param int version: :param list(tuple(int,int)) down_chips: :param list(tuple(int,int,int)) down_cores: :param list(tuple(int,int,int)) down_links: :param int max_sdram_size: :param int router_entries_per_chip: :param str json_path: :rtype: ~.Machine :raises Exception: """ # For backward compatibility support version in csf files for now if version is not None: if version in [2, 3]: if height is None: height = 2 else: assert height == 2 if width is None: width = 2 else: assert width == 2 logger.warning("For virtual Machines version is deprecated." "use width=2, height=2 instead") elif version in [4, 5]: if height is None: height = 8 else: assert height == 8 if width is None: width = 8 else: assert width == 8 logger.warning("For virtual Machines version is deprecated." "use width=8, height=8 instead") else: raise Exception("Unknown version {}".format(version)) if json_path is None: # pylint: disable=too-many-arguments machine = virtual_machine( width=width, height=height, n_cpus_per_chip=Machine.max_cores_per_chip(), down_chips=down_chips, down_cores=down_cores, down_links=down_links, sdram_per_chip=max_sdram_size, router_entries_per_chip=router_entries_per_chip, validate=True) else: if (height is not None or width is not None or version is not None or down_chips is not None or down_cores is not None or down_links is not None): logger.warning("As json_path specified all other virtual " "machine settings ignored.") machine = json_machine.machine_from_json(json_path) # Work out and add the SpiNNaker links and FPGA links machine.add_spinnaker_links() machine.add_fpga_links() logger.info( "Created a virtual machine which has {}".format( machine.cores_and_link_output_string())) return machine