1 from __future__
import print_function
4 Script to parse all the logs and produce the speedup plot. 6 plotSpeedupsPyRoot.py --> vanilla plot 7 plotSpeedupsPyRoot.py 1 --> HT scaled plot 8 The variable fname_template contains the template of the file names to be 9 opened and parsed and is FIXED for all the logs. 10 The word "seconds" is looked for in the log and then the total runtime of the 11 event loop is extracted. This allows to discard the time spent in calibration 16 fname_template =
"measurement_BrunelScenario_n100_eif%s_aif100_nthreads%s_c%s_dqFalse_v5.log" 18 neif_l = [1, 2, 3, 5, 20, 30]
20 nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
22 cFlags = [
"True",
"False"]
28 LineColours = [kRed, kBlue, kGreen + 2, kOrange, kPink + 10, kViolet + 10]
30 kFullCircle, kOpenCross, kFullTriangleUp, kOpenStar, kFullCross,
49 effective_n_threads = n_threads
50 if effective_n_threads > PhCores:
51 ht_cores = n_threads - PhCores
52 effective_n_threads = PhCores + ht_cores * HtCoreWeight
53 return effective_n_threads
59 def getText(x, y, text, scale, angle, colour, font):
62 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
64 lat.SetTextAngle(angle)
73 graphc.SetLineStyle(LineStyle)
74 graphs = (graph, graphc)
76 g.SetLineWidth(LineWidth)
77 g.SetMarkerSize(MarkerSize)
78 g.SetMarkerStyle(MarkerStyles[graph_counter])
79 g.SetLineColor(LineColours[graph_counter])
80 g.SetMarkerColor(LineColours[graph_counter])
88 return fname_template % (neif, nt, cFlag)
96 ifile = open(filename,
"r")
101 seconds = float(line.split(
" ")[-1])
105 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
113 if len(sys.argv) > 1:
118 print(
"Events in flight: %s" % neif)
123 len_nt = len(nts) + 1
125 idealSpeedup = TGraph(2)
126 idealSpeedup.SetPoint(0, 1, 1)
127 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
130 scaled_s =
" (scaled for HT)" 131 idealSpeedup.SetTitle(
132 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case" 134 idealSpeedup.SetLineWidth(4)
135 idealSpeedup.SetLineColor(kGray - 2)
136 idealSpeedup.SetLineStyle(2)
141 graph = TGraph(len_nt)
142 graph.SetName(
"%s" % neif)
143 graph.SetPoint(0, 1, 1)
145 graphc = TGraph(len_nt)
146 graphc.SetName(
"%s clone" % neif)
147 graphc.SetPoint(0, 1, 1)
154 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
156 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
159 neif_graphs.append([neif, graph, graphc])
161 neif_graphs.reverse()
164 canvas = TCanvas(
"Speedup",
"Speedup", 2048, 1800)
167 idealSpeedup.Draw(
"APL")
168 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
171 line = TLine(11, 0, 11, 25)
172 line.SetLineColor(kRed)
177 for neif, graph, graphc
in neif_graphs:
179 graphc.Draw(
"SamePL")
182 legend = TLegend(.1, .45, .38, .9)
183 legend.SetFillColor(kWhite)
184 legend.SetHeader(
"# Simultaneous Evts")
185 for neif, graph, graphc
in neif_graphs:
186 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
187 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
191 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
193 ht_cores =
getText(12., 15,
"Hardware Threaded Regime", LabelsSize, 90, 2,
196 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918,
203 "#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight,
204 LabelsSize, 0, 600, LabelsFont)
208 scaled_s =
"_HTScaled" 209 canvas.Print(
"GaudiHivePerfBrunelAllPoints%s.png" % scaled_s)
def createFname(neif, nt, cFlag)
def getText(x, y, text, scale, angle, colour, font)
def formatGraphs(graph, graphc)
def scaleCores(n_threads)
def xtractTiming(neif, nt, cFlag)