14 Script to parse all the logs and produce the speedup plot.
16 plotSpeedupsPyRoot.py --> vanilla plot
17 plotSpeedupsPyRoot.py 1 --> HT scaled plot
18 The variable fname_template contains the template of the file names to be
19 opened and parsed and is FIXED for all the logs.
20 The word "seconds" is looked for in the log and then the total runtime of the
21 event 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"
30 neif_l = [1, 2, 3, 5, 20, 30]
32 nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
34 cFlags = [
"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
82 def getText(x, y, text, scale, angle, colour, font):
84 x, y,
"#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, 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,
"r")
122 if "seconds" in line:
124 seconds = float(line.split(
" ")[-1])
128 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
137 if len(sys.argv) > 1:
142 print(
"Events in flight: %s" % neif)
149 len_nt = len(nts) + 1
151 idealSpeedup = ROOT.TGraph(2)
152 idealSpeedup.SetPoint(0, 1, 1)
153 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
156 scaled_s =
" (scaled for HT)"
157 idealSpeedup.SetTitle(
158 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case"
161 idealSpeedup.SetLineWidth(4)
162 idealSpeedup.SetLineColor(ROOT.kGray - 2)
163 idealSpeedup.SetLineStyle(2)
168 graph = ROOT.TGraph(len_nt)
169 graph.SetName(
"%s" % neif)
170 graph.SetPoint(0, 1, 1)
172 graphc = ROOT.TGraph(len_nt)
173 graphc.SetName(
"%s clone" % neif)
174 graphc.SetPoint(0, 1, 1)
181 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
183 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
186 neif_graphs.append([neif, graph, graphc])
188 neif_graphs.reverse()
191 canvas = ROOT.TCanvas(
"Speedup",
"Speedup", 2048, 1800)
194 idealSpeedup.Draw(
"APL")
195 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
198 line = ROOT.TLine(11, 0, 11, 25)
199 line.SetLineColor(ROOT.kRed)
204 for neif, graph, graphc
in neif_graphs:
206 graphc.Draw(
"SamePL")
209 legend = ROOT.TLegend(0.1, 0.45, 0.38, 0.9)
210 legend.SetFillColor(ROOT.kWhite)
211 legend.SetHeader(
"# Simultaneous Evts")
212 for neif, graph, graphc
in neif_graphs:
213 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
214 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
218 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
220 ht_cores =
getText(12.0, 15,
"Hardware Threaded Regime", LabelsSize, 90, 2, LabelsFont)
222 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918, LabelsFont)
229 "#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight,
238 scaled_s =
"_HTScaled"
239 canvas.Print(
"GaudiHivePerfBrunelAllPoints%s.png" % scaled_s)