def _write_load_time_cost(power_used, f): """ Energy usage from the loading phase :param PowerUsed power_used: :param ~io.TextIOBase f: file writer """ # find time in milliseconds total_time_ms = 0.0 for element in power_used._algorithm_timing_provenance: if element.names[1] == "loading": total_time_ms += convert_time_diff_to_total_milliseconds( element.value) # handle active routers etc active_router_cost = ( power_used.loading_time_secs * 1000 * power_used.num_frames * ComputeEnergyUsed.MILLIWATTS_PER_FRAME_ACTIVE_COST) # detailed report write f.write( "The amount of time used during the loading process is {} " "milliseconds.\nAssumed only 2 monitor cores is executing that " "this point. We also assume that there is a baseline active " "router/cooling component that is using {} Joules. " "Overall the energy usage is {} Joules.\n".format( total_time_ms, active_router_cost, power_used.loading_joules))
def _write_data_extraction_time_cost(power_used, f): """ Data extraction cost :param PowerUsed power_used: :param ~io.TextIOBase f: file writer """ # find time total_time_ms = 0.0 for element in power_used._algorithm_timing_provenance: if (element.names[1] == "Execution" and element.names[2] != "run_time_of_FrontEndCommonApplicationRunner"): total_time_ms += convert_time_diff_to_total_milliseconds( element.value) # handle active routers etc energy_cost_of_active_router = ( total_time_ms * power_used.num_frames * ComputeEnergyUsed.MILLIWATTS_PER_FRAME_ACTIVE_COST) # detailed report f.write( "The amount of time used during the data extraction process is {} " "milliseconds.\nAssumed only 2 monitor cores is executing at " "this point. We also assume that there is a baseline active " "router/cooling component that is using {} Joules. Hence the " "overall energy usage is {} Joules.\n".format( total_time_ms, energy_cost_of_active_router, power_used.saving_joules))
def _calculate_load_time_cost( self, pacman_provenance, machine, f, load_time, active_chips, n_frames): """ Energy usage from the loading phase :param pacman_provenance: provenance items from the PACMAN set :param machine: machine description :param f: file writer :param active_chips: the chips which have end user code in them :param load_time: the time of the entire load time phase in ms :return: load time energy value in Joules """ # pylint: disable=too-many-arguments # find time in milliseconds total_time_ms = 0.0 for element in pacman_provenance: if element.names[1] == "loading": total_time_ms += convert_time_diff_to_total_milliseconds( element.value) # handle monitor core active cost # min between chips that are active and fixed monitor, as when 1 # chip is used its one monitor, if more than 1 chip, # the ethernet connected chip and the monitor handling the read/write # this is checked by min energy_cost = ( total_time_ms * min(self.N_MONITORS_ACTIVE_DURING_COMMS, len(active_chips)) * (self.MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD / 18)) # handle all idle cores energy_cost += self._calculate_idle_cost(total_time_ms, machine) # handle time diff between load time and total laod phase of ASB energy_cost += ( (load_time - total_time_ms) * len(list(machine.chips)) * self.MILLIWATTS_PER_IDLE_CHIP) # handle active routers etc active_router_cost = ( load_time * n_frames * self.MILLIWATTS_PER_FRAME_ACTIVE_COST) # accumulate energy_cost += active_router_cost # detailed report write f.write( "The amount of time used during the loading process is {} " "milliseconds.\nAssumed only 2 monitor cores is executing that " "this point. We also assume that there is a baseline active " "router/cooling component that is using {} Joules. " "Overall the energy usage is {} Joules.\n".format( total_time_ms, active_router_cost, energy_cost)) return energy_cost
def _calculate_data_extraction_time_cost( self, pacman_provenance, machine, output, active_chips, n_frames): """ data extraction cost :param pacman_provenance: provenance items from the pacman set :param machine: machine rep :param output: file writer :param active_chips: :return: cost of data extraction """ # find time total_milliseconds = 0.0 extraction_algorithms = list() for element in pacman_provenance: if element.names[1] == "Execution": if not (element.names[2] == "run_time_of_FrontEndCommonApplicationRunner"): extraction_algorithms.append(element) for element in extraction_algorithms: total_milliseconds += \ helpful_functions.convert_time_diff_to_total_milliseconds( element.value) # min between chips that are active and fixed monitor, as when 1 # chip is used its one monitor, if more than 1 chip, # the ethernet connected chip and the monitor handling the read/write # this is checked by min energy_cost = ( total_milliseconds * min(self.N_MONITORS_ACTIVE_DURING_COMMS, len(active_chips)) * (self.JULES_PER_MILLISECOND_PER_CHIP_ACTIVE_OVERHEAD / 18)) # add idle chip cost energy_cost += self._calculate_idle_cost(total_milliseconds, machine) # handle active routers etc energy_cost_of_active_router = ( total_milliseconds * n_frames * self.JULES_PER_MILLISECOND_PER_FRAME_ACTIVE_COST) energy_cost += energy_cost_of_active_router # detailed report output.write( "The amount of time used during the data extraction process is {} " "milliseconds.\n Assumed only 2 monitor cores is executing at " "this point. we also assume that there is a baseline active " "router/cooling component that is using {} Jules. so the overall " "energy usage is {} Jules \n".format( total_milliseconds, energy_cost_of_active_router, energy_cost)) return energy_cost
def _calculate_data_extraction_time_cost( self, pacman_provenance, machine, f, active_chips, n_frames): """ Data extraction cost :param pacman_provenance: provenance items from the PACMAN set :param machine: machine description :param f: file writer :param active_chips: :return: cost of data extraction in Joules """ # pylint: disable=too-many-arguments # find time total_time_ms = 0.0 for element in pacman_provenance: if (element.names[1] == "Execution" and element.names[2] != "run_time_of_FrontEndCommonApplicationRunner"): total_time_ms += convert_time_diff_to_total_milliseconds( element.value) # min between chips that are active and fixed monitor, as when 1 # chip is used its one monitor, if more than 1 chip, # the ethernet connected chip and the monitor handling the read/write # this is checked by min energy_cost = ( total_time_ms * min(self.N_MONITORS_ACTIVE_DURING_COMMS, len(active_chips)) * self.MILLIWATTS_PER_CHIP_ACTIVE_OVERHEAD / 18) # add idle chip cost energy_cost += self._calculate_idle_cost(total_time_ms, machine) # handle active routers etc energy_cost_of_active_router = ( total_time_ms * n_frames * self.MILLIWATTS_PER_FRAME_ACTIVE_COST) energy_cost += energy_cost_of_active_router # detailed report f.write( "The amount of time used during the data extraction process is {} " "milliseconds.\nAssumed only 2 monitor cores is executing at " "this point. We also assume that there is a baseline active " "router/cooling component that is using {} Joules. Hence the " "overall energy usage is {} Joules.\n".format( total_time_ms, energy_cost_of_active_router, energy_cost)) return energy_cost
def _calculate_load_time_cost( self, pacman_provenance, machine, output, load_time, active_chips, n_frames): """ energy usage from the loading phase :param pacman_provenance: provenance items from the pacman set :param machine: machine rep :param output: file writer :param active_chips: the chips which have end user code in them :param load_time: the time of the entire load time phase in ms :return: load time energy value """ # find time total_milliseconds = 0.0 loading_algorithms = list() for element in pacman_provenance: if element.names[1] == "loading": loading_algorithms.append(element) for element in loading_algorithms: total_milliseconds += \ helpful_functions.convert_time_diff_to_total_milliseconds( element.value) # handle monitor core active cost # min between chips that are active and fixed monitor, as when 1 # chip is used its one monitor, if more than 1 chip, # the ethernet connected chip and the monitor handling the read/write # this is checked by min energy_cost = ( total_milliseconds * min(self.N_MONITORS_ACTIVE_DURING_COMMS, len(active_chips)) * (self.JULES_PER_MILLISECOND_PER_CHIP_ACTIVE_OVERHEAD / 18)) # handle all idle cores energy_cost += self._calculate_idle_cost(total_milliseconds, machine) # handle time diff between load time and total laod phase of ASB diff_of_algorithms_and_boiler = load_time - total_milliseconds energy_cost += ( diff_of_algorithms_and_boiler * ( len(list(machine.chips)) * self.JULES_PER_MILLISECOND_PER_IDLE_CHIP)) # handle active routers etc energy_cost_of_active_router = ( load_time * n_frames * self.JULES_PER_MILLISECOND_PER_FRAME_ACTIVE_COST) # accumulate energy_cost += energy_cost_of_active_router # detailed report write output.write( "The amount of time used during the loading process is {} " "milliseconds.\n Assumed only 2 monitor cores is executing that " "this point. We also assume that there is a baseline active " "router/cooling component that is using {} Jules. " "Overall the energy usage is {} Jules \n".format( total_milliseconds, energy_cost_of_active_router, energy_cost)) return energy_cost
def __get_running_time_ms(pacman_provenance, filter_rule): return float( sum( convert_time_diff_to_total_milliseconds(element.value) for element in pacman_provenance if filter_rule(element.names)))