The Gaudi Framework  v36r13 (995e4364)
plotSpeedup Namespace Reference

Functions

def getRuntime (n_algos_in_flight, n_evts_in_flight, cloneFlag)
 
def getRuntimes ()
 
def getGraphPoints (n_evts_in_flight, cloneFlag, runtimes)
 
def getSingleGraph (n_evts_in_flight, cloneFlag, runtimes, colour, style)
 
def make_plot (runtimes, cloneFlag)
 

Variables

 n_algos_in_flight_l
 
 n_evts_in_flight_l
 
 colour_l
 
 line_style_l
 
 cloneFlag_l
 
 filename_scheleton
 
 runtimes
 

Function Documentation

◆ getGraphPoints()

def plotSpeedup.getGraphPoints (   n_evts_in_flight,
  cloneFlag,
  runtimes 
)

Definition at line 68 of file plotSpeedup.py.

68 def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes):
69  points = []
70  for key, rt in runtimes.items():
71  this_n_algos_in_flight, this_n_evts_in_flight, this_cloneFlag = key
72  if this_n_evts_in_flight == n_evts_in_flight and this_cloneFlag == cloneFlag:
73  points.append((this_n_algos_in_flight, rt))
74  return sorted(points)
75 
76 

◆ getRuntime()

def plotSpeedup.getRuntime (   n_algos_in_flight,
  n_evts_in_flight,
  cloneFlag 
)

Definition at line 40 of file plotSpeedup.py.

40 def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag):
41  filename = filename_scheleton % (n_evts_in_flight, n_algos_in_flight, cloneFlag)
42  print(filename)
43  rt = 0.0
44  for line in open(filename, "r").readlines():
45  rt = float(line[:-1])
46  # print filename
47  # print rt
48  return rt
49 
50 
51 """
52 Dictionary with
53 o Key = [n_algos_in_flight, n_evts_in_flight, cloneFlag]
54 o Val = Runtime
55 """
56 
57 

◆ getRuntimes()

def plotSpeedup.getRuntimes ( )

Definition at line 58 of file plotSpeedup.py.

58 def getRuntimes():
59  runtimes = {}
60  for n_algos_in_flight in n_algos_in_flight_l:
61  for n_evts_in_flight in n_evts_in_flight_l:
62  for cloneFlag in cloneFlag_l:
63  rt = getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
64  runtimes[n_algos_in_flight, n_evts_in_flight, cloneFlag] = rt
65  return runtimes
66 
67 

◆ getSingleGraph()

def plotSpeedup.getSingleGraph (   n_evts_in_flight,
  cloneFlag,
  runtimes,
  colour,
  style 
)

Definition at line 77 of file plotSpeedup.py.

77 def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style):
78  points = getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
79  graph = ROOT.TGraph(len(points))
80  graph.GetXaxis().SetTitle("Maximum # in flight algos")
81  graph.GetXaxis().SetRangeUser(0, 23)
82  graph.GetYaxis().SetTitle("Runtime [s]")
83  graph.GetYaxis().SetTitleOffset(1.45)
84  graph.GetYaxis().SetRangeUser(0.1, 275)
85  graph.GetYaxis().SetNdivisions(12, 5, 1)
86  graph.SetLineWidth(3)
87  graph.SetLineColor(colour)
88  graph.SetMarkerColor(colour)
89  graph.SetLineStyle(style)
90  graph.SetFillColor(ROOT.kWhite)
91  point_n = 0
92  # print points
93  for x, y in points:
94  graph.SetPoint(point_n, x, y)
95  point_n += 1
96  return graph
97 
98 

◆ make_plot()

def plotSpeedup.make_plot (   runtimes,
  cloneFlag 
)

Definition at line 99 of file plotSpeedup.py.

99 def make_plot(runtimes, cloneFlag):
100  title = "Brunel 150 events"
101  clone_string = ""
102  if cloneFlag:
103  clone_string = "_clone"
104  title += " (Cloning)"
105  plotname = "runtime%s.pdf" % clone_string
106 
107  canvas = ROOT.TCanvas(plotname, "plot", 500, 400)
108  canvas.SetGrid()
109  canvas.cd()
110 
111  graphs = []
112  first = True
113  for colour, n_evts_in_flight, line_style in zip(
114  colour_l, n_evts_in_flight_l, line_style_l
115  ):
116  print(n_evts_in_flight)
117  graph = getSingleGraph(
118  n_evts_in_flight, cloneFlag, runtimes, colour, line_style
119  )
120  opts = "LSame"
121  if first:
122  opts = "AL"
123  first = False
124  graph.SetTitle(title)
125  graph.Draw(opts)
126  graphs.append(graph)
127 
128  # Make Legend
129  legend = ROOT.TLegend(0.499, 0.45, 0.9, 0.9, "# Parallel Events")
130  legend.SetTextSize(0.04)
131  legend.SetFillColor(ROOT.kWhite)
132  # evil
133  for graph, n in zip(graphs, n_evts_in_flight_l):
134  legend.AddEntry(graph, "%s" % n)
135  legend.Draw()
136 
137  # Add some text
138  l = ROOT.TLatex(0.13, 0.16, "#font[12]{#scale[.8]{24 Threads}}")
139  l.SetNDC()
140  l.Draw()
141 
142  input("Press enter to save...")
143  canvas.Print(plotname)
144 
145 
146 # -------------------------------------------------------------------------------

Variable Documentation

◆ cloneFlag_l

plotSpeedup.cloneFlag_l

Definition at line 30 of file plotSpeedup.py.

◆ colour_l

plotSpeedup.colour_l

Definition at line 21 of file plotSpeedup.py.

◆ filename_scheleton

plotSpeedup.filename_scheleton

Definition at line 35 of file plotSpeedup.py.

◆ line_style_l

plotSpeedup.line_style_l

Definition at line 29 of file plotSpeedup.py.

◆ n_algos_in_flight_l

plotSpeedup.n_algos_in_flight_l

Definition at line 19 of file plotSpeedup.py.

◆ n_evts_in_flight_l

plotSpeedup.n_evts_in_flight_l

Definition at line 20 of file plotSpeedup.py.

◆ runtimes

plotSpeedup.runtimes

Definition at line 147 of file plotSpeedup.py.

plotSpeedup.getRuntime
def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
Definition: plotSpeedup.py:40
plotSpeedup.getSingleGraph
def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style)
Definition: plotSpeedup.py:77
plotSpeedup.make_plot
def make_plot(runtimes, cloneFlag)
Definition: plotSpeedup.py:99
plotSpeedup.getRuntimes
def getRuntimes()
Definition: plotSpeedup.py:58
plotSpeedup.getGraphPoints
def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
Definition: plotSpeedup.py:68