| The Gaudi Framework v32r1 (f65d50dc)

Classes | Functions
makePlots Namespace Reference

## Classes
class | TimingInfo

## Functions
def | instancesVsTime (filename)
def | prepareTimingPlots (config="BrunelScenario", path="../options")

## Function Documentation

## ◆ instancesVsTime()

def makePlots.instancesVsTime | ( |  | filename | ) |

Definition at line 7 of file makePlots.py.

7 def instancesVsTime(filename):
8 logfile = open(filename)
9 nOfInstances = {}
10 runtime = {}
11 # extract all info
12 for line in logfile.readlines():
13 if "I ran" in line:
14 name = line.split("SUCCESS")[0]
15 runtime[name] = float(line.split("runtime of")[1])
16 if name in nOfInstances:
17 number = nOfInstances[name]
18 else:
19 number = 0
20 nOfInstances[name] = number + 1
21 # now sort it
22 x = []
23 y = []
24 for name in runtime:
25 x.append(runtime[name])
26 y.append(nOfInstances[name])
27 fig = plt.figure()
28 ax = fig.add_subplot(111)
29 yo = ax.scatter(x, y)
30 ax.grid(True)
31 plt.xlabel("Runtime (s)")
32 plt.ylabel("# instances")
33 plt.title(
34 "Requested algorithm instances with 10 events and 10 threads in parallel."
35 )
36 plt.savefig("test.pdf")
37
38
makePlots.instancesVsTime
def instancesVsTime(filename)
Definition: makePlots.py:7

## ◆ prepareTimingPlots()

def makePlots.prepareTimingPlots | ( |  | config = `"BrunelScenario"`,
|  |  | path = `"../options"`
| ) |  |

Definition at line 49 of file makePlots.py.

49 def prepareTimingPlots(config="BrunelScenario", path="../options"):
50
51 # first read all the timings
52 timings = []
53 for filename in os.listdir(path):
54 if filename.startswith(config) and filename.endswith("time"):
55 ff = open(os.path.join(path, filename))
56 time = ff.read().rstrip("\n")
57 timing = TimingInfo(filename, time)
58 timings.append(timing)
59 # now prepare the various plots:
60 # o parallel algos vs. time (for fixed parallel events)
61 fig = plt.figure()
62 ax = fig.add_subplot(111)
63 times = []
64 algos = []
65 for timing in timings:
66 if timing.events == 1:
67 times.append(timing.time)
68 algos.append(timing.algos)
69 ax.plot(algos, times)
70 plt.xlabel("Max algos in parallel")
71 plt.ylabel("runtime (s)")
72 plt.title("Brunel / CPUCruncher profiling.")
73
74 plt.savefig("timing.pdf")
75
76
makePlots.prepareTimingPlots
def prepareTimingPlots(config="BrunelScenario", path="../options")
Definition: makePlots.py:49