12import matplotlib.pyplot
as plt
15def fFileExist(filename):
16 """Test if file exists"""
19 oFile = open(filename)
27def read(optlevel, b, name):
28 """read time from out/*.out and save plots to plots/. The cut deletes obviously wrong times."""
31 for i
in range(0, len(optlevel)):
32 if fFileExist(
"out/" + optlevel[i - z] +
".out") == 0:
36 value = [0] * len(optlevel)
37 sigma = [0] * len(optlevel)
38 valuenormed = [0] * len(optlevel)
39 sigmanormed = [0] * len(optlevel)
40 n = [0] * len(optlevel)
41 t = list(range(0, len(optlevel)))
43 fobj = open(
"out/" + optlevel[i] +
".out")
48 readvalue.append(1 / float(words[b]))
51 value[i] = np.mean(readvalue)
52 sigma[i] = np.std(readvalue)
53 u = list(range(0, len(readvalue)))
57 if readvalue[j - z] > 1.5 * value[i]
or readvalue[j - z] < 0.5 * value[i]:
60 sigma[i] = np.std(readvalue)
61 value[i] = np.mean(readvalue)
64 for i
in range(0, len(value)):
65 valuenormed[i] = value[i] * x
66 sigmanormed[i] = sigma[i] * x
77 (locs, labels) = plt.xticks(t, optlevel)
78 plt.setp(labels, rotation=90)
79 plt.xlim([-0.5, len(optlevel) - 0.5])
80 plt.ylabel(
"performance")
82 fig.subplots_adjust(bottom=0.65)
83 plt.savefig(
"plots/" + name +
".png")
85 fobj = open(
"plots/" + name +
".out",
"w")
92 + str(f
"{value[i]:.3f}")
94 + str(f
"{sigma[i]:.3f}")
96 + str(f
"{valuenormed[i]:.4f}")
98 + str(f
"{sigmanormed[i]:.4f}")
101 fobj.write(
r"\hline\n")
104name =
"CDCLegendreTracking"
105optlevel = [
"gcc-O0",
"gcc-O3",
"gcc-O3-native"]
106read(optlevel, 0, name)