The Gaudi Framework  v36r11 (bdb84f5f)
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

list n_algos_in_flight_l = [1, 2, 5, 7, 10, 16, 20, 22]
 
list n_evts_in_flight_l = [1, 2, 4, 6, 7, 8, 9, 11, 13, 14, 15]
 
list colour_l = [kRed, kBlue, kOrange, kGreen, kMagenta, kCyan] * 2
 
list line_style_l = [1] * 6 + [2] * 6
 
list cloneFlag_l = [True, False]
 
tuple filename_scheleton
 
def runtimes = getRuntimes()
 

Function Documentation

◆ getGraphPoints()

def plotSpeedup.getGraphPoints (   n_evts_in_flight,
  cloneFlag,
  runtimes 
)

Definition at line 63 of file plotSpeedup.py.

63 def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes):
64  points = []
65  for key, rt in runtimes.items():
66  this_n_algos_in_flight, this_n_evts_in_flight, this_cloneFlag = key
67  if this_n_evts_in_flight == n_evts_in_flight and this_cloneFlag == cloneFlag:
68  points.append((this_n_algos_in_flight, rt))
69  return sorted(points)
70 
71 

◆ getRuntime()

def plotSpeedup.getRuntime (   n_algos_in_flight,
  n_evts_in_flight,
  cloneFlag 
)

Definition at line 35 of file plotSpeedup.py.

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

◆ getRuntimes()

def plotSpeedup.getRuntimes ( )

Definition at line 53 of file plotSpeedup.py.

53 def getRuntimes():
54  runtimes = {}
55  for n_algos_in_flight in n_algos_in_flight_l:
56  for n_evts_in_flight in n_evts_in_flight_l:
57  for cloneFlag in cloneFlag_l:
58  rt = getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
59  runtimes[n_algos_in_flight, n_evts_in_flight, cloneFlag] = rt
60  return runtimes
61 
62 

◆ getSingleGraph()

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

Definition at line 72 of file plotSpeedup.py.

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

◆ make_plot()

def plotSpeedup.make_plot (   runtimes,
  cloneFlag 
)

Definition at line 94 of file plotSpeedup.py.

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

Variable Documentation

◆ cloneFlag_l

list plotSpeedup.cloneFlag_l = [True, False]

Definition at line 25 of file plotSpeedup.py.

◆ colour_l

list plotSpeedup.colour_l = [kRed, kBlue, kOrange, kGreen, kMagenta, kCyan] * 2

Definition at line 23 of file plotSpeedup.py.

◆ filename_scheleton

tuple plotSpeedup.filename_scheleton
Initial value:
1 = (
2  "timing_measurement_BrunelScenario_n150_eif%s_aif%s_nthreads24_c%s_dqFalse.log"
3 )

Definition at line 30 of file plotSpeedup.py.

◆ line_style_l

list plotSpeedup.line_style_l = [1] * 6 + [2] * 6

Definition at line 24 of file plotSpeedup.py.

◆ n_algos_in_flight_l

list plotSpeedup.n_algos_in_flight_l = [1, 2, 5, 7, 10, 16, 20, 22]

Definition at line 21 of file plotSpeedup.py.

◆ n_evts_in_flight_l

list plotSpeedup.n_evts_in_flight_l = [1, 2, 4, 6, 7, 8, 9, 11, 13, 14, 15]

Definition at line 22 of file plotSpeedup.py.

◆ runtimes

def plotSpeedup.runtimes = getRuntimes()

Definition at line 142 of file plotSpeedup.py.

plotSpeedup.getRuntime
def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
Definition: plotSpeedup.py:35
plotSpeedup.getSingleGraph
def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style)
Definition: plotSpeedup.py:72
plotSpeedup.make_plot
def make_plot(runtimes, cloneFlag)
Definition: plotSpeedup.py:94
plotSpeedup.getRuntimes
def getRuntimes()
Definition: plotSpeedup.py:53
plotSpeedup.getGraphPoints
def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
Definition: plotSpeedup.py:63