8 ROOT.gROOT.SetBatch(
True)
9 ROOT.PyConfig.IgnoreCommandLineOptions =
True
18 def findBounds(x, ys, xmin=None, ymin=None, xmax=None, ymax=None):
24 ymin =
min([
min(y)
for y
in ys])
26 ymax =
max([
max(y)
for y
in ys]) * 1.1
28 return (xmin, ymin, xmax, ymax)
45 frame = canv.DrawFrame(*bounds)
47 frame.GetXaxis().SetTitle(
"Number of threads")
48 frame.GetYaxis().SetTitle(ytitle)
54 if legends
is not None:
55 leg = ROOT.TLegend(0.77,legendYmax-0.19,0.99,legendYmax)
59 if ideal1
is not None:
61 ideal_y = [ideal1, ymax]
62 ideal_x = [1, ymax/ideal1]
63 gr = ROOT.TGraph(2, array.array(
"d", ideal_x), array.array(
"d", ideal_y))
64 gr.SetLineColor(ROOT.kBlack)
68 leg.AddEntry(gr,
"Ideal scaling",
"l")
71 for i, y
in enumerate(ys):
72 gr = ROOT.TGraph(len(x), array.array(
"d", x), array.array(
"d", y))
74 gr.SetLineColor(color)
75 gr.SetMarkerColor(color)
76 gr.SetMarkerStyle(ROOT.kFullCircle)
81 leg.AddEntry(gr, legends[i],
"lp")
88 canv.SaveAs(name+
".png")
89 canv.SaveAs(name+
".pdf")
93 (inputfile, outputfile, graph_label) = argv[1:4]
95 re_mt = re.compile(
"nTH(?P<th>\d+)_nEV(?P<ev>\d+)")
96 re_mp = re.compile(
"nJOB(?P<job>\d+)")
103 if not "AVX512" in line:
105 comp = line.split(
" ")
106 m = re_mt.search(comp[0])
108 if m.group(
"th") != m.group(
"ev"):
109 raise Exception(
"Can't handle yet different numbers of threads (%s) and events (%s)" % (m.group(
"th"), m.group(
"ev")))
110 mt[int(m.group(
"th"))] = float(comp[1])
112 m = re_mp.search(comp[0])
114 mp[int(m.group(
"job"))] = float(comp[1])
117 ncores = sorted(list(set(mt.keys() + mp.keys())))
118 mt_y = [mt[n]
for n
in ncores]
119 mp_y = [mp[n]
for n
in ncores]
120 ideal1 = mt_y[0]/ncores[0]
121 ideal1_mp = mp_y[0]/ncores[0]
123 makePlot(outputfile+
"_throughput", ncores,
125 "Throughput (events/s)",
127 legends=[
"Multithreading",
"Multiprocessing"],
129 bounds=dict(ymin=0, xmin=0),
133 eff = [mt_y[i]/mp_y[i]
for i
in xrange(0, len(ncores))]
134 makePlot(outputfile+
"_efficiency", ncores,
136 "Multithreading efficiency (MT/MP)",
138 bounds=dict(ymin=0.9, ymax=1.1)
141 eff_vs_ideal_mt = [mt_y[i]/(ideal1*n)
for i, n
in enumerate(ncores)]
142 eff_vs_ideal_mp = [mp_y[i]/(ideal1*n)
for i, n
in enumerate(ncores)]
143 makePlot(outputfile+
"_efficiency_ideal", ncores,
144 [eff_vs_ideal_mt, eff_vs_ideal_mp],
145 "Efficiency wrt. ideal",
147 legends=[
"Multithreading",
"Multiprocessing"],
148 bounds=dict(ymin=0.8, ymax=1.01, xmax=65),
152 speedup_mt = [mt_y[i]/ideal1
for i
in xrange(0, len(ncores))]
153 speedup_mp = [mp_y[i]/ideal1
for i
in xrange(0, len(ncores))]
154 makePlot(outputfile+
"_speedup", ncores,
155 [speedup_mt, speedup_mp],
156 "Speedup wrt. 1 thread",
158 legends=[
"Multithreading",
"Multiprocessing"],
160 bounds=dict(ymin=0, xmin=0),
165 if __name__ ==
"__main__":