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

Classes

class  TimingInfo
 

Functions

 instancesVsTime (filename)
 
 prepareTimingPlots (config="BrunelScenario", path="../options")
 

Function Documentation

◆ instancesVsTime()

makePlots.instancesVsTime ( filename)

Definition at line 19 of file makePlots.py.

19def instancesVsTime(filename):
20 logfile = open(filename)
21 nOfInstances = {}
22 runtime = {}
23 # extract all info
24 for line in logfile.readlines():
25 if "I ran" in line:
26 name = line.split("SUCCESS")[0]
27 runtime[name] = float(line.split("runtime of")[1])
28 if name in nOfInstances:
29 number = nOfInstances[name]
30 else:
31 number = 0
32 nOfInstances[name] = number + 1
33 # now sort it
34 x = []
35 y = []
36 for name in runtime:
37 x.append(runtime[name])
38 y.append(nOfInstances[name])
39 fig = plt.figure()
40 ax = fig.add_subplot(111)
41 ax.scatter(x, y)
42 ax.grid(True)
43 plt.xlabel("Runtime (s)")
44 plt.ylabel("# instances")
45 plt.title(
46 "Requested algorithm instances with 10 events and 10 threads in parallel."
47 )
48 plt.savefig("test.pdf")
49
50

◆ prepareTimingPlots()

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

Definition at line 61 of file makePlots.py.

61def prepareTimingPlots(config="BrunelScenario", path="../options"):
62 # first read all the timings
63 timings = []
64 for filename in os.listdir(path):
65 if filename.startswith(config) and filename.endswith("time"):
66 ff = open(os.path.join(path, filename))
67 time = ff.read().rstrip("\n")
68 timing = TimingInfo(filename, time)
69 timings.append(timing)
70 # now prepare the various plots:
71 # o parallel algos vs. time (for fixed parallel events)
72 fig = plt.figure()
73 ax = fig.add_subplot(111)
74 times = []
75 algos = []
76 for timing in timings:
77 if timing.events == 1:
78 times.append(timing.time)
79 algos.append(timing.algos)
80 ax.plot(algos, times)
81 plt.xlabel("Max algos in parallel")
82 plt.ylabel("runtime (s)")
83 plt.title("Brunel / CPUCruncher profiling.")
84
85 plt.savefig("timing.pdf")
86
87