Exemple #1
0
def pltPwrLoadScaling(output, fileID, loadSize, plotName, pwrThresh=100):
    loadSize = loadSize[::-1]
    plt.figure()
    plt.style.use('classic')
    for size in loadSize:
        file = output + fileID + size
        df = pc.readMetrics(file)

        # data,start,end = pc.getComputationStartEnd (dff,pwrThresh)
        # df = pc.getStablePwr(data,start,end)

        maxp = max(df['pwr'])
        minp = min(df['pwr'])
        meanp = df['pwr'].mean()
        std = stdev(df['pwr'])
        print("\nMax: ", maxp, "Min: ", minp, "Mean: ", meanp, "Std: ", std,
              "\n")
        plt.plot(df['time'], df['pwr'], label=size)

    plt.xlabel('Time (s)')
    #plt.xlim(0, 12)
    # Set the y axis label of the current axis.
    plt.ylabel('Power (W)')
    #plt.ylim(0, 275)

    plt.ticklabel_format(useOffset=False)

    # Set a title of the current axes.
    #plt.title('Power vs Load')
    # show a legend on the plot
    plt.legend()
    #plt.show()
    plt.grid()
    plt.savefig(output + fileID + plotName)
def pltPwrcapTimeIF(arch, app, dataPath, pltPath, thresh):
    tot_time = []
    mean_pwr = []
    r2r_time = []
    r2r_mean_pwr = []
    fID = ""
    pls = []
    for p in np.arange(125, 255, 5):
        pls.append(p)
        pl = str(p)

        if arch == "P100":
            fID = app + '-fp64-run-' + pl + '-P100-1328-'
        elif arch == "V100":
            fID = app + '-fp64-run-' + pl + '-V100-1380-'

        r2r_mean_pwr.clear()
        r2r_time.clear()

        for r in range(3):
            d = pc.readMetrics(dataPath + fID + str(r))
            df, s, e = pc.getComputationStartEnd(d, thresh)
            # striping non-computing power consumption
            data = pc.getStablePwr(df, s, e)

            r2r_mean_pwr.append(data['pwr'].mean())
            seconds = max(data['time']) - min(data['time'])
            r2r_time.append(seconds)

        mean_pwr.append(mean(r2r_mean_pwr))
        tot_time.append(mean(r2r_time))

    #print ('\nTime: ',tot_time,'\n')
    #print ('\nPower: ',mean_pwr,'\n')
    return tot_time, mean_pwr, arch, app, pltPath, 'PWRCAP', pls
def getPwrPerfCounters(output, fileID, size, pwrThresh=100):
    #os.chdir('../')
    #baseDir = os.getcwd()
    #file = baseDir+'/test/output/'+app+'-'+prec+'-'+mode+'-'+size
    file = output + fileID + size
    # striping non-computing power consumption

    data = pc.readMetrics(file)

    gdata, cpStartTime, cpEndTime = pc.getComputationStartEnd(data, pwrThresh)
    df = pc.getStablePwr(gdata, cpStartTime, cpEndTime)

    #gpu0Pwr['time'] =  (df['time'] - (df['time'].iloc[0]))

    tot_seconds = max(df['time']) - min(df['time'])
    #timedelta = tot_time - datetime(1900, 1, 1)

    #tot_seconds = timedelta.total_seconds()
    print('\nTotal Seconds', tot_seconds)
    s = 0.0
    if size == '16' or size == '32' or size == '48' or size == '64' or size == '72':
        s = float(size) * 320
    else:
        s = float(size)

    gflop = 2 * s * s * s / 1e9
    print('\nGFlops:', gflop)
    if tot_seconds != 0:
        gflops = gflop / tot_seconds
    else:
        gflops = gflop

    return (df['pwr'].mean()), gflops
Exemple #4
0
def getPyMMPwr(output,fileID,numRuns,pwrThresh = 100):
        pyMMPwrs = []
        for r in numRuns:
                file = output+fileID+r
                data = pc.readMetrics(file)
                data,s,e = pc.getComputationStartEnd (data,pwrThresh)
                # striping non-computing power consumption
                df = pc.getStablePwr(data,s,e)
                pyMMPwrs.append(df['pwr'].mean())
        return pyMMPwrs
