The Gaudi Framework  v32r2 (46d42edc)
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 45 of file plotClonesPyRoot.py.

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

◆ doPlot()

def plotClonesPyRoot.doPlot (   logfilename)

Definition at line 92 of file plotClonesPyRoot.py.

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

◆ getCountLatexes()

def plotClonesPyRoot.getCountLatexes (   vals,
  xmax 
)

Definition at line 72 of file plotClonesPyRoot.py.

72 def getCountLatexes(vals, xmax):
73  # print vals
74  def getNclones(runtime_nclones):
75  return runtime_nclones[1]
76 
77  max_nclones = int(max(vals, key=getNclones)[1])
78 
79  latexes = []
80  for i in range(1, max_nclones + 1):
81  n_algos = len(
82  filter(lambda runtime_nclones: runtime_nclones[1] == i, vals))
83  latexes.append(getText(xmax * 1.01, i, n_algos, .7, 0, 600, 12))
84 
85  label = getText(.95, .55, "Total", .8, 270, 600, 12, True)
86 
87  latexes.append(label)
88 
89  return latexes
90 
91 
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)
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.

◆ getText()

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

Definition at line 61 of file plotClonesPyRoot.py.

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

◆ parseLog()

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(
30  float,
31  re.match(
32  ".* avg_runtime= ([0-9]*.[0-9]*|[0-9]*.[0-9]*e-[0-9]*) n_clones= ([0-9]).*",
33  line).groups())
34  vals.append(runtime_nclones)
35  elif "Running with" in line:
36  NEventsInFlight, NThreads = map(
37  int,
38  re.match(
39  ".* Running with ([0-9]*) parallel events.*algorithms, ([0-9]*) threads",
40  line).groups())
41 
42  return vals
43 
44 
def parseLog(logfilename)
struct GAUDI_API map
Parametrisation class for map-like implementation.

Variable Documentation

◆ argc

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 119 of file plotClonesPyRoot.py.

◆ Color

plotClonesPyRoot.Color = kBlue

Definition at line 13 of file plotClonesPyRoot.py.

◆ MarkerSize

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 15 of file plotClonesPyRoot.py.

◆ MarkerStyle

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 14 of file plotClonesPyRoot.py.

◆ NEventsInFlight

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 17 of file plotClonesPyRoot.py.

◆ NThreads

int plotClonesPyRoot.NThreads = -1

Definition at line 18 of file plotClonesPyRoot.py.