14Script to parse all the logs and produce the speedup plot.
16plotSpeedupsPyRoot.py --> vanilla plot
17plotSpeedupsPyRoot.py 1 --> HT scaled plot
18The variable fname_template contains the template of the file names to be
19opened and parsed and is FIXED for all the logs.
20The word "seconds" is looked for in the log and then the total runtime of the
21event loop is extracted. This allows to discard the time spent in calibration
27 "measurement_BrunelScenario_n100_eif%s_aif100_nthreads%s_c%s_dqFalse_v5.log"
30neif_l = [1, 2, 3, 5, 20, 30]
32nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
34cFlags = [
"True",
"False"]
72 effective_n_threads = n_threads
73 if effective_n_threads > PhCores:
74 ht_cores = n_threads - PhCores
75 effective_n_threads = PhCores + ht_cores * HtCoreWeight
76 return effective_n_threads
82def getText(x, y, text, scale, angle, colour, font):
84 x, y, f
"#scale[{scale}]{{#color[{colour}]{{#font[{font}]{{{text}}}}}}}"
87 lat.SetTextAngle(angle)
96 graphc.SetLineStyle(LineStyle)
97 graphs = (graph, graphc)
99 g.SetLineWidth(LineWidth)
100 g.SetMarkerSize(MarkerSize)
101 g.SetMarkerStyle(MarkerStyles[graph_counter])
102 g.SetLineColor(LineColours[graph_counter])
103 g.SetMarkerColor(LineColours[graph_counter])
111 return fname_template % (neif, nt, cFlag)
119 ifile = open(filename)
122 if "seconds" in line:
124 seconds = float(line.split(
" ")[-1])
128 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
142 print(f
"Events in flight: {neif}")
144 print(f
"{tn} {xtractTiming(neif, tn, False)} {xtractTiming(neif, tn, True)}")
148idealSpeedup = ROOT.TGraph(2)
149idealSpeedup.SetPoint(0, 1, 1)
150idealSpeedup.SetPoint(1, TotalCores, TotalCores)
153 scaled_s =
" (scaled for HT)"
154idealSpeedup.SetTitle(
155 f
"GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size{scaled_s};Speedup wrt Serial Case"
157idealSpeedup.SetLineWidth(4)
158idealSpeedup.SetLineColor(ROOT.kGray - 2)
159idealSpeedup.SetLineStyle(2)
164 graph = ROOT.TGraph(len_nt)
165 graph.SetName(f
"{neif}")
166 graph.SetPoint(0, 1, 1)
168 graphc = ROOT.TGraph(len_nt)
169 graphc.SetName(f
"{neif} clone")
170 graphc.SetPoint(0, 1, 1)
177 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
179 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
182 neif_graphs.append([neif, graph, graphc])
187canvas = ROOT.TCanvas(
"Speedup",
"Speedup", 2048, 1800)
190idealSpeedup.Draw(
"APL")
191idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
194line = ROOT.TLine(11, 0, 11, 25)
195line.SetLineColor(ROOT.kRed)
200for neif, graph, graphc
in neif_graphs:
202 graphc.Draw(
"SamePL")
205legend = ROOT.TLegend(0.1, 0.45, 0.38, 0.9)
206legend.SetFillColor(ROOT.kWhite)
207legend.SetHeader(
"# Simultaneous Evts")
208for neif, graph, graphc
in neif_graphs:
209 legend.AddEntry(graph, f
"{neif}", LegendDrawOpts)
210 legend.AddEntry(graphc, f
"{neif} (clone)", LegendDrawOpts)
214ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
216ht_cores =
getText(12.0, 15,
"Hardware Threaded Regime", LabelsSize, 90, 2, LabelsFont)
218is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918, LabelsFont)
225 f
"#splitline{{Hardware threaded}}{{cores weight: {HtCoreWeight}}}",
234 scaled_s =
"_HTScaled"
235canvas.Print(f
"GaudiHivePerfBrunelAllPoints{scaled_s}.png")
createFname(neif, nt, cFlag)
xtractTiming(neif, nt, cFlag)
getText(x, y, text, scale, angle, colour, font)
formatGraphs(graph, graphc)