11 from __future__
import print_function
19 Prepare the clones plot.
20 Parses the end of the output file, printed by the destructors of the CPUCruncher.
21 A line with the pattern "Summary: name=" is looked for.
22 The number of Events in flight is parsed as well.
27 MarkerStyle = kFullStar
35 global NEventsInFlight
37 ifile = open(logfilename,
"r")
38 lines = ifile.readlines()
41 if "Summary: name=" in line:
42 runtime_nclones =
map(
45 ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
49 vals.append(runtime_nclones)
50 elif "Running with" in line:
51 NEventsInFlight, NThreads =
map(
54 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
63 graph = TGraph(len(vals))
65 for runtime, nclones
in vals:
66 graph.SetPoint(counter, runtime, nclones)
69 graph.SetMarkerStyle(MarkerStyle)
70 graph.SetMarkerSize(MarkerSize)
71 graph.SetMarkerColor(Color)
73 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones"
78 def getText(x, y, text, scale, angle, colour, font, NDC=False):
82 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text),
87 lat.SetTextAngle(angle)
93 def getNclones(runtime_nclones):
94 return runtime_nclones[1]
96 max_nclones = int(
max(vals, key=getNclones)[1])
99 for i
in range(1, max_nclones + 1):
100 n_algos = len(filter(
lambda runtime_nclones: runtime_nclones[1] == i, vals))
101 latexes.append(
getText(xmax * 1.01, i, n_algos, 0.7, 0, 600, 12))
103 label =
getText(0.95, 0.55,
"Total", 0.8, 270, 600, 12,
True)
105 latexes.append(label)
111 global NEventsInFlight
115 nalgorithms = len(vals)
117 canvas = TCanvas(
"Clones",
"Clones", 1024, 768)
125 map(
lambda latex: latex.Draw(), countLatexes)
129 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"
130 % (NEventsInFlight, NThreads, nalgorithms),
139 a = raw_input(
"press enter to continue")
140 canvas.Print(
"PlotClones.png")
143 if __name__ ==
"__main__":
146 print(
"Usage: plotClonesPyRoot.py logfilename")