The Gaudi Framework  v36r1 (3e2fb5a8)
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 55 of file plotClonesPyRoot.py.

55 def createGraph(vals):
56  graph = TGraph(len(vals))
57  counter = 0
58  for runtime, nclones in vals:
59  graph.SetPoint(counter, runtime, nclones)
60  counter += 1
61 
62  graph.SetMarkerStyle(MarkerStyle)
63  graph.SetMarkerSize(MarkerSize)
64  graph.SetMarkerColor(Color)
65  graph.SetTitle(
66  "GaudiHive Speedup (Brunel, 100 evts);Algorithm Runtime [s];Number of Clones"
67  )
68  return graph
69 
70 

◆ doPlot()

def plotClonesPyRoot.doPlot (   logfilename)

Definition at line 102 of file plotClonesPyRoot.py.

102 def doPlot(logfilename):
103  global NEventsInFlight
104  global NThreads
105  vals = parseLog(logfilename)
106  graph = createGraph(vals)
107  nalgorithms = len(vals)
108 
109  canvas = TCanvas("Clones", "Clones", 1024, 768)
110  canvas.cd()
111  canvas.SetGrid()
112  graph.Draw("AP")
113 
114  # Latex
115 
116  countLatexes = getCountLatexes(vals, graph.GetXaxis().GetXmax())
117  map(lambda latex: latex.Draw(), countLatexes)
118  evtsIf = getText(
119  .6, .365,
120  "#splitline{#splitline{%s Simultaneous Events}{%s Threads}}{%s Algorithms}"
121  % (NEventsInFlight, NThreads, nalgorithms), .8, 0, 2, 12, True)
122  evtsIf.Draw()
123 
124  a = raw_input("press enter to continue")
125  canvas.Print("PlotClones.png")
126 
127 

◆ getCountLatexes()

def plotClonesPyRoot.getCountLatexes (   vals,
  xmax 
)

Definition at line 82 of file plotClonesPyRoot.py.

82 def getCountLatexes(vals, xmax):
83  # print vals
84  def getNclones(runtime_nclones):
85  return runtime_nclones[1]
86 
87  max_nclones = int(max(vals, key=getNclones)[1])
88 
89  latexes = []
90  for i in range(1, max_nclones + 1):
91  n_algos = len(
92  filter(lambda runtime_nclones: runtime_nclones[1] == i, vals))
93  latexes.append(getText(xmax * 1.01, i, n_algos, .7, 0, 600, 12))
94 
95  label = getText(.95, .55, "Total", .8, 270, 600, 12, True)
96 
97  latexes.append(label)
98 
99  return latexes
100 
101 

◆ getText()

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

Definition at line 71 of file plotClonesPyRoot.py.

71 def getText(x, y, text, scale, angle, colour, font, NDC=False):
72  lat = TLatex(
73  float(x), float(y),
74  "#scale[%s]{#color[%s]{#font[%s]{%s}}}" % (scale, colour, font, text))
75 
76  lat.SetNDC(NDC)
77  if angle != 0.:
78  lat.SetTextAngle(angle)
79  return lat
80 
81 

◆ parseLog()

def plotClonesPyRoot.parseLog (   logfilename)

Definition at line 31 of file plotClonesPyRoot.py.

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

Variable Documentation

◆ argc

plotClonesPyRoot.argc = len(sys.argv)

Definition at line 129 of file plotClonesPyRoot.py.

◆ Color

plotClonesPyRoot.Color = kBlue

Definition at line 23 of file plotClonesPyRoot.py.

◆ MarkerSize

float plotClonesPyRoot.MarkerSize = 3.8

Definition at line 25 of file plotClonesPyRoot.py.

◆ MarkerStyle

plotClonesPyRoot.MarkerStyle = kFullStar

Definition at line 24 of file plotClonesPyRoot.py.

◆ NEventsInFlight

int plotClonesPyRoot.NEventsInFlight = 0

Definition at line 27 of file plotClonesPyRoot.py.

◆ NThreads

int plotClonesPyRoot.NThreads = -1

Definition at line 28 of file plotClonesPyRoot.py.

plotClonesPyRoot.getText
def getText(x, y, text, scale, angle, colour, font, NDC=False)
Definition: plotClonesPyRoot.py:71
plotClonesPyRoot.createGraph
def createGraph(vals)
Definition: plotClonesPyRoot.py:55
plotClonesPyRoot.parseLog
def parseLog(logfilename)
Definition: plotClonesPyRoot.py:31
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:82
plotClonesPyRoot.doPlot
def doPlot(logfilename)
Definition: plotClonesPyRoot.py:102
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:97