Ejemplo n.º 1
0
def oneExp(opts):
    result = {}
    taskPeriod = rv.uniform_int(opts.minPeriod, opts.maxPeriod)
    taskUtil = rv.uniform(opts.minUtil, opts.maxUtil)
    ts = generateTaskSetBase(taskPeriod, taskUtil, opts.systemSize)
    initialUtil = sum([float(x.cost) / float(x.period) for x in ts])
    result[0] = {'util': initialUtil, 'serverCount': 0, 'augment': 0.0}
    for i in range(2, opts.systemSize + 2, 2):
        for k in range(0, opts.numRequests):
            map(lambda x: x.resmodel[1].add_write_request(opts.resLength),
                ts[i - 2:i])
        servers = srm.createServers([1], ts[0:i])
        if (servers is not None):
            augmentedUtil = sum([
                x.getUtilization() for x in servers
            ]) + sum([0] + [x.utilization() for x in ts[i:opts.systemSize]])
            augmentFactor = (augmentedUtil - initialUtil) / initialUtil
            result[i] = {
                'util': augmentedUtil,
                'serverCount': len(servers),
                'augment': augmentFactor
            }
        else:
            result[i] = {'util': 0.0, 'serverCount': 0, 'augment': 0.0}
    return result
Ejemplo n.º 2
0
def manageGeneralOutputInfo(ts, resources, i, record):
    record['collaborative_tasks'] = i
    scc = [
        e for e in srm.findStronglyConnectedComponents(
            resources, ts[0:i]).values() if len(e._tasks) > 0
    ]
    if len(scc) <= 0:
        return
    ''' from here on, there is at least one task using at least one resource '''

    record['avg_res_per_scc'] = sum([len(e._resIds) for e in scc]) / len(scc)
    record['avg_tasks_per_scc'] = sum([len(e._tasks) for e in scc]) / len(scc)
    resCount = 0
    tpr = 0
    for r in resources:
        temp = len([t for t in ts if r in t.resmodel])
        if temp > 0:
            tpr += temp
            resCount += 1

    record['avg_tasks_per_res'] = float(tpr) / resCount
 def generateGroups(self):
     return srm.manageResources(self._res,
                                self._ts,
                                schedulabilityTest=self)
 def generateGroups(self):
     resources = srm.getResourcesOrderedByCost(self._ts, self._res)
     groups = srm.manageResourcesOBT(resources,
                                     self._ts,
                                     schedulabilityTest=self)
     return groups
Ejemplo n.º 5
0
def oneExp(args):

    result = []
    ts = generateTaskSetBase(NAMED_PERIODS[args['taskPeriods']],
                             NAMED_UTILS[args['taskUtils']],
                             args['systemSize'])
    initialUtil = sum([float(x.cost) / float(x.period) for x in ts])

    resManager = resmng.RandomResourceManager(range(0, args['totalResources']),
                                              args['csMin'], args['csMax'])

    result.append(getEmptyOutputRecord())
    result[0]['fg_final_util'] = initialUtil
    result[0]['cg_final_util'] = initialUtil

    try:

        for i in range(2, len(ts) + 2, 2):

            printHeadDebugging(i)
            resManager.distributeResources(ts[i - 2:i], args['maxResPerTask'])
            record = getEmptyOutputRecord()
            manageGeneralOutputInfo(ts, resManager.getAllResources(), i,
                                    record)

            # FINE GRAINED SERVERS
            groupsFG = srm.manageResourcesFineGrained(sorted(ts[0:i]))
            if (groupsFG is not None):
                manageSpecificOutputInfo(ts, groupsFG,
                                         resManager.getAllResources(),
                                         initialUtil, i, record, 'fg')

            # COARSE GRAINED SERVERS
            groupsCG = srm.manageResources(
                resManager.getAllResources(), sorted(ts[0:i]),
                SchedulabilityTestRUN(resManager.getAllResources(), ts[0:i]))
            if (groupsCG is not None):
                manageSpecificOutputInfo(ts, groupsCG,
                                         resManager.getAllResources(),
                                         initialUtil, i, record, 'cg')

            # SBLP SERVERS - OBT
            resources = resManager.getResourcesOrderedByCost()
            groupsOBT = srm.manageResourcesOBT(
                resources, sorted(ts[0:i]),
                SchedulabilityTestSBLP_OBT(resources, ts[0:i]), True)
            if (groupsOBT is not None):
                manageSpecificOutputInfo(ts, groupsOBT, resources, initialUtil,
                                         i, record, 'OBT_S')

            # MrsP SERVERS - OBT
            resources = resManager.getResourcesOrderedByCost()
            groupsMrsP = srm.manageResourcesOBT(
                resources, sorted(ts[0:i]),
                schedulabilityMrsP_OBT(resources, ts[0:i]), True, True)
            if (groupsMrsP is not None):
                manageSpecificOutputInfo(ts, groupsMrsP, resources,
                                         initialUtil, i, record, 'OBT_M')

            result.append(record)

    except:
        print "Failed processing { " + ', '.join(
            "{!s}={!r}".format(key, val)
            for (key, val) in args.items()) + " } "
        result = []

    return result
