def __init__(
            self, machine_name, version, reports_states, bmp_details,
            down_chips, down_cores, number_of_boards, height, width,
            auto_detect_bmp, enable_reinjection, xml_paths,
            scamp_connection_data, boot_port_num, placement_to_app_data_files,
            verify, router_tables, processor_to_app_data_base_address,
            executable_targets, tags, iptags, reverse_iptags, placements,
            app_folder, wait_for_read_confirmation, socket_addresses,
            database_file_path, runtime, time_scale_factor,
            send_start_notification, reset_machine_on_start_up,
            loading=True, running=True, app_id=30):

        if scamp_connection_data == "None":
            scamp_connection_data = None

        pacman_inputs = self._create_pacman_inputs(
            machine_name, version, reports_states, bmp_details,
            down_chips, down_cores, number_of_boards, height, width,
            auto_detect_bmp, enable_reinjection, app_id, scamp_connection_data,
            boot_port_num, placement_to_app_data_files, verify, router_tables,
            processor_to_app_data_base_address, executable_targets, tags,
            iptags, reverse_iptags, placements, app_folder,
            wait_for_read_confirmation, socket_addresses, database_file_path,
            runtime, time_scale_factor, send_start_notification,
            reset_machine_on_start_up, loading, running)
        pacman_outputs = self._create_pacman_outputs(loading, running)

        # get the list of algorithms expected to be used
        pacman_algorithms = self.create_list_of_algorithms(loading, running)

        # run the pacman executor
        helpful_functions.do_mapping(
            pacman_inputs, pacman_algorithms, pacman_outputs, xml_paths,
            False)
Exemple #2
0
    def run(self, run_time):
        """

        :param run_time:
        :return:
        """

        # calculate number of machine time steps
        self._calculate_number_of_machine_time_steps(run_time)

        self._runtime = run_time

        xml_paths = self._create_xml_paths()

        inputs = self._create_pacman_executor_inputs()
        required_outputs = self._create_pacman_executor_outputs()
        algorithms = self._create_algorithm_list(
            config.get("Mode", "mode") == "Debug")

        pacman_exeuctor = helpful_functions.do_mapping(
            inputs, algorithms, required_outputs, xml_paths,
            config.getboolean("Reports", "outputTimesForSections"))

        # gather provenance data from the executor itself if needed
        if config.get("Reports", "writeProvanceData"):
            pacman_executor_file_path = os.path.join(
                pacman_exeuctor.get_item("ProvenanceFilePath"),
                "PACMAN_provancence_data.xml")
            pacman_exeuctor.write_provenance_data_in_xml(
                pacman_executor_file_path,
                pacman_exeuctor.get_item("MemoryTransciever"))

        # sort out outputs data
        self._txrx = pacman_exeuctor.get_item("MemoryTransciever")
        self._placements = pacman_exeuctor.get_item("MemoryPlacements")
        self._router_tables = pacman_exeuctor.get_item("MemoryRoutingTables")
        self._routing_infos = pacman_exeuctor.get_item("MemoryRoutingInfos")
        self._tags = pacman_exeuctor.get_item("MemoryTags")
        self._graph_mapper = pacman_exeuctor.get_item("MemoryGraphMapper")
        self._partitioned_graph = pacman_exeuctor.get_item(
            "MemoryPartitionedGraph")
        self._machine = pacman_exeuctor.get_item("MemoryMachine")
        self._database_interface = pacman_exeuctor.get_item(
            "DatabaseInterface")
        self._has_ran = pacman_exeuctor.get_item("RanToken")
