1 from __future__
import print_function
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(
32 ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
34 vals.append(runtime_nclones)
35 elif "Running with" in line:
36 NEventsInFlight, NThreads =
map(
39 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
46 graph = TGraph(len(vals))
48 for runtime, nclones
in vals:
49 graph.SetPoint(counter, runtime, nclones)
52 graph.SetMarkerStyle(MarkerStyle)
53 graph.SetMarkerSize(MarkerSize)
54 graph.SetMarkerColor(Color)
56 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones" 61 def getText(x, y, text, scale, angle, colour, font, NDC=False):
64 "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
68 lat.SetTextAngle(angle)
74 def getNclones(runtime_nclones):
75 return runtime_nclones[1]
77 max_nclones = int(
max(vals, key=getNclones)[1])
80 for i
in range(1, max_nclones + 1):
82 filter(
lambda runtime_nclones: runtime_nclones[1] == i, vals))
83 latexes.append(
getText(xmax * 1.01, i, n_algos, .7, 0, 600, 12))
85 label =
getText(.95, .55,
"Total", .8, 270, 600, 12,
True)
93 global NEventsInFlight
97 nalgorithms = len(vals)
99 canvas = TCanvas(
"Clones",
"Clones", 1024, 768)
107 map(
lambda latex: latex.Draw(), countLatexes)
110 "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}" 111 % (NEventsInFlight, NThreads, nalgorithms), .8, 0, 2, 12,
True)
114 a = raw_input(
"press enter to continue")
115 canvas.Print(
"PlotClones.png")
118 if __name__ ==
"__main__":
121 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.
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.