The Gaudi Framework  master (37c0b60a)
plotClonesPyRoot Namespace Reference

Functions

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

Variables

 Color
 
 MarkerStyle
 
 MarkerSize
 
 NEventsInFlight
 
 NThreads
 
 argc
 

Function Documentation

◆ createGraph()

def plotClonesPyRoot.createGraph (   vals)

Definition at line 60 of file plotClonesPyRoot.py.

60 def 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()

def plotClonesPyRoot.doPlot (   logfilename)

Definition at line 108 of file plotClonesPyRoot.py.

108 def 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  "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"
128  % (NEventsInFlight, NThreads, nalgorithms),
129  0.8,
130  0,
131  2,
132  12,
133  True,
134  )
135  evtsIf.Draw()
136 
137  input("press enter to continue")
138  canvas.Print("PlotClones.png")
139 
140 

◆ getCountLatexes()

def plotClonesPyRoot.getCountLatexes (   vals,
  xmax 
)

Definition at line 89 of file plotClonesPyRoot.py.

89 def 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()

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

Definition at line 76 of file plotClonesPyRoot.py.

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

◆ parseLog()

def plotClonesPyRoot.parseLog (   logfilename)

Definition at line 32 of file plotClonesPyRoot.py.

32 def parseLog(logfilename):
33  global NEventsInFlight
34  global NThreads
35  ifile = open(logfilename, "r")
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

Definition at line 142 of file plotClonesPyRoot.py.

◆ Color

plotClonesPyRoot.Color

Definition at line 24 of file plotClonesPyRoot.py.

◆ MarkerSize

plotClonesPyRoot.MarkerSize

Definition at line 26 of file plotClonesPyRoot.py.

◆ MarkerStyle

plotClonesPyRoot.MarkerStyle

Definition at line 25 of file plotClonesPyRoot.py.

◆ NEventsInFlight

plotClonesPyRoot.NEventsInFlight

Definition at line 28 of file plotClonesPyRoot.py.

◆ NThreads

plotClonesPyRoot.NThreads

Definition at line 29 of file plotClonesPyRoot.py.

plotClonesPyRoot.getText
def getText(x, y, text, scale, angle, colour, font, NDC=False)
Definition: plotClonesPyRoot.py:76
plotClonesPyRoot.createGraph
def createGraph(vals)
Definition: plotClonesPyRoot.py:60
plotClonesPyRoot.parseLog
def parseLog(logfilename)
Definition: plotClonesPyRoot.py:32
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:35
plotClonesPyRoot.getCountLatexes
def getCountLatexes(vals, xmax)
Definition: plotClonesPyRoot.py:89
plotClonesPyRoot.doPlot
def doPlot(logfilename)
Definition: plotClonesPyRoot.py:108
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: details.h:97