Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v30r3 (a5ef0a68)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

def plotClonesPyRoot.createGraph (   vals)

Definition at line 39 of file plotClonesPyRoot.py.

39 def createGraph(vals):
40  graph = TGraph(len(vals))
41  counter = 0
42  for runtime, nclones in vals:
43  graph.SetPoint(counter, runtime, nclones)
44  counter += 1
45 
46  graph.SetMarkerStyle(MarkerStyle)
47  graph.SetMarkerSize(MarkerSize)
48  graph.SetMarkerColor(Color)
49  graph.SetTitle(
50  "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones")
51  return graph
52 
53 
def plotClonesPyRoot.doPlot (   logfilename)

Definition at line 96 of file plotClonesPyRoot.py.

96 def doPlot(logfilename):
97  global NEventsInFlight
98  global NThreads
99  vals = parseLog(logfilename)
100  graph = createGraph(vals)
101  nalgorithms = len(vals)
102 
103  canvas = TCanvas("Clones", "Clones", 1024, 768)
104  canvas.cd()
105  canvas.SetGrid()
106  graph.Draw("AP")
107 
108  # Latex
109 
110  countLatexes = getCountLatexes(vals, graph.GetXaxis().GetXmax())
111  map(lambda latex: latex.Draw(), countLatexes)
112  evtsIf = getText(.6, .365,
113  "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}" % (
114  NEventsInFlight, NThreads, nalgorithms),
115  .8, 0, 2, 12, True)
116  evtsIf.Draw()
117 
118  a = raw_input("press enter to continue")
119  canvas.Print("PlotClones.png")
120 
121 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
def parseLog(logfilename)
def getCountLatexes(vals, xmax)
def doPlot(logfilename)
struct GAUDI_API map
Parametrisation class for map-like implementation.
def plotClonesPyRoot.getCountLatexes (   vals,
  xmax 
)

Definition at line 64 of file plotClonesPyRoot.py.

64 def getCountLatexes(vals, xmax):
65  # print vals
66  def getNclones(runtime_nclones):
67  return runtime_nclones[1]
68  max_nclones = int(max(vals, key=getNclones)[1])
69 
70  latexes = []
71  for i in xrange(1, max_nclones + 1):
72  n_algos = len(
73  filter(lambda runtime_nclones: runtime_nclones[1] == i, vals))
74  latexes.append(getText(xmax * 1.01,
75  i,
76  n_algos,
77  .7,
78  0,
79  600,
80  12))
81 
82  label = getText(.95,
83  .55,
84  "Total",
85  .8,
86  270,
87  600,
88  12,
89  True)
90 
91  latexes.append(label)
92 
93  return latexes
94 
95 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
def getCountLatexes(vals, xmax)
def plotClonesPyRoot.getText (   x,
  y,
  text,
  scale,
  angle,
  colour,
  font,
  NDC = False 
)

Definition at line 54 of file plotClonesPyRoot.py.

54 def getText(x, y, text, scale, angle, colour, font, NDC=False):
55  lat = TLatex(float(x), float(y),
56  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
57 
58  lat.SetNDC(NDC)
59  if angle != 0.:
60  lat.SetTextAngle(angle)
61  return lat
62 
63 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
def plotClonesPyRoot.parseLog (   logfilename)

Definition at line 21 of file plotClonesPyRoot.py.

21 def parseLog(logfilename):
22  global NEventsInFlight
23  global NThreads
24  ifile = open(logfilename, "r")
25  lines = ifile.readlines()
26  vals = []
27  for line in lines:
28  if "Summary: name=" in line:
29  runtime_nclones = map(float,
30  re.match(".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*", line).groups())
31  vals.append(runtime_nclones)
32  elif "Running with" in line:
33  NEventsInFlight, NThreads = map(int, re.match(
34  ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads", line).groups())
35 
36  return vals
37 
38 
def parseLog(logfilename)
struct GAUDI_API map
Parametrisation class for map-like implementation.

Variable Documentation

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 123 of file plotClonesPyRoot.py.

plotClonesPyRoot.Color = kBlue

Definition at line 13 of file plotClonesPyRoot.py.

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 15 of file plotClonesPyRoot.py.

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 14 of file plotClonesPyRoot.py.

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 17 of file plotClonesPyRoot.py.

int plotClonesPyRoot.NThreads = -1

Definition at line 18 of file plotClonesPyRoot.py.