Ejemplo n.º 6
0
def oneExp(args):

    result = []
    ts = generateTaskSetBase(NAMED_PERIODS[args['taskPeriods']],
                             NAMED_UTILS[args['taskUtils']],
                             args['systemSize'])
    initialUtil = sum([float(x.cost) / float(x.period) for x in ts])

    # sbesc03, sbesc04 e sbesc05
    resManager = resmng.RandomResourceManager(range(0, args['totalResources']),
                                              10, 200)

    result.append(getEmptyOutputRecord())
    result[0]['fg_final_util'] = initialUtil
    result[0]['cg_final_util'] = initialUtil

    for i in range(2, len(ts) + 2, 2):

        if debugging:
            print "======================================="
            print "Execution %d" % i
            print "======================================="

        resManager.distributeResources(ts[i - 2:i], args['maxResPerTask'])

        record = getEmptyOutputRecord()
        manageGeneralOutputInfo(ts, resManager.getAllResources(), i, record)

        # FINE GRAINED SERVERS
        groups = srm.manageResourcesFineGrained(sorted(ts[0:i]))
        if (groups is not None):
            manageSpecificOutputInfo(ts, groups, resManager.getAllResources(),
                                     initialUtil, i, record, 'fg')

            if debugging:
                print ""
                print "FG Servers"
                print "======================================="
                for g in groups:
                    print "FG Servers - Group %d" % g
                    printSystem(groups[g]._servers)

        # COARSE GRAINED SERVERS
        groups = srm.manageResources(
            resManager.getAllResources(), sorted(ts[0:i]),
            SchedulabilityTestRUN(resManager.getAllResources(), ts[0:i]))
        if (groups is not None):
            manageSpecificOutputInfo(ts, groups, resManager.getAllResources(),
                                     initialUtil, i, record, 'cg')

            if debugging:
                print ""
                print "CG Servers"
                print "======================================="
                for g in groups:
                    print "CG Servers - Group %d" % g
                    printSystem(groups[g]._servers)

        # SBLP SERVERS - OBT
        resources = resManager.getResourcesOrderedByCost()
        groupsOBT = srm.manageResourcesOBT(
            resources, sorted(ts[0:i]),
            SchedulabilityTestSBLP_OBT(resources, ts[0:i]), True)
        if (groupsOBT is not None):
            manageSpecificOutputInfo(ts, groupsOBT, resources, initialUtil, i,
                                     record, 'SBLP.order')

            if debugging:
                print ""
                print "OBT Servers"
                print "======================================="
                for g in groupsOBT:
                    print "OBT Servers - Group %d" % g
                    printSystem(groupsOBT[g]._servers)

        # SBLP SERVERS - OBT, no merge
        groupsOBT_nm = srm.manageResourcesOBT(
            resources, sorted(ts[0:i]),
            SchedulabilityTestSBLP_OBT(resources, ts[0:i]), False)
        if (groupsOBT_nm is not None):
            manageSpecificOutputInfo(ts, groupsOBT_nm, resources, initialUtil,
                                     i, record, 'SBLP.no_merge')

            if debugging:
                print ""
                print "OBT (No Merge) Servers"
                print "======================================="
                for g in groupsOBT_nm:
                    print "OBT (No Merge) Servers - Group %d" % g
                    printSystem(groupsOBT_nm[g]._servers)

        result.append(record)

    return result
