The Gaudi Framework  master (bdbe7744)
Loading...
Searching...
No Matches
plotClonesPyRoot Namespace Reference

Functions

 parseLog (logfilename)
 createGraph (vals)
 getText (x, y, text, scale, angle, colour, font, NDC=False)
 getCountLatexes (vals, xmax)
 doPlot (logfilename)

Variables

 Color = kBlue
 MarkerStyle = kFullStar
float MarkerSize = 3.8
int NEventsInFlight = 0
int NThreads = -1
 argc = len(sys.argv)

Function Documentation

◆ createGraph()

createGraph ( vals)

Definition at line 60 of file plotClonesPyRoot.py.

60def createGraph(vals):
61 graph = TGraph(len(vals))
62 counter = 0
63 for runtime, nclones in vals:
64 graph.SetPoint(counter, runtime, nclones)
65 counter += 1
66
67 graph.SetMarkerStyle(MarkerStyle)
68 graph.SetMarkerSize(MarkerSize)
69 graph.SetMarkerColor(Color)
70 graph.SetTitle(
71 "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones"
72 )
73 return graph
74
75

◆ doPlot()

doPlot ( logfilename)

Definition at line 108 of file plotClonesPyRoot.py.

108def doPlot(logfilename):
109 global NEventsInFlight
110 global NThreads
111 vals = parseLog(logfilename)
112 graph = createGraph(vals)
113 nalgorithms = len(vals)
114
115 canvas = TCanvas("Clones", "Clones", 1024, 768)
116 canvas.cd()
117 canvas.SetGrid()
118 graph.Draw("AP")
119
120 # Latex
121
122 countLatexes = getCountLatexes(vals, graph.GetXaxis().GetXmax())
123 map(lambda latex: latex.Draw(), countLatexes)
124 evtsIf = getText(
125 0.6,
126 0.365,
127 f"#splitline{{#splitline{{{NEventsInFlight} Simultaneous Events}}{{{NThreads} Threads}}}}{{{nalgorithms} Algorithms}}",
128 0.8,
129 0,
130 2,
131 12,
132 True,
133 )
134 evtsIf.Draw()
135
136 input("press enter to continue")
137 canvas.Print("PlotClones.png")
138
139

◆ getCountLatexes()

getCountLatexes ( vals,
xmax )

Definition at line 89 of file plotClonesPyRoot.py.

89def getCountLatexes(vals, xmax):
90 # print vals
91 def getNclones(runtime_nclones):
92 return runtime_nclones[1]
93
94 max_nclones = int(max(vals, key=getNclones)[1])
95
96 latexes = []
97 for i in range(1, max_nclones + 1):
98 n_algos = len(filter(lambda runtime_nclones: runtime_nclones[1] == i, vals))
99 latexes.append(getText(xmax * 1.01, i, n_algos, 0.7, 0, 600, 12))
100
101 label = getText(0.95, 0.55, "Total", 0.8, 270, 600, 12, True)
102
103 latexes.append(label)
104
105 return latexes
106
107

◆ getText()

getText ( x,
y,
text,
scale,
angle,
colour,
font,
NDC = False )

Definition at line 76 of file plotClonesPyRoot.py.

76def getText(x, y, text, scale, angle, colour, font, NDC=False):
77 lat = TLatex(
78 float(x),
79 float(y),
80 f"#scale[{scale}]{{#color[{colour}]{{#font[{font}]{{{text}}}}}}}",
81 )
82
83 lat.SetNDC(NDC)
84 if angle != 0.0:
85 lat.SetTextAngle(angle)
86 return lat
87
88

◆ parseLog()

parseLog ( logfilename)

Definition at line 32 of file plotClonesPyRoot.py.

32def parseLog(logfilename):
33 global NEventsInFlight
34 global NThreads
35 ifile = open(logfilename)
36 lines = ifile.readlines()
37 vals = []
38 for line in lines:
39 if "Summary: name=" in line:
40 runtime_nclones = map(
41 float,
42 re.match(
43 ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
44 line,
45 ).groups(),
46 )
47 vals.append(runtime_nclones)
48 elif "Running with" in line:
49 NEventsInFlight, NThreads = map(
50 int,
51 re.match(
52 ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
53 line,
54 ).groups(),
55 )
56
57 return vals
58
59

Variable Documentation

◆ argc

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 141 of file plotClonesPyRoot.py.

◆ Color

plotClonesPyRoot.Color = kBlue

Definition at line 24 of file plotClonesPyRoot.py.

◆ MarkerSize

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 26 of file plotClonesPyRoot.py.

◆ MarkerStyle

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 25 of file plotClonesPyRoot.py.

◆ NEventsInFlight

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 28 of file plotClonesPyRoot.py.

◆ NThreads

int plotClonesPyRoot.NThreads = -1

Definition at line 29 of file plotClonesPyRoot.py.