6 Prepare the clones plot. 7 Parses the end of the output file, printed by the destructors of the CPUCruncher. 8 A line with the pattern "Summary: name=" is looked for. 9 The number of Events in flight is parsed as well. 14 MarkerStyle = kFullStar
22 global NEventsInFlight
24 ifile = open(logfilename,
"r") 25 lines = ifile.readlines() 28 if "Summary: name=" in line:
29 runtime_nclones =
map(float,
30 re.match(
".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*", line).groups())
31 vals.append(runtime_nclones)
32 elif "Running with" in line:
33 NEventsInFlight, NThreads =
map(int, re.match(
34 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads", line).groups())
40 graph = TGraph(len(vals))
42 for runtime, nclones
in vals:
43 graph.SetPoint(counter, runtime, nclones)
46 graph.SetMarkerStyle(MarkerStyle)
47 graph.SetMarkerSize(MarkerSize)
48 graph.SetMarkerColor(Color)
50 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones")
54 def getText(x, y, text, scale, angle, colour, font, NDC=False):
55 lat = TLatex(float(x), float(y),
56 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
60 lat.SetTextAngle(angle)
66 def getNclones(runtime_nclones):
67 return runtime_nclones[1]
68 max_nclones = int(max(vals, key=getNclones)[1])
71 for i
in xrange(1, max_nclones + 1):
73 filter(
lambda runtime_nclones: runtime_nclones[1] == i, vals))
74 latexes.append(
getText(xmax * 1.01,
97 global NEventsInFlight
101 nalgorithms = len(vals)
103 canvas = TCanvas(
"Clones",
"Clones", 1024, 768)
111 map(
lambda latex: latex.Draw(), countLatexes)
113 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}" % (
114 NEventsInFlight, NThreads, nalgorithms),
118 a = raw_input(
"press enter to continue")
119 canvas.Print(
"PlotClones.png")
122 if __name__ ==
"__main__":
125 print "Usage: plotClonesPyRoot.py logfilename" def getText(x, y, text, scale, angle, colour, font, NDC=False)
def parseLog(logfilename)
def getCountLatexes(vals, xmax)
struct GAUDI_API map
Parametrisation class for map-like implementation.