Ejemplo n.º 7
0
def oneExp(opts):

    resultFineGrain = {}
    resultCoarseGrain = {}
    resultMrsP = {}
    taskPeriod = rv.uniform_int(opts.minPeriod, opts.maxPeriod)
    taskUtil = rv.uniform(opts.minUtil, opts.maxUtil)
    ts = generateTaskSetBase(taskPeriod, taskUtil, opts.systemSize)
    initialUtil = sum([float(x.cost) / float(x.period) for x in ts])
    groupSize = int(math.ceil(opts.resPerTask * opts.resEntropy))
    resManager = resmng.GroupResourceManager(range(0, groupSize), groupSize)

    resultFineGrain[0] = {
        'util': initialUtil,
        'groupCount': 0,
        'serverCount': 0,
        'augment': 0.0
    }
    resultCoarseGrain[0] = {
        'util': initialUtil,
        'groupCount': 0,
        'serverCount': 0,
        'augment': 0.0
    }
    resultMrsP[0] = {
        'util': initialUtil,
        'groupCount': 0,
        'serverCount': 0,
        'augment': 0.0
    }
    for i in range(2, opts.systemSize + 2, 2):
        resManager.distributeResources(ts[i - 2:i], opts.resPerTask,
                                       opts.resLength, opts.numRequests)

        # FINE GRAINED SERVERS
        groups = srm.manageResourcesFineGrained(ts[0:i])
        if (groups is not None):
            servers = reduce(lambda x, y: x + y,
                             [groups[g]._servers for g in groups])
            augmentedUtil = sum([x.getUtilization() for x in servers]) + sum(
                [x.utilization() for x in ts[i:opts.systemSize]])
            augmentFactor = (augmentedUtil - initialUtil) / initialUtil
            resultFineGrain[i] = {
                'util': augmentedUtil,
                'groupCount': len(groups),
                'serverCount': len(servers),
                'augment': augmentFactor
            }
        else:
            resultFineGrain[i] = {
                'util': 0.0,
                'groupCount': 0,
                'serverCount': 0,
                'augment': 0.0
            }

        # COARSE GRAINED SERVERS
        groups = srm.manageResources(
            resManager.getAllResources(), ts[0:i],
            SchedulabilityTestRUN(resManager.getAllResources(), ts[0:i]))
        if (groups is not None):
            servers = reduce(lambda x, y: x + y,
                             [groups[g]._servers for g in groups])
            augmentedUtil = sum([x.getUtilization() for x in servers]) + sum(
                [x.utilization() for x in ts[i:opts.systemSize]])
            augmentFactor = (augmentedUtil - initialUtil) / initialUtil
            resultCoarseGrain[i] = {
                'util': augmentedUtil,
                'groupCount': len(groups),
                'serverCount': len(servers),
                'augment': augmentFactor
            }
        else:
            resultCoarseGrain[i] = {
                'util': 0.0,
                'groupCount': 0,
                'serverCount': 0,
                'augment': 0.0
            }

        # MrsP SERVERS
        groups = srm.manageResources(
            resManager.getAllResources(), ts[0:i],
            schedulabilityMrsP_OBT(resManager.getAllResources(), ts[0:i]))
        if (groups is not None):
            servers = reduce(lambda x, y: x + y,
                             [groups[g]._servers for g in groups])
            augmentedUtil = sum([x.getUtilization() for x in servers]) + sum(
                [x.utilization() for x in ts[i:opts.systemSize]])
            augmentFactor = (augmentedUtil - initialUtil) / initialUtil
            resultMrsP[i] = {
                'util': augmentedUtil,
                'groupCount': len(groups),
                'serverCount': len(servers),
                'augment': augmentFactor
            }
        else:
            resultMrsP[i] = {
                'util': 0.0,
                'groupCount': 0,
                'serverCount': 0,
                'augment': 0.0
            }

    return (resultFineGrain, resultCoarseGrain, resultMrsP)