The Gaudi Framework  v36r9p1 (5c15b2bb)
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 = kBlue
 
 MarkerStyle = kFullStar
 
float MarkerSize = 3.8
 
int NEventsInFlight = 0
 
int NThreads = -1
 
 argc = len(sys.argv)
 

Function Documentation

◆ createGraph()

def plotClonesPyRoot.createGraph (   vals)

Definition at line 62 of file plotClonesPyRoot.py.

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

◆ doPlot()

def plotClonesPyRoot.doPlot (   logfilename)

Definition at line 110 of file plotClonesPyRoot.py.

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

◆ getCountLatexes()

def plotClonesPyRoot.getCountLatexes (   vals,
  xmax 
)

Definition at line 91 of file plotClonesPyRoot.py.

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

◆ getText()

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

Definition at line 78 of file plotClonesPyRoot.py.

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

◆ parseLog()

def plotClonesPyRoot.parseLog (   logfilename)

Definition at line 34 of file plotClonesPyRoot.py.

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

Variable Documentation

◆ argc

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 144 of file plotClonesPyRoot.py.

◆ Color

plotClonesPyRoot.Color = kBlue

Definition at line 26 of file plotClonesPyRoot.py.

◆ MarkerSize

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 28 of file plotClonesPyRoot.py.

◆ MarkerStyle

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 27 of file plotClonesPyRoot.py.

◆ NEventsInFlight

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 30 of file plotClonesPyRoot.py.

◆ NThreads

int plotClonesPyRoot.NThreads = -1

Definition at line 31 of file plotClonesPyRoot.py.

plotClonesPyRoot.getText
def getText(x, y, text, scale, angle, colour, font, NDC=False)
Definition: plotClonesPyRoot.py:78
plotClonesPyRoot.createGraph
def createGraph(vals)
Definition: plotClonesPyRoot.py:62
plotClonesPyRoot.parseLog
def parseLog(logfilename)
Definition: plotClonesPyRoot.py:34
max
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:225
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:91
plotClonesPyRoot.doPlot
def doPlot(logfilename)
Definition: plotClonesPyRoot.py:110
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:102