Exemple #3
0
    def reset(self):
        """ Code that puts the simulation back at time zero
        :return:
        """

        logger.info("Starting reset progress")

        inputs, application_graph_changed = \
            self._create_pacman_executor_inputs(
                this_run_time=0, is_resetting=True)

        if self._has_ran and application_graph_changed:
            raise common_exceptions.ConfigurationException(
                "Resetting the simulation after changing the model"
                " is not supported")

        algorithms = self._create_algorithm_list(
            config.get("Mode", "mode") == "Debug", application_graph_changed,
            executing_reset=True)
        xml_paths = self._create_xml_paths()
        required_outputs = self._create_pacman_executor_outputs(
            requires_reset=True,
            application_graph_changed=application_graph_changed)

        # rewind the buffers from the buffer manager, to start at the beginning
        # of the simulation again and clear buffered out
        self._buffer_manager.reset()

        # reset the current count of how many milliseconds the application
        # has ran for over multiple calls to run
        self._current_run_ms = 0

        # change number of resets as loading the binary again resets the sync\
        # to 0
        self._no_sync_changes = 0

        # sets the has ran into false state, to pretend that its like it has
        # not ran
        self._has_ran = False

        # sets the reset last flag to true, so that when run occurs, the tools
        # know to update the vertices which need to know a reset has occurred
        self._has_reset_last = True

        # reset the n_machine_time_steps from each vertex
        for vertex in self.partitionable_graph.vertices:
            vertex.set_no_machine_time_steps(0)

        # execute reset functionality
        helpful_functions.do_mapping(
            inputs, algorithms, required_outputs, xml_paths,
            config.getboolean("Reports", "outputTimesForSections"))

        # if graph has changed kill all old objects as they will need to be
        # rebuilt at next run
        if application_graph_changed:
            self._placements = self._router_tables = self._routing_infos = \
                self._tags = self._graph_mapper = self._partitioned_graph = \
                self._database_interface = self._executable_targets = \
                self._placement_to_app_data_file_paths = \
                self._processor_to_app_data_base_address_mapper = None
Exemple #4
0
    def run(self, run_time):
        """

        :param run_time:
        :return:
        """
        logger.info("Starting execution process")

        # calculate number of machine time steps
        total_run_time = self._calculate_number_of_machine_time_steps(run_time)

        # Calculate the first machine time step to start from and set this
        # where necessary
        first_machine_time_step = int(math.ceil(
            (self._current_run_ms * 1000.0) / self._machine_time_step))
        for vertex in self._partitionable_graph.vertices:
            if isinstance(vertex, AbstractHasFirstMachineTimeStep):
                vertex.set_first_machine_time_step(first_machine_time_step)

        # get inputs
        inputs, application_graph_changed = \
            self._create_pacman_executor_inputs(run_time)

        if application_graph_changed and self._has_ran:
            raise common_exceptions.ConfigurationException(
                "Changes to the application graph are not currently supported;"
                " please instead call p.reset(), p.end(), add changes and then"
                " call p.setup()")

        # if the application graph has changed and you've already ran, kill old
        # stuff running on machine
        if application_graph_changed and self._has_ran:
            self._txrx.stop_application(self._app_id)

        # get outputs
        required_outputs = self._create_pacman_executor_outputs(
            requires_reset=False,
            application_graph_changed=application_graph_changed)

        # algorithms listing
        algorithms = self._create_algorithm_list(
            config.get("Mode", "mode") == "Debug", application_graph_changed,
            executing_reset=False)

        # xml paths to the algorithms metadata
        xml_paths = self._create_xml_paths()

        # run pacman executor
        pacman_exeuctor = helpful_functions.do_mapping(
            inputs, algorithms, required_outputs, xml_paths,
            config.getboolean("Reports", "outputTimesForSections"))

        # gather provenance data from the executor itself if needed
        if (config.get("Reports", "writeProvanceData") and
                not config.getboolean("Machine", "virtual_board")):
            pacman_executor_file_path = os.path.join(
                pacman_exeuctor.get_item("ProvenanceFilePath"),
                "PACMAN_provancence_data.xml")
            pacman_exeuctor.write_provenance_data_in_xml(
                pacman_executor_file_path,
                pacman_exeuctor.get_item("MemoryTransciever"))

        # sort out outputs data
        if application_graph_changed:
            self._update_data_structures_from_pacman_exeuctor(pacman_exeuctor)
        else:
            self._no_sync_changes = pacman_exeuctor.get_item("NoSyncChanges")
            self._has_ran = pacman_exeuctor.get_item("RanToken")

        # reset the reset flag to say the last thing was not a reset call
        self._current_run_ms = total_run_time

        # switch the reset last flag, as now the last thing to run is a run
        self._has_reset_last = False