11 from __future__
import print_function
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
26 fname_template =
"measurement_BrunelScenario_n100_eif%s_aif100_nthreads%s_c%s_dqFalse_v5.log"
28 neif_l = [1, 2, 3, 5, 20, 30]
30 nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
32 cFlags = [
"True",
"False"]
38 LineColours = [kRed, kBlue, kGreen + 2, kOrange, kPink + 10, kViolet + 10]
40 kFullCircle, kOpenCross, kFullTriangleUp, kOpenStar, kFullCross,
59 effective_n_threads = n_threads
60 if effective_n_threads > PhCores:
61 ht_cores = n_threads - PhCores
62 effective_n_threads = PhCores + ht_cores * HtCoreWeight
63 return effective_n_threads
69 def getText(x, y, text, scale, angle, colour, font):
72 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
74 lat.SetTextAngle(angle)
83 graphc.SetLineStyle(LineStyle)
84 graphs = (graph, graphc)
86 g.SetLineWidth(LineWidth)
87 g.SetMarkerSize(MarkerSize)
88 g.SetMarkerStyle(MarkerStyles[graph_counter])
89 g.SetLineColor(LineColours[graph_counter])
90 g.SetMarkerColor(LineColours[graph_counter])
98 return fname_template % (neif, nt, cFlag)
106 ifile = open(filename,
"r")
109 if "seconds" in line:
111 seconds = float(line.split(
" ")[-1])
115 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
123 if len(sys.argv) > 1:
128 print(
"Events in flight: %s" % neif)
133 len_nt = len(nts) + 1
135 idealSpeedup = TGraph(2)
136 idealSpeedup.SetPoint(0, 1, 1)
137 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
140 scaled_s =
" (scaled for HT)"
141 idealSpeedup.SetTitle(
142 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case"
144 idealSpeedup.SetLineWidth(4)
145 idealSpeedup.SetLineColor(kGray - 2)
146 idealSpeedup.SetLineStyle(2)
151 graph = TGraph(len_nt)
152 graph.SetName(
"%s" % neif)
153 graph.SetPoint(0, 1, 1)
155 graphc = TGraph(len_nt)
156 graphc.SetName(
"%s clone" % neif)
157 graphc.SetPoint(0, 1, 1)
164 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
166 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
169 neif_graphs.append([neif, graph, graphc])
171 neif_graphs.reverse()
174 canvas = TCanvas(
"Speedup",
"Speedup", 2048, 1800)
177 idealSpeedup.Draw(
"APL")
178 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
181 line = TLine(11, 0, 11, 25)
182 line.SetLineColor(kRed)
187 for neif, graph, graphc
in neif_graphs:
189 graphc.Draw(
"SamePL")
192 legend = TLegend(.1, .45, .38, .9)
193 legend.SetFillColor(kWhite)
194 legend.SetHeader(
"# Simultaneous Evts")
195 for neif, graph, graphc
in neif_graphs:
196 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
197 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
201 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
203 ht_cores =
getText(12., 15,
"Hardware Threaded Regime", LabelsSize, 90, 2,
206 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918,
213 "#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight,
214 LabelsSize, 0, 600, LabelsFont)
218 scaled_s =
"_HTScaled"
219 canvas.Print(
"GaudiHivePerfBrunelAllPoints%s.png" % scaled_s)