Example #1
0
def calc_effective_ave_pwrs( npkgs, nsec, pkgs, drms ):
    coef    = 1.3
    pkg_max = coef * machine.get_tdp_pkg()
    drm_max = coef * machine.get_tdp_drm()
    pwr_min = 0.5
    aves_pkg = [0.0 for isec in range(nsec)]
    aves_drm = [0.0 for isec in range(nsec)]
    for isec in range(nsec):
        ave_pkg = 0.0
        ave_drm = 0.0
        neff = 0
        for ipkg in range(npkgs):
            pkg = pkgs[ipkg][isec]
            drm = drms[ipkg][isec]
            if pkg > pkg_max:
                print "ERROR: Illegal CPU power (%10.3f)" % pkg
                sys.exit(1)
            if drm > drm_max:
                print "ERROR: Illegal DRAM power (%10.3f)" % drm
                sys.exit(1)
            if pkg > pwr_min and drm > pwr_min:
                ave_pkg += pkg
                ave_drm += drm
                neff += 1
        #
        if neff == 0:
            print "ERROR: No effective data"
            sys.exit(1)
        aves_pkg[isec] = ave_pkg / float(neff)
        aves_drm[isec] = ave_drm / float(neff)
    #
    return (aves_pkg, aves_drm)
Example #2
0
def read_ave_pwrs_with_freq( header, ifreq ):
    coef = 1.3
    pkg_max  = coef * machine.get_tdp_pkg()
    drm_max  = coef * machine.get_tdp_drm()
    secfiles = ric.get_sec_file_list( header )
    ric.reset_sec()
    nsec     = ric.get_nsec_ric( secfiles )
    npkgs    = machine.get_npkgs()
    tfreq    = 0.1 * float( ifreq )

    aves_pkg = [[0.0 for isec in range(nsec)] for ipkg in range(npkgs)]
    aves_drm = [[0.0 for isec in range(nsec)] for ipkg in range(npkgs)]
    for secfile in secfiles:
        try:
            f = open( secfile, "r" )
        except IOError:
            print "ERROR: Failure opening file %s" % secfile
            sys.exit(1)
        #
        pkgid = machine.get_pkgid( f )
        #
        f.seek(0)
        (nitera, etms, pkgs, drms, tots, frqs) = \
                ric.etime_pwrs_freq_by_trial( f )

        for isec in range(nsec):
            ave_pkg = 0.0
            ave_drm = 0.0
            neff = 0
            for itera in range(nitera):
                dif = fabs( tfreq - frqs[itera][isec] )
                if dif < 0.01:
                    pkg = pkgs[itera][isec]
                    drm = drms[itera][isec]
                    if pkg < pkg_max and drm < drm_max:
                        ave_pkg += pkg
                        ave_drm += drm
                        neff += 1
                else:   # debug
                    print "warning: %s iter=%d" % (secfile, itera)
            #
            if neff < 1:
                print "ERROR: No effective data in %s" % secfile
                f.close()
            #
            aves_pkg[pkgid][isec] = ave_pkg/float(neff)
            aves_drm[pkgid][isec] = ave_drm/float(neff)
        #
        f.close()
    #
    return ( aves_pkg, aves_drm )
Example #3
0
    pkg_list = machine.needed_pkg_list( pbs_nodefile, nprocs )
    Ptot     = module_pwr_cap * nprocs
    alpha = [0.0 for isec in range(nsec)]
    for isec in range(nsec):
        Pmax=0.0
        Pmin=0.0
        for ipkg in range(npkgs):
            if pkg_list[ipkg] == 1:
                Pmax+=app_est_maxpkg[ipkg][isec]+app_est_maxdrm[ipkg][isec]
                Pmin+=app_est_minpkg[ipkg][isec]+app_est_mindrm[ipkg][isec]
        #
        alpha[isec] = (Ptot-Pmin)/(Pmax-Pmin)
        # debug
        #print "alpha[%d]= %10.6f" % (isec, alpha[isec])

    cpu_max = machine.get_tdp_pkg()
    cpu_min = machine.get_min_pkg()
    drm_max = machine.get_tdp_drm()
    drm_min = machine.get_min_drm()
    pwr_max = cpu_max + drm_max
    pwr_min = cpu_min + drm_min
    alpha0 = (module_pwr_cap - pwr_min)/(pwr_max - pwr_min)
    if alpha0 >= 1.0: alpha0 = 1.0
    cpu_default = alpha0 * (cpu_max-cpu_min) + cpu_min
    cpu_default = int( cpu_default * 8.0 ) * 0.125
    for ipkg in range(npkgs):
        if pkg_list[ipkg] == 0: continue
        confname="%s-%d.conf" % (conf_header, ipkg)
        try:
            f=open(confname, "w")
        except IOError: