11 from __future__
import print_function
16 Script to parse all the logs and produce the speedup plot.
18 plotSpeedupsPyRoot.py --> vanilla plot
19 plotSpeedupsPyRoot.py 1 --> HT scaled plot
20 The variable fname_template contains the template of the file names to be
21 opened and parsed and is FIXED for all the logs.
22 The word "seconds" is looked for in the log and then the total runtime of the
23 event loop is extracted. This allows to discard the time spent in calibration
29 "measurement_BrunelScenario_n100_eif%s_aif100_nthreads%s_c%s_dqFalse_v5.log"
32 neif_l = [1, 2, 3, 5, 20, 30]
34 nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
36 cFlags = [
"True",
"False"]
42 LineColours = [kRed, kBlue, kGreen + 2, kOrange, kPink + 10, kViolet + 10]
67 effective_n_threads = n_threads
68 if effective_n_threads > PhCores:
69 ht_cores = n_threads - PhCores
70 effective_n_threads = PhCores + ht_cores * HtCoreWeight
71 return effective_n_threads
77 def getText(x, y, text, scale, angle, colour, font):
79 x, y,
"#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text)
82 lat.SetTextAngle(angle)
91 graphc.SetLineStyle(LineStyle)
92 graphs = (graph, graphc)
94 g.SetLineWidth(LineWidth)
95 g.SetMarkerSize(MarkerSize)
96 g.SetMarkerStyle(MarkerStyles[graph_counter])
97 g.SetLineColor(LineColours[graph_counter])
98 g.SetMarkerColor(LineColours[graph_counter])
106 return fname_template % (neif, nt, cFlag)
114 ifile = open(filename,
"r")
117 if "seconds" in line:
119 seconds = float(line.split(
" ")[-1])
123 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
132 if len(sys.argv) > 1:
137 print(
"Events in flight: %s" % neif)
144 len_nt = len(nts) + 1
146 idealSpeedup = TGraph(2)
147 idealSpeedup.SetPoint(0, 1, 1)
148 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
151 scaled_s =
" (scaled for HT)"
152 idealSpeedup.SetTitle(
153 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case"
156 idealSpeedup.SetLineWidth(4)
157 idealSpeedup.SetLineColor(kGray - 2)
158 idealSpeedup.SetLineStyle(2)
163 graph = TGraph(len_nt)
164 graph.SetName(
"%s" % neif)
165 graph.SetPoint(0, 1, 1)
167 graphc = TGraph(len_nt)
168 graphc.SetName(
"%s clone" % neif)
169 graphc.SetPoint(0, 1, 1)
176 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
178 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
181 neif_graphs.append([neif, graph, graphc])
183 neif_graphs.reverse()
186 canvas = TCanvas(
"Speedup",
"Speedup", 2048, 1800)
189 idealSpeedup.Draw(
"APL")
190 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
193 line = TLine(11, 0, 11, 25)
194 line.SetLineColor(kRed)
199 for neif, graph, graphc
in neif_graphs:
201 graphc.Draw(
"SamePL")
204 legend = TLegend(0.1, 0.45, 0.38, 0.9)
205 legend.SetFillColor(kWhite)
206 legend.SetHeader(
"# Simultaneous Evts")
207 for neif, graph, graphc
in neif_graphs:
208 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
209 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
213 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
215 ht_cores =
getText(12.0, 15,
"Hardware Threaded Regime", LabelsSize, 90, 2, LabelsFont)
217 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918, LabelsFont)
224 "#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight,
233 scaled_s =
"_HTScaled"
234 canvas.Print(
"GaudiHivePerfBrunelAllPoints%s.png" % scaled_s)