예제 #1
0
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, logbook)
from src.algs.gsa.operators import G, Kbest
from src.algs.gsa.ordering_mapping_operators import force, mapping_update, ordering_update, CompoundParticle, generate
from src.algs.heft.DSimpleHeft import run_heft
from src.algs.pso.ordering_operators import fitness, build_schedule
from src.core.CommonComponents.ExperimentalManagers import ExperimentResourceManager
from src.core.environment.ResourceGenerator import ResourceGenerator as rg
from src.core.environment.Utility import wf, Utility
from src.experiments.cga.mobjective.utility import SimpleTimeCostEstimator
from src.experiments.cga.utilities.common import repeat


_wf = wf("Montage_50")
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)
heft_schedule = run_heft(_wf, rm, estimator)


heft_particle = generate(_wf, rm, estimator, heft_schedule)

heft_gen = lambda n: [deepcopy(heft_particle) if random.random() > 1.00 else generate(_wf, rm, estimator) for _ in range(n)]

# def heft_gen(n):
#     heft_count = int(n*0.05)
#     pop = [deepcopy(heft_particle) for _ in range(heft_count)]
#     for _ in range(n - heft_count):
#         variant = gen()
#         hp = deepcopy(heft_particle)
#         variant.ordering = hp.ordering
#         pop.append(variant)
#     return pop
예제 #4
0
def do_exp(wf_name):
    _wf = wf(wf_name)
    heft_schedule = run_heft(_wf, rm, estimator)
    makespan = Utility.makespan(heft_schedule)
    return makespan
예제 #5
0
 def heft_schedule(self):
     if not self._heft_schedule:
         self._heft_schedule = run_heft(self._wf, self._rm, self._estimator)
     return self._heft_schedule