7 from optparse import OptionParser
12 f = os.popen("svn info", "r")
20 if l.startswith('Revision:'):
22 svn_rev = t.split()[-1]
27 f = open("/proc/cpuinfo")
32 return s.find('PS3') != -1
37 def make_fname(suffix):
38 return basename + '.' + suffix
44 parser = OptionParser()
45 parser.add_option("-m", "--max-spes", type="int", default=max_spes_default,
47 help="maximum number of SPEs to use [default=%default]")
48 parser.add_option("", "--min-spes", type="int", default=1,
50 help="minimum number of SPEs to use [default=%default]")
51 parser.add_option("-p", "--oprofile", action="store_true", default=False,
52 help="emit oprofile commands")
53 parser.add_option("-t", "--tag", default=None,
54 help="additional goodie in generated filenames")
55 (options, args) = parser.parse_args()
61 svn_rev = get_svn_rev()
63 os.environ['TZ'] = 'PST8PDT' # always pacific
68 tag = '-' + options.tag
70 basename = 'R-%s%s-%s' % (svn_rev, tag, time.strftime('%Y%m%d-%H%M'))
72 base_njobs = int(500e3)
78 200 : int(base_njobs/2),
79 250 : int(base_njobs/2.5),
80 300 : int(base_njobs/3),
81 400 : int(base_njobs/4),
82 500 : int(base_njobs/5)
86 f_results = make_fname('results')
87 f_opreport = make_fname('opreport')
88 f_avg = make_fname('avg')
89 f_png = make_fname('png')
92 f.write("#!/bin/bash\n")
95 f.write("opcontrol --stop\n")
96 f.write("opcontrol --reset\n")
97 f.write("opcontrol --start\n")
101 for udelay in (10, 50, 100, 200, 300):
102 for nspes in range(options.min_spes, options.max_spes+1):
103 cmd = "./benchmark_nop -n %d -u %d -N %d\n" % (nspes, udelay, njobs[udelay])
107 f.write(") | tee %s\n" % (f_results,))
110 f.write("opcontrol --dump\n")
111 f.write("opcontrol --stop\n")
112 f.write("opreport -l | head -100 > %s\n" % (f_opreport,))
114 f.write("./split_and_avg_results.py %s > %s\n" % (f_results, f_avg))
115 f.write("./plot_speedup.py %s -o %s\n" % (f_avg, f_png))
118 if __name__ == '__main__':