Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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 44 of file plotClonesPyRoot.py.

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

Definition at line 91 of file plotClonesPyRoot.py.

91 def doPlot(logfilename):
92  global NEventsInFlight
93  global NThreads
94  vals = parseLog(logfilename)
95  graph = createGraph(vals)
96  nalgorithms = len(vals)
97 
98  canvas = TCanvas("Clones", "Clones", 1024, 768)
99  canvas.cd()
100  canvas.SetGrid()
101  graph.Draw("AP")
102 
103  # Latex
104 
105  countLatexes = getCountLatexes(vals, graph.GetXaxis().GetXmax())
106  map(lambda latex: latex.Draw(), countLatexes)
107  evtsIf = getText(
108  .6, .365,
109  "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"
110  % (NEventsInFlight, NThreads, nalgorithms), .8, 0, 2, 12, True)
111  evtsIf.Draw()
112 
113  a = raw_input("press enter to continue")
114  canvas.Print("PlotClones.png")
115 
116 
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 71 of file plotClonesPyRoot.py.

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

Definition at line 60 of file plotClonesPyRoot.py.

60 def getText(x, y, text, scale, angle, colour, font, NDC=False):
61  lat = TLatex(
62  float(x), float(y),
63  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
64 
65  lat.SetNDC(NDC)
66  if angle != 0.:
67  lat.SetTextAngle(angle)
68  return lat
69 
70 
def getText(x, y, text, scale, angle, colour, font, NDC=False)
def plotClonesPyRoot.parseLog (   logfilename)

Definition at line 20 of file plotClonesPyRoot.py.

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

Variable Documentation

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 118 of file plotClonesPyRoot.py.

plotClonesPyRoot.Color = kBlue

Definition at line 12 of file plotClonesPyRoot.py.

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 14 of file plotClonesPyRoot.py.

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 13 of file plotClonesPyRoot.py.

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 16 of file plotClonesPyRoot.py.

int plotClonesPyRoot.NThreads = -1

Definition at line 17 of file plotClonesPyRoot.py.