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"]
34 MarkerStyles = [kFullCircle,
55 effective_n_threads = n_threads
56 if effective_n_threads > PhCores:
57 ht_cores = n_threads - PhCores
58 effective_n_threads = PhCores + ht_cores * HtCoreWeight
59 return effective_n_threads
64 def getText(x, y, text, scale, angle, colour, font):
65 lat = TLatex(x, y,
"#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (
66 scale, colour, font, text))
68 lat.SetTextAngle(angle)
76 graphc.SetLineStyle(LineStyle)
77 graphs = (graph, graphc)
79 g.SetLineWidth(LineWidth)
80 g.SetMarkerSize(MarkerSize)
81 g.SetMarkerStyle(MarkerStyles[graph_counter])
82 g.SetLineColor(LineColours[graph_counter])
83 g.SetMarkerColor(LineColours[graph_counter])
90 return fname_template % (neif, nt, cFlag)
97 ifile = open(filename,
"r") 100 if "seconds" in line:
102 seconds = float(line.split(
" ")[-1])
106 seconds =
xtractTiming(neif, nts[nts.index(nt) - 1], cFlag)
114 if len(sys.argv) > 1:
120 print "Events in flight: %s" % neif
126 len_nt = len(nts) + 1
128 idealSpeedup = TGraph(2)
129 idealSpeedup.SetPoint(0, 1, 1)
130 idealSpeedup.SetPoint(1, TotalCores, TotalCores)
133 scaled_s =
" (scaled for HT)" 134 idealSpeedup.SetTitle(
135 "GaudiHive Speedup (Brunel, 100 evts);Thread Pool Size%s;Speedup wrt Serial Case" % scaled_s)
136 idealSpeedup.SetLineWidth(4)
137 idealSpeedup.SetLineColor(kGray - 2)
138 idealSpeedup.SetLineStyle(2)
143 graph = TGraph(len_nt)
144 graph.SetName(
"%s" % neif)
145 graph.SetPoint(0, 1, 1)
147 graphc = TGraph(len_nt)
148 graphc.SetName(
"%s clone" % neif)
149 graphc.SetPoint(0, 1, 1)
156 graph.SetPoint(counter, scaled_tn, ScalarTime / time)
158 graphc.SetPoint(counter, scaled_tn, ScalarTime / timec)
161 neif_graphs.append([neif, graph, graphc])
163 neif_graphs.reverse()
166 canvas = TCanvas(
"Speedup",
"Speedup", 2048, 1800)
169 idealSpeedup.Draw(
"APL")
170 idealSpeedup.GetYaxis().SetRangeUser(0.1, TotalCores + 1)
173 line = TLine(11, 0, 11, 25)
174 line.SetLineColor(kRed)
179 for neif, graph, graphc
in neif_graphs:
181 graphc.Draw(
"SamePL")
184 legend = TLegend(.1, .45, .38, .9)
185 legend.SetFillColor(kWhite)
186 legend.SetHeader(
"# Simultaneous Evts")
187 for neif, graph, graphc
in neif_graphs:
188 legend.AddEntry(graph,
"%s" % neif, LegendDrawOpts)
189 legend.AddEntry(graphc,
"%s (clone)" % neif, LegendDrawOpts)
193 ph_cores =
getText(10.5, 15,
"Physical Cores", LabelsSize, 90, 2, LabelsFont)
195 ht_cores =
getText(12., 15,
"Hardware Threaded Regime",
196 LabelsSize, 90, 2, LabelsFont)
198 is_text =
getText(16, 16.5,
"Ideal (linear) Speedup",
199 LabelsSize, 45, 918, LabelsFont)
204 18.5, 8,
"#splitline{Hardware threaded}{cores weight: %s}" % HtCoreWeight, 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)