def pltIndividual(output, fileID, size):

    file = output + fileID + size
    gpu0Pwr = pc.readMetrics(file)
    GPU0MeanPwr = gpu0Pwr['pwr'].mean()
    plt.figure()
    plt.plot(gpu0Pwr['time'], gpu0Pwr['pwr'], label="Real-time")
    meanGPUPwr = [GPU0MeanPwr for x in range(len(gpu0Pwr))]
    plt.plot(gpu0Pwr['time'], meanGPUPwr, linestyle='--', label="Mean")
    plt.xlabel('Time')
    plt.ylabel('GPU Power Consumption (W)')
    plt.title('Matrix size: ' + size + 'x' + size)
    plt.legend()
    plt.grid()
    plt.ticklabel_format(useOffset=False)
    plt.savefig(output + fileID + size + '.png')

    meanGPUPwr.clear()
def getPyMMPwr(output, fileID, numRuns, pwrThresh=100):
    pyMMPwrs = []
    for r in numRuns:
        '''
                if fileID+r == 'dgemm-fp64-run-250-V100-135-8' or fileID+r == 'dgemm-fp64-run-250-V100-135-9':
                        print ("\n ***SKIPPING*** \n")
                        print (fileID+r)
                        print ("\n ***SKIPPING*** \n")
                        continue
                '''

        file = output + fileID + r
        data = pc.readMetrics(file)
        data, s, e = pc.getComputationStartEnd(data, pwrThresh)
        # striping non-computing power consumption
        df = pc.getStablePwr(data, s, e)
        pyMMPwrs.append(df['pwr'].mean())
    return pyMMPwrs
def pltVarations(output, fileID, r, pwrThresh=100):
    file = output + fileID + r
    gpu0Pwr = pc.readMetrics(file)
    # striping non-computing power consumption
    data, start, end = pc.getComputationStartEnd(gpu0Pwr, pwrThresh)
    rampUp, stable, rampDown = getVariationSlices(data, start, end)
    '''
        print ('\ntotal length:', len(gpu0Pwr))
        print('\nrampUp:',rampUp)
        print ('\nrampUp length:',len(rampUp))
 
        print('\nStable:',stable)
        print ('\nStable length:',len(stable))
        
        print('\nrampDown:',rampDown)
        print ('\nrampDown length:',len(rampDown))
        '''

    pltRampUp(rampUp, output, fileID)
    pltStable(stable, output, fileID)
    pltRampDown(rampDown, output, fileID)
def pltDVFSTimeIF(arch, app, dataPath, pltPath, thresh):

    tot_time = []
    mean_pwr = []
    r2r_time = []
    r2r_mean_pwr = []

    freqs = []

    if arch == 'V100':
        alt = 0
        f = 135
        while f <= upper_freq:
            fID = app + '-fp64-run-250-V100-' + str(f) + '-'
            freqs.append(f)
            r2r_mean_pwr.clear()
            r2r_time.clear()
            if f == 1005:
                thresh = 85
            for r in range(3):
                d = pc.readMetrics(dataPath + fID + str(r))
                df, s, e = pc.getComputationStartEnd(d, thresh)
                # striping non-computing power consumption
                data = pc.getStablePwr(df, s, e)

                r2r_mean_pwr.append(data['pwr'].mean())
                seconds = max(data['time']) - min(data['time'])
                r2r_time.append(seconds)

            mean_pwr.append(mean(r2r_mean_pwr))
            tot_time.append(mean(r2r_time))

            if alt == 0:
                f += 7
                alt = 1
            else:
                f += 8
                alt = 0
        #print ('\nTime: ',tot_time,'\n')
        print('\nPower: ', mean_pwr, '\n')

        return tot_time, mean_pwr, arch, app, pltPath, 'DVFS', freqs

    elif arch == 'P100':
        f = 544
        while f <= 1329:  # 1328
            fID = app + '-fp64-run-250-P100-' + str(f) + '-'

            freqs.append(f)

            r2r_mean_pwr.clear()
            r2r_time.clear()
            if f > 1005:
                thresh = 85
            for r in range(3):
                d = pc.readMetrics(dataPath + fID + str(r))
                df, s, e = pc.getComputationStartEnd(d, thresh)
                # striping non-computing power consumption
                data = pc.getStablePwr(df, s, e)

                r2r_mean_pwr.append(data['pwr'].mean())
                seconds = max(data['time']) - min(data['time'])
                r2r_time.append(seconds)

            mean_pwr.append(mean(r2r_mean_pwr))
            tot_time.append(mean(r2r_time))

            if f == 1328:
                break

            if (path.exists(dataPath + app + '-fp64-run-250-P100-' +
                            str(f + 12) + '-0')):
                f += 12
            elif (path.exists(dataPath + 'dgemm-fp64-run-250-P100-' +
                              str(f + 13) + '-0')):
                f += 13

        return tot_time, mean_pwr, arch, app, pltPath, 'DVFS', freqs