コード例 #1
0
ファイル: pig.py プロジェクト: zywan/Kariz
def build_rcp_priorities(g):
    if not g.stages:
        build_stages(g)
    
    plans_container = plan.PlansContainer(g)
    for s in g.stages:
        stage = g.stages[s]
        build_rcp_stage_priorities_helper(g, stage, plans_container)
    return plans_container;
コード例 #2
0
ファイル: pig.py プロジェクト: zywan/Kariz
def build_kariz_priorities(g):
    if not g.stages:
        build_stages(g)
    
    plans_container = plan.PlansContainer(g)
    for s in g.stages:
        stage = g.stages[s]
        build_kariz_stage_priorities_helper(g, stage, plans_container)
    
    #plans_container.assing_prefetch_plan_unlimitedbw()
    return plans_container;
コード例 #3
0
ファイル: planner.py プロジェクト: zywan/Kariz
    def build_pig_mrd_plans(self, g):
        blevels, orderednodes = g.bLevel()
        cur_blevel = max(blevels)
        csi = max(blevels) - cur_blevel  # current stage index
        cur_stage = plan.Stage(csi)
        plans_container = plan.PlansContainer(g)

        # build priority plans for stage
        ci = 0  # current index
        while ci < len(blevels):
            if blevels[ci] != cur_blevel:
                cur_stage.finish_add_jobs()
                plans_container.add_stage(cur_stage)
                plan = cur_stage.get_criticalpath_plan()
                plans_container.add_cache_plan(plan, cur_stage)
                # prepare new stage
                cur_blevel = cur_blevel - 1
                csi = max(blevels) - cur_blevel
                cur_stage = plan.Stage(csi)

            # build the job
            j = plan.Job(csi)
            j.id = orderednodes[ci]
            j.original_runtime = g.timeValue[orderednodes[ci]]
            j.improved_runtime = g.timeValue[orderednodes[ci]]
            j.cached_runtime = g.cachedtimeValue[orderednodes[ci]]
            # FIXME add inputs as well
            inputs = g.inputs[orderednodes[ci]]
            inputSize = g.inputSize[orderednodes[ci]]
            for i in range(0, len(inputs)):
                j.inputs[inputs[i]] = inputSize[i]

            cur_stage.add_job(j)
            ci = ci + 1

        cur_stage.finish_add_jobs()
        plans_container.add_stage(cur_stage)
        plan = cur_stage.get_criticalpath_plan()
        plans_container.add_cache_plan(plan, cur_stage)

        # so far, the plans are build for each stage, its time to append to the prefetch stage
        plans_container.assing_prefetch_plan()
        return plans_container
コード例 #4
0
ファイル: pig.py プロジェクト: zywan/Kariz
def build_lru_priorities(g):
    blevels, orderednodes = g.bLevel()
    cur_blevel = max(blevels)
    csi = max(blevels) - cur_blevel # current stage index
    cur_stage = plan.Stage(csi)
    plans_container = plan.PlansContainer(g)
    
    # build priority plans for stage 
    ci = 0 # current index
    while ci < len(blevels):    
        if blevels[ci] != cur_blevel:
            cur_stage.finish_add_jobs()
            build_lru_priorities_helper(g, cur_stage, plans_container)
            g.stages[csi] = cur_stage
            # prepare new stage
            cur_blevel = cur_blevel - 1
            csi = max(blevels) - cur_blevel 
            cur_stage = plan.Stage(csi)
        
        # build the job
        j = plan.Job(csi)
        j.id = orderednodes[ci]
        j.original_runtime = g.timeValue[orderednodes[ci]]
        j.improved_runtime = g.timeValue[orderednodes[ci]]
        j.cached_runtime = g.cachedtimeValue[orderednodes[ci]]
        # FIXME add inputs as well
        inputs = g.inputs[orderednodes[ci]]
        inputSize = g.inputSize[orderednodes[ci]]
        for i in range(0, len(inputs)):
            print(i, inputs, inputSize)
            if len(inputSize) <= i:
                j.inputs[inputs[i]] = 0
            else:
                j.inputs[inputs[i]] = inputSize[i]
        
        cur_stage.add_job(j)
        ci = ci + 1

    cur_stage.finish_add_jobs()
    build_lru_priorities_helper(g, cur_stage, plans_container)
    g.stages[csi] = cur_stage
    return plans_container