Exemple #1
0
def main():

    # Init
    # ------------------------------

    for k in KEYS:
        values[k] = []

    # Parse
    # ------------------------------

    for line in fileinput.input('-'):

        print line.rstrip()

        for s in KEYS:
            search = ('^%s:\s+([0-9\.]+)' % s)
            m = re.match(search, line)
            if m:
                values[s].append(float(m.group(1)))

    # Calculate
    # ------------------------------

    print values

    for (key, vals) in values.items():
        print '[%20s] has %3d entries' % (key, len(vals)),

        if len(vals)>0:
            (m, stderr, median, vmin, vmax) = tools.statistics(vals)
            print '%10.3f %10.3f' % (m, stderr)
Exemple #2
0
    def get_receive_send_ratio(self):
        """Get ratio of receive and send costs

        """

        import tools

        cmax = self.get_num_cores()

        sends = []
        recvs = []

        for s in range(cmax):
            for r in range(cmax):
                sends.append(self.query_send_cost(s, r))
                recvs.append(self.get_receive_cost(s, r))

        (s_avg, _, _, s_min, s_max) = tools.statistics(sends)
        (r_avg, _, _, r_min, r_max) = tools.statistics(recvs)


        return s_avg/r_avg, s_max/r_max, s_min/r_min
def main():

    parser = argparse.ArgumentParser(description='Parse PAPI result files')
    parser.add_argument('fname', nargs='+')
    args = parser.parse_args()

    output = {}

    for fname in args.fname:

        # Init
        # ------------------------------

        for k in KEYS:
            timer_values[k] = []

        print 'FILE', fname
        parse_papi_file(fname);

        output[fname] = {}

        # Calculate
        # ------------------------------

        print timer_values

        for (key, vals) in timer_values.items():
            print '[%20s] has %3d entries' % (key, len(vals)),

            if len(vals)>0:
                (m, stderr, median, vmin, vmax) = tools.statistics(vals)
                print '%10.3f %10.3f' % (m, stderr)

                output[fname][key] = (m, stderr)


    # Output statistics
    print '| file',
    for l in [ 'comp', 'total', 'copy' ]:
        print '|', l, 'stderr',
    print '|'
    print '|-'

    for (fname, values) in output.items():
        print '| %20s ' % fname,
        for l in [ 'comp', 'total', 'copy' ]:
            (m, stderr) = values[l]
            print ('| %10.3f | %10.3f ' % (m, stderr)),
        print '|'

    print '|-'
Exemple #4
0
def main():

    parser = argparse.ArgumentParser(description="Parse PAPI result files")
    parser.add_argument("fname", nargs="+")
    args = parser.parse_args()

    for fname in args.fname:
        print "Parsing file", fname
        parse_papi_file(fname)

    print "--------------------------------------------------"
    print values
    print "--------------------------------------------------"

    #    conf = [ c for (c,d) in values.items()[0][1].items() ]
    conf = [None, "-d", "-d -r", "-d -r -p", "-d -r -p -h"]
    events = set(eventlist)

    replace = {"triangle_counting": "tc", "pagerank": "pr", "hop_dist": "hd"}

    PRINTSTDERR = False

    for event in events:

        print event
        print

        print "|    |",
        for c in conf:
            print "{0:10s}".format(c), "|",
            if PRINTSTDERR:
                print "stderr    ", "|",
        print
        print "|-"

        for (program, data) in values.items():
            print "|", replace[program], "|",

            for c in conf:
                for (e, t) in data[c].items():
                    if e == event:

                        (mean, stderr, _, _, _) = tools.statistics([e / 10000.0 for e in t])
                        print "{0:10.2f} |".format(mean),
                        if PRINTSTDERR:
                            print "{0:10.2f} |".format(stderr),
            print

        print
def main():

    parser = argparse.ArgumentParser(description='Parse measurement file')
    parser.add_argument('fname', nargs='+')
    args = parser.parse_args()

    for fname in args.fname:
        parse_measurement_file(fname);

    print values

    confs = [ None, '-d', '-d -r', '-d -r -p', '-d -r -p -h', '-d -r -h', '-r -h', '-r', '-h'  ]
    confs_available = set()
#    events = [ e for (e, _) in values.items()[0][1].items()[0][1]]

    replace = {
        'triangle_counting': 'tc',
        'pagerank': 'pr',
        'hop_dist': 'hd'
    }

    print 'OS:', ('Linux' if linux else 'Barrelfish')

    programs = [ p for (p, d) in values.items() ]
    print 'Programs are: ', programs

    for (program, data) in values.items():
        print 'Numbers for ', program

        # Extracting cores and sort
        cores = sorted([ c for (c, d) in data.items() ])

        for core in cores:
            datai = data[core]
            print ('%-30s' % ('%d cores' % core)),
            for measurement in MEASUREMENTS:
                print ('%10s %10s' % (measurement, 'stderr')),
            print ''

            # Check all configurations from log file
            for (conf, _) in datai.items():
                print 'Found configuration', conf
                confs_available.add(conf)
                assert conf in confs

            print 'Following configurations are available', str(confs_available)

            for conf in confs_available:

                print ('%-30s' % (conf)),
                for measurement in MEASUREMENTS:

                    mean = -1
                    stderr = 0

                    if conf in datai:
                        dataii = datai[conf]
                        (dmean, dstderr, dmin, dmax, dmedian) = \
                            statistics([ s for (x,s) in dataii if x == measurement ])
                        mean = dmean
                        stderr = dstderr

                    print ('%10.3f %10.3f' % (mean, stderr)),

                print ''
#folder=main_folder+'20_03_16_K4/'
folder = main_folder + '20_04_20_Q4/'

if __name__ == "__main__":
    files = [
        folder + 'exports_np/' +
        #            'raw_{:02.0f}_1'.format(f) for f in [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
        #            'raw_{:02.0f}_1'.format(f) for f in [4, 5, 6, 7, 8, 9, 10, 18, 21]
        #            'raw_{:02.0f}_1'.format(f) for f in [3, 4, 5, 6, 7, 8]
        'raw_{:02.0f}_1'.format(f) for f in [2, 17, 15]
    ]

    print('\tx \ty \tcon \tI_np \tI_np px\tI_bg px\tstd')

    for file in files:
        info = readinfo(file)
        info_stat = statistics(info)
        print(
            '{}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.05f}\t{:.05f}'
            .format(file[-4:-2], *info_stat[0]))
        print(
            'n= {}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.02f}\t{:.05f}\t{:.05f}'
            .format(info_stat[2], *info_stat[1]))
        print(
            '------------------------------------------------------------------'
        )

data = np.matrix(info)
fig, ax = plt.subplots()

n, bins, patches = ax.hist(data[:, 2], 10)