The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
plotSpeedup Namespace Reference

Functions

 getRuntime (n_algos_in_flight, n_evts_in_flight, cloneFlag)
 
 getRuntimes ()
 
 getGraphPoints (n_evts_in_flight, cloneFlag, runtimes)
 
 getSingleGraph (n_evts_in_flight, cloneFlag, runtimes, colour, style)
 
 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
 
list line_style_l = [1] * 6 + [2] * 6
 
list cloneFlag_l = [True, False]
 
tuple filename_scheleton
 
 runtimes = getRuntimes()
 

Function Documentation

◆ getGraphPoints()

plotSpeedup.getGraphPoints ( n_evts_in_flight,
cloneFlag,
runtimes )

Definition at line 69 of file plotSpeedup.py.

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

◆ getRuntime()

plotSpeedup.getRuntime ( n_algos_in_flight,
n_evts_in_flight,
cloneFlag )

Definition at line 41 of file plotSpeedup.py.

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

◆ getRuntimes()

plotSpeedup.getRuntimes ( )

Definition at line 59 of file plotSpeedup.py.

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

◆ getSingleGraph()

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

Definition at line 78 of file plotSpeedup.py.

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

◆ make_plot()

plotSpeedup.make_plot ( runtimes,
cloneFlag )

Definition at line 100 of file plotSpeedup.py.

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

Variable Documentation

◆ cloneFlag_l

list plotSpeedup.cloneFlag_l = [True, False]

Definition at line 31 of file plotSpeedup.py.

◆ colour_l

list plotSpeedup.colour_l
Initial value:
1= [
2 ROOT.kRed,
3 ROOT.kBlue,
4 ROOT.kOrange,
5 ROOT.kGreen,
6 ROOT.kMagenta,
7 ROOT.kCyan,
8] * 2

Definition at line 22 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 36 of file plotSpeedup.py.

◆ line_style_l

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

Definition at line 30 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 20 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 21 of file plotSpeedup.py.

◆ runtimes

plotSpeedup.runtimes = getRuntimes()

Definition at line 148 of file plotSpeedup.py.