11 from __future__
import print_function
16 Prepare the clones plot.
17 Parses the end of the output file, printed by the destructors of the CPUCruncher.
18 A line with the pattern "Summary: name=" is looked for.
19 The number of Events in flight is parsed as well.
24 MarkerStyle = kFullStar
32 global NEventsInFlight
34 ifile = open(logfilename,
"r")
35 lines = ifile.readlines()
38 if "Summary: name=" in line:
39 runtime_nclones =
map(
42 ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
44 vals.append(runtime_nclones)
45 elif "Running with" in line:
46 NEventsInFlight, NThreads =
map(
49 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
56 graph = TGraph(len(vals))
58 for runtime, nclones
in vals:
59 graph.SetPoint(counter, runtime, nclones)
62 graph.SetMarkerStyle(MarkerStyle)
63 graph.SetMarkerSize(MarkerSize)
64 graph.SetMarkerColor(Color)
66 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones"
71 def getText(x, y, text, scale, angle, colour, font, NDC=False):
74 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
78 lat.SetTextAngle(angle)
84 def getNclones(runtime_nclones):
85 return runtime_nclones[1]
87 max_nclones = int(
max(vals, key=getNclones)[1])
90 for i
in range(1, max_nclones + 1):
92 filter(
lambda runtime_nclones: runtime_nclones[1] == i, vals))
93 latexes.append(
getText(xmax * 1.01, i, n_algos, .7, 0, 600, 12))
95 label =
getText(.95, .55,
"Total", .8, 270, 600, 12,
True)
103 global NEventsInFlight
107 nalgorithms = len(vals)
109 canvas = TCanvas(
"Clones",
"Clones", 1024, 768)
117 map(
lambda latex: latex.Draw(), countLatexes)
120 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"
121 % (NEventsInFlight, NThreads, nalgorithms), .8, 0, 2, 12,
True)
124 a = raw_input(
"press enter to continue")
125 canvas.Print(
"PlotClones.png")
128 if __name__ ==
"__main__":
131 print(
"Usage: plotClonesPyRoot.py logfilename")