def do_exp_HEFT(wf_name, trans): _wf = wf("" + wf_name) estimator.transfer_time = trans #estim = SimpleTimeCostEstimator(comp_time_cost=0, transf_time_cost=0, transferMx=None, # ideal_flops=20, transfer_time=trans) heft_schedule = run_heft(_wf, rm, estimator) #return heft_schedule Utility.validate_static_schedule(_wf, heft_schedule) makespan = Utility.makespan(heft_schedule) return makespan
def __call__(self): _wf = wf(self.wf_name) rm = ExperimentResourceManager(rg.r([10, 15, 25, 30])) estimator = ModelTimeEstimator(bandwidth=10) empty_fixed_schedule_part = Schedule({node: [] for node in rm.get_nodes()}) heft_schedule = run_heft(_wf, rm, estimator) fixed_schedule = empty_fixed_schedule_part ga_functions = GAFunctions2(_wf, rm, estimator) generate = partial(ga_generate, ga_functions=ga_functions, fixed_schedule_part=fixed_schedule, current_time=0.0, init_sched_percent=0.05, initial_schedule=heft_schedule) stats = tools.Statistics(lambda ind: ind.fitness.values[0]) stats.register("avg", numpy.mean) stats.register("std", numpy.std) stats.register("min", numpy.min) stats.register("max", numpy.max) logbook = tools.Logbook() logbook.header = ["gen", "evals"] + stats.fields toolbox = Toolbox() toolbox.register("generate", generate) toolbox.register("evaluate", fit_converter(ga_functions.build_fitness(empty_fixed_schedule_part, 0.0))) toolbox.register("clone", deepcopy) toolbox.register("mate", ga_functions.crossover) toolbox.register("sweep_mutation", ga_functions.sweep_mutation) toolbox.register("mutate", ga_functions.mutation) # toolbox.register("select_parents", ) # toolbox.register("select", tools.selTournament, tournsize=4) toolbox.register("select", tools.selRoulette) pop, logbook, best = run_ga(toolbox=toolbox, logbook=logbook, stats=stats, **self.GA_PARAMS) resulted_schedule = ga_functions.build_schedule(best, empty_fixed_schedule_part, 0.0) ga_makespan = Utility.makespan(resulted_schedule) return (ga_makespan, resulted_schedule, logbook)
def heft_schedule(self): if not self._heft_schedule: self._heft_schedule = run_heft(self._wf, self._rm, self._estimator) return self._heft_schedule
from scheduling.src.core.CommonComponents.ExperimentalManagers import ExperimentResourceManager from scheduling.src.core.environment.Utility import Utility, wf from scheduling.src.algs.common.MapOrdSchedule import build_schedule, MAPPING_SPECIE, ORDERING_SPECIE from scheduling.src.experiments.aggregate_utilities import interval_statistics, interval_stat_string from scheduling.src.experiments.cga.mobjective.utility import SimpleTimeCostEstimator from scheduling.src.core.environment.ResourceGenerator import ResourceGenerator as rg from scheduling.src.experiments.cga.utilities.common import repeat _wf = wf("CyberShake_30") rm = ExperimentResourceManager(rg.r([10, 15, 25, 30])) estimator = SimpleTimeCostEstimator(comp_time_cost=0, transf_time_cost=0, transferMx=None, ideal_flops=20, transfer_time=100) sorted_tasks = HeftHelper.heft_rank(_wf, rm, estimator) heft_schedule = run_heft(_wf, rm, estimator) heft_mapping = schedule_to_position(heft_schedule) heft_mapping.velocity = MappingParticle.Velocity({}) heft_gen = lambda n: [deepcopy(heft_mapping) if random.random() > 1.0 else generate(_wf, rm, estimator, 1)[0] for _ in range(n)] W, C1, C2 = 0.1, 0.6, 0.2 GEN, N = 10, 4 toolbox = Toolbox() toolbox.register("population", heft_gen) toolbox.register("fitness", fitness, _wf, rm, estimator, sorted_tasks)
def do_exp(wf_name): _wf = wf(wf_name) heft_schedule = run_heft(_wf, rm, estimator) makespan = Utility.makespan(heft_schedule) return makespan