3 Script to parse all the logs and produce the speedup plot. 5 plotSpeedupsPyRoot.py --> vanilla plot 6 plotSpeedupsPyRoot.py 1 --> HT scaled plot 7 The variable fname_template contains the template of the file names to be 8 opened and parsed and is FIXED for all the logs. 9 The word "seconds" is looked for in the log and then the total runtime of the 10 event loop is extracted. This allows to discard the time spent in calibration 15 fname_template =
"measurement_BrunelScenario_n100_eif%s_aif100_nthreads%s_c%s_dqFalse_v5.log" 17 neif_l = [1, 2, 3, 5, 20, 30]
19 nts = [2, 3, 5, 10, 11, 12, 13, 15, 23]
21 cFlags = [
"True",
"False"]
27 LineColours = [kRed, kBlue, kGreen + 2, kOrange, kPink + 10, kViolet + 10]
29 kFullCircle, kOpenCross, kFullTriangleUp, kOpenStar, kFullCross,
48 effective_n_threads = n_threads
49 if effective_n_threads > PhCores:
50 ht_cores = n_threads - PhCores
51 effective_n_threads = PhCores + ht_cores * HtCoreWeight
52 return effective_n_threads
58 def getText(x, y, text, scale, angle, colour, font):
61 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
63 lat.SetTextAngle(angle)
72 graphc.SetLineStyle(LineStyle)
73 graphs = (graph, graphc)
75 g.SetLineWidth(LineWidth)
76 g.SetMarkerSize(MarkerSize)
77 g.SetMarkerStyle(MarkerStyles[graph_counter])
78 g.SetLineColor(LineColours[graph_counter])
79 g.SetMarkerColor(LineColours[graph_counter])
87 return fname_template % (neif, nt, cFlag)
95 ifile = open(filename,
"r") 100 seconds = float(line.split(
" ")[-1])
104 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
112 if len(sys.argv) > 1:
117 print "Events in flight: %s" % neif
122 len_nt = len(nts) + 1
124 idealSpeedup = TGraph(2)
125 idealSpeedup.SetPoint(0, 1, 1)
126 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
129 scaled_s =
" (scaled for HT)" 130 idealSpeedup.SetTitle(
131 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case" 133 idealSpeedup.SetLineWidth(4)
134 idealSpeedup.SetLineColor(kGray - 2)
135 idealSpeedup.SetLineStyle(2)
140 graph = TGraph(len_nt)
141 graph.SetName(
"%s" % neif)
142 graph.SetPoint(0, 1, 1)
144 graphc = TGraph(len_nt)
145 graphc.SetName(
"%s clone" % neif)
146 graphc.SetPoint(0, 1, 1)
153 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
155 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
158 neif_graphs.append([neif, graph, graphc])
160 neif_graphs.reverse()
163 canvas = TCanvas(
"Speedup",
"Speedup", 2048, 1800)
166 idealSpeedup.Draw(
"APL")
167 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
170 line = TLine(11, 0, 11, 25)
171 line.SetLineColor(kRed)
176 for neif, graph, graphc
in neif_graphs:
178 graphc.Draw(
"SamePL")
181 legend = TLegend(.1, .45, .38, .9)
182 legend.SetFillColor(kWhite)
183 legend.SetHeader(
"# Simultaneous Evts")
184 for neif, graph, graphc
in neif_graphs:
185 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
186 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
190 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
192 ht_cores =
getText(12., 15,
"Hardware Threaded Regime", LabelsSize, 90, 2,
195 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup", LabelsSize, 45, 918,
202 "#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight,
203 LabelsSize, 0, 600, LabelsFont)
207 scaled_s =
"_HTScaled" 208 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)