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 37 of file plotClonesPyRoot.py.

37 def createGraph(vals):
38  graph = TGraph(len(vals))
39  counter=0
40  for runtime,nclones in vals:
41  graph.SetPoint(counter, runtime, nclones)
42  counter+=1
43 
44  graph.SetMarkerStyle(MarkerStyle)
45  graph.SetMarkerSize(MarkerSize)
46  graph.SetMarkerColor(Color)
47  graph.SetTitle("GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones")
48  return graph
49 
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(.6,.365,
108  "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"%(NEventsInFlight,NThreads,nalgorithms),
109  .8,0,2,12,True)
110  evtsIf.Draw()
111 
112 
113  a= raw_input("press enter to continue")
114  canvas.Print("PlotClones.png")
115 
116 
117 
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 59 of file plotClonesPyRoot.py.

59 def getCountLatexes(vals,xmax):
60  #print vals
61  def getNclones(runtime_nclones):
62  return runtime_nclones[1]
63  max_nclones = int(max(vals,key=getNclones)[1])
64 
65 
66  latexes=[]
67  for i in xrange(1,max_nclones+1):
68  n_algos = len( filter(lambda runtime_nclones:runtime_nclones[1]== i ,vals) )
69  latexes.append(getText(xmax*1.01,
70  i,
71  n_algos,
72  .7,
73  0,
74  600,
75  12))
76 
77 
78  label = getText(.95,
79  .55,
80  "Total",
81  .8,
82  270,
83  600,
84  12,
85  True)
86 
87  latexes.append(label)
88 
89  return latexes
90 
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 50 of file plotClonesPyRoot.py.

50 def getText(x,y,text,scale,angle,colour,font,NDC=False):
51  lat = TLatex(float(x),float(y),
52  "#scale[%s]{#color[%s]{#font[%s]{%s}}}"%(scale,colour,font,text))
53 
54  lat.SetNDC(NDC)
55  if angle!=0.:
56  lat.SetTextAngle(angle)
57  return lat
58 
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(".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",line).groups())
34 
35  return vals
36 
def parseLog(logfilename)
struct GAUDI_API map
Parametrisation class for map-like implementation.

Variable Documentation

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 119 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.