The Gaudi Framework  v32r2 (46d42edc)
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]
 
string filename_scheleton = "timing_measurement_BrunelScenario_n150_eif%s_aif%s_nthreads24_c%s_dqFalse.log"
 
def runtimes = getRuntimes()
 

Detailed Description

Script that fetches all the logfiles from disk and reads the timings.
Parameters can be changed according to the working points considered.
Some parameters of the plots are hardcoded.

Function Documentation

◆ getGraphPoints()

def plotSpeedup.getGraphPoints (   n_evts_in_flight,
  cloneFlag,
  runtimes 
)

Definition at line 52 of file plotSpeedup.py.

52 def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes):
53  points = []
54  for key, rt in runtimes.items():
55  this_n_algos_in_flight, this_n_evts_in_flight, this_cloneFlag = key
56  if this_n_evts_in_flight == n_evts_in_flight and \
57  this_cloneFlag == cloneFlag:
58  points.append((this_n_algos_in_flight, rt))
59  return sorted(points)
60 
61 
def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
Definition: plotSpeedup.py:52

◆ getRuntime()

def plotSpeedup.getRuntime (   n_algos_in_flight,
  n_evts_in_flight,
  cloneFlag 
)

Definition at line 23 of file plotSpeedup.py.

23 def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag):
24  filename = filename_scheleton % (n_evts_in_flight, n_algos_in_flight,
25  cloneFlag)
26  print(filename)
27  rt = 0.
28  for line in open(filename, "r").readlines():
29  rt = float(line[:-1])
30  # print filename
31  # print rt
32  return rt
33 
34 
35 '''
36 Dictionary with
37 o Key = [n_algos_in_flight, n_evts_in_flight, cloneFlag]
38 o Val = Runtime
39 '''
40 
41 
def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
Definition: plotSpeedup.py:23

◆ getRuntimes()

def plotSpeedup.getRuntimes ( )

Definition at line 42 of file plotSpeedup.py.

42 def getRuntimes():
43  runtimes = {}
44  for n_algos_in_flight in n_algos_in_flight_l:
45  for n_evts_in_flight in n_evts_in_flight_l:
46  for cloneFlag in cloneFlag_l:
47  rt = getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
48  runtimes[n_algos_in_flight, n_evts_in_flight, cloneFlag] = rt
49  return runtimes
50 
51 
def getRuntimes()
Definition: plotSpeedup.py:42
def getRuntime(n_algos_in_flight, n_evts_in_flight, cloneFlag)
Definition: plotSpeedup.py:23

◆ getSingleGraph()

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

Definition at line 62 of file plotSpeedup.py.

62 def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style):
63  points = getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
64  graph = TGraph(len(points))
65  graph.GetXaxis().SetTitle("Maximum # in flight algos")
66  graph.GetXaxis().SetRangeUser(0, 23)
67  graph.GetYaxis().SetTitle("Runtime [s]")
68  graph.GetYaxis().SetTitleOffset(1.45)
69  graph.GetYaxis().SetRangeUser(0.1, 275)
70  graph.GetYaxis().SetNdivisions(12, 5, 1)
71  graph.SetLineWidth(3)
72  graph.SetLineColor(colour)
73  graph.SetMarkerColor(colour)
74  graph.SetLineStyle(style)
75  graph.SetFillColor(kWhite)
76  point_n = 0
77  # print points
78  for x, y in points:
79  graph.SetPoint(point_n, x, y)
80  point_n += 1
81  return graph
82 
83 
def getGraphPoints(n_evts_in_flight, cloneFlag, runtimes)
Definition: plotSpeedup.py:52
def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style)
Definition: plotSpeedup.py:62

◆ make_plot()

def plotSpeedup.make_plot (   runtimes,
  cloneFlag 
)

Definition at line 84 of file plotSpeedup.py.

84 def make_plot(runtimes, cloneFlag):
85  title = "Brunel 150 events"
86  clone_string = ""
87  if cloneFlag:
88  clone_string = "_clone"
89  title += " (Cloning)"
90  plotname = "runtime%s.pdf" % clone_string
91 
92  canvas = TCanvas(plotname, "plot", 500, 400)
93  canvas.SetGrid()
94  canvas.cd()
95 
96  graphs = []
97  first = True
98  for colour, n_evts_in_flight, line_style in zip(
99  colour_l, n_evts_in_flight_l, line_style_l):
100  print(n_evts_in_flight)
101  graph = getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour,
102  line_style)
103  opts = "LSame"
104  if first:
105  opts = "AL"
106  first = False
107  graph.SetTitle(title)
108  graph.Draw(opts)
109  graphs.append(graph)
110 
111  # Make Legend
112  legend = TLegend(.499, .45, .9, .9, "# Parallel Events")
113  legend.SetTextSize(0.04)
114  legend.SetFillColor(kWhite)
115  # evil
116  for graph, n in zip(graphs, n_evts_in_flight_l):
117  legend.AddEntry(graph, "%s" % n)
118  legend.Draw()
119 
120  # Add some text
121  l = TLatex(.13, .16, "#font[12]{#scale[.8]{24 Threads}}")
122  l.SetNDC()
123  l.Draw()
124 
125  dummy = raw_input("Press enter to save...")
126  canvas.Print(plotname)
127 
128 
129 # -------------------------------------------------------------------------------
def make_plot(runtimes, cloneFlag)
Definition: plotSpeedup.py:84
def getSingleGraph(n_evts_in_flight, cloneFlag, runtimes, colour, style)
Definition: plotSpeedup.py:62

Variable Documentation

◆ cloneFlag_l

list plotSpeedup.cloneFlag_l = [True, False]

Definition at line 15 of file plotSpeedup.py.

◆ colour_l

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

Definition at line 13 of file plotSpeedup.py.

◆ filename_scheleton

string plotSpeedup.filename_scheleton = "timing_measurement_BrunelScenario_n150_eif%s_aif%s_nthreads24_c%s_dqFalse.log"

Definition at line 20 of file plotSpeedup.py.

◆ line_style_l

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

Definition at line 14 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 11 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 12 of file plotSpeedup.py.

◆ runtimes

def plotSpeedup.runtimes = getRuntimes()

Definition at line 130 of file plotSpeedup.py.