-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_fill.py
52 lines (44 loc) · 1.65 KB
/
plot_fill.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import csv
import matplotlib.pyplot as plt
import sys
import statistics
def first(x):
return next(iter(x))
class impl:
def __init__(self):
self.values = { }
impls = { }
for i in range(2):
file = sys.argv[1] if len(sys.argv) == 2 else input("Please enter the .csv data file: ")
with open(file) as file:
lines = csv.reader(file)
for row in lines:
name = row[0] + str(i)
if name not in impls:
impls[name] = impl()
x = int(row[1])
y = 10**9 / int(row[3])
if (x not in impls[name].values):
impls[name].values[x] = [y]
else:
impls[name].values[x].append(y)
if len(list(impls.values())[0].values) > 1:
for k, v in impls.items():
values = v.values.values()
avgs = list(map(statistics.mean, values))
std = list(map(statistics.stdev, values)) if len(first(values)) > 1 else 0
plt.errorbar(v.values.keys(), avgs, yerr=std, label=k, fmt="-o", capsize=3, ecolor="black")
plt.xlabel("Processors")
plt.title("Fill throughput")
else:
values = list(impls.values())
avgs = list(map(lambda l: statistics.mean(first(l.values.values())), values))
std = list(map(lambda l: statistics.stdev(first(l.values.values())), values))
plt.errorbar(list(map(int, impls.keys())), avgs, yerr=std, label=list(values[0].values.keys())[0], fmt="-o", capsize=3, ecolor="black")
plt.xlabel("Blocks per window per thread")
plt.title("Relaxed-FIFO Window Size Comparison")
plt.xscale("log", base = 2)
plt.ylabel("Iterations per second")
plt.grid()
plt.legend()
plt.show()