5 Prepare the clones plot. 6 Parses the end of the output file, printed by the destructors of the CPUCruncher. 7 A line with the pattern "Summary: name=" is looked for. 8 The number of Events in flight is parsed as well. 13 MarkerStyle = kFullStar
21 global NEventsInFlight
23 ifile = open(logfilename,
"r") 24 lines = ifile.readlines() 27 if "Summary: name=" in line:
28 runtime_nclones =
map(
31 ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
33 vals.append(runtime_nclones)
34 elif "Running with" in line:
35 NEventsInFlight, NThreads =
map(
38 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
45 graph = TGraph(len(vals))
47 for runtime, nclones
in vals:
48 graph.SetPoint(counter, runtime, nclones)
51 graph.SetMarkerStyle(MarkerStyle)
52 graph.SetMarkerSize(MarkerSize)
53 graph.SetMarkerColor(Color)
55 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones" 60 def getText(x, y, text, scale, angle, colour, font, NDC=False):
63 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
67 lat.SetTextAngle(angle)
73 def getNclones(runtime_nclones):
74 return runtime_nclones[1]
76 max_nclones = int(
max(vals, key=getNclones)[1])
79 for i
in xrange(1, max_nclones + 1):
81 filter(
lambda runtime_nclones: runtime_nclones[1] == i, vals))
82 latexes.append(
getText(xmax * 1.01, i, n_algos, .7, 0, 600, 12))
84 label =
getText(.95, .55,
"Total", .8, 270, 600, 12,
True)
92 global NEventsInFlight
96 nalgorithms = len(vals)
98 canvas = TCanvas(
"Clones",
"Clones", 1024, 768)
106 map(
lambda latex: latex.Draw(), countLatexes)
109 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}" 110 % (NEventsInFlight, NThreads, nalgorithms), .8, 0, 2, 12,
True)
113 a = raw_input(
"press enter to continue")
114 canvas.Print(
"PlotClones.png")
117 if __name__ ==
"__main__":
120 print "Usage: plotClonesPyRoot.py logfilename" def getText(x, y, text, scale, angle, colour, font, NDC=False)
def parseLog(logfilename)
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
def getCountLatexes(vals, xmax)
struct GAUDI_API map
Parametrisation class for map-like implementation.