1 |
commit: f88db2f6927c447ec5be02a2d4d9bd2e2391f87f |
2 |
Author: spiros <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Jul 12 15:02:10 2011 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Jul 12 15:02:10 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=f88db2f6 |
7 |
|
8 |
Better reports (work on images and HTML). |
9 |
|
10 |
--- |
11 |
.../autobench/files/python/basemodule.py | 22 +++++++++++----- |
12 |
app-benchmarks/autobench/files/python/blasbase.py | 2 +- |
13 |
.../autobench/files/python/htmlreport.py | 27 +++++++++++++++---- |
14 |
app-benchmarks/autobench/files/python/main.py | 2 + |
15 |
4 files changed, 39 insertions(+), 14 deletions(-) |
16 |
|
17 |
diff --git a/app-benchmarks/autobench/files/python/basemodule.py b/app-benchmarks/autobench/files/python/basemodule.py |
18 |
index 93b5a77..f3ee50b 100644 |
19 |
--- a/app-benchmarks/autobench/files/python/basemodule.py |
20 |
+++ b/app-benchmarks/autobench/files/python/basemodule.py |
21 |
@@ -29,10 +29,10 @@ class BaseModule: |
22 |
|
23 |
passargs = [] |
24 |
for i in args: |
25 |
- if i == '-S': |
26 |
+ if i in ('-S', '--summary-only'): |
27 |
self.summary_only = True |
28 |
continue |
29 |
- elif i == '-s': |
30 |
+ elif i in ('-s', '--summary'): |
31 |
self.summary = True |
32 |
continue |
33 |
else: |
34 |
@@ -45,7 +45,11 @@ class BaseModule: |
35 |
output = sp.Popen( |
36 |
['eselect', '--no-color', '--brief', self.libname, 'list'], |
37 |
env={'ROOT' : root}, stdout=sp.PIPE).communicate()[0] |
38 |
- return output.strip().split('\n') |
39 |
+ output = output.strip() |
40 |
+ if '(none found)' in output: |
41 |
+ return [] |
42 |
+ else: |
43 |
+ return [i.split()[0] for i in output.split('\n')] |
44 |
|
45 |
def getTest(self, root, impl, testdir, logdir): |
46 |
TestClass = self._testClass() |
47 |
@@ -94,19 +98,22 @@ class BaseModule: |
48 |
# Save summary figure |
49 |
sprows = (len(self.tests)+1)/2 |
50 |
plt.figure(figsize=(16,6*sprows), dpi=300) |
51 |
+ plt.subplots_adjust(wspace=.4, hspace=.4) |
52 |
for i, test in enumerate(self.tests, 1): |
53 |
plt.subplot(sprows, 2, i) |
54 |
plt.title(test) |
55 |
for impl in newresults[test]: |
56 |
x,y = np.loadtxt(newresults[test][impl], unpack=True) |
57 |
plotf(x,y, label=impl, hold=True) |
58 |
- plt.legend(loc='best') |
59 |
+ if self.summary_only: |
60 |
+ plt.legend(loc='best') |
61 |
plt.xlabel('size') |
62 |
plt.ylabel('MFlops') |
63 |
plt.grid(True) |
64 |
fname = pjoin(cfg.reportdir, 'summary.png') |
65 |
- plt.savefig(fname, format='png') |
66 |
- html.addFig("Summary", image=os.path.basename(fname), width='95%') |
67 |
+ plt.savefig(fname, format='png', bbox_inches='tight', \ |
68 |
+ transparent=True) |
69 |
+ html.addFig("Summary", image=os.path.basename(fname), width='90%') |
70 |
Print('Summary figure saved: ' + fname) |
71 |
|
72 |
# Generate plots |
73 |
@@ -121,7 +128,8 @@ class BaseModule: |
74 |
plt.ylabel('MFlops') |
75 |
plt.grid(True) |
76 |
fname = pjoin(cfg.reportdir, test+".png") |
77 |
- plt.savefig(fname, format='png') |
78 |
+ plt.savefig(fname, format='png', bbox_inches='tight', \ |
79 |
+ transparent=True) |
80 |
html.addFig(test, image=os.path.basename(fname)) |
81 |
Print('Figure ' + fname + ' saved') |
82 |
|
83 |
|
84 |
diff --git a/app-benchmarks/autobench/files/python/blasbase.py b/app-benchmarks/autobench/files/python/blasbase.py |
85 |
index 664d706..e2c14ff 100644 |
86 |
--- a/app-benchmarks/autobench/files/python/blasbase.py |
87 |
+++ b/app-benchmarks/autobench/files/python/blasbase.py |
88 |
@@ -54,4 +54,4 @@ class BLASTest(btlbase.BTLTest): |
89 |
return ["libs/BLAS"] |
90 |
|
91 |
def _btl_defines(self): |
92 |
- return ["CBLASNAME=" + self.libname, "BLAS_INTERFACE"] |
93 |
\ No newline at end of file |
94 |
+ return ["CBLASNAME="+self.libname, self.libname.upper()+"_INTERFACE"] |
95 |
\ No newline at end of file |
96 |
|
97 |
diff --git a/app-benchmarks/autobench/files/python/htmlreport.py b/app-benchmarks/autobench/files/python/htmlreport.py |
98 |
index cb51da2..5e563fe 100644 |
99 |
--- a/app-benchmarks/autobench/files/python/htmlreport.py |
100 |
+++ b/app-benchmarks/autobench/files/python/htmlreport.py |
101 |
@@ -13,15 +13,14 @@ body { |
102 |
} |
103 |
|
104 |
img { |
105 |
- width:80%; |
106 |
+ height:80%; |
107 |
} |
108 |
|
109 |
-h1, h2, .plot, .descr, .date { |
110 |
+h1, h2, .plot, .descr, .info { |
111 |
text-align: center; |
112 |
} |
113 |
|
114 |
.fig { |
115 |
- background-color: #CCCCCC; |
116 |
margin-bottom: 50px; |
117 |
padding-top: 20px; |
118 |
padding-bottom: 20px; |
119 |
@@ -33,7 +32,23 @@ h1, h2, .plot, .descr, .date { |
120 |
""" |
121 |
self.content += title + "</h1>" |
122 |
date = time.strftime('%Y-%m-%d, %I:%M %p') |
123 |
- self.content += '<p class="date">Generated on ' + date + '</p>' |
124 |
+ self.content += '<p class="info">Generated on ' + date + '</p>' |
125 |
+ |
126 |
+ cpuinfo = file('/proc/cpuinfo', 'r').readlines() |
127 |
+ cpu = None |
128 |
+ for l in cpuinfo: |
129 |
+ if l[:10] == 'model name': |
130 |
+ cpu = l.split(':',1)[1].strip() |
131 |
+ if cpu: |
132 |
+ self.content += '<p class="info">CPU: ' + cpu + '</p>' |
133 |
+ |
134 |
+ meminfo = file('/proc/meminfo', 'r').readlines() |
135 |
+ mem = None |
136 |
+ for l in meminfo: |
137 |
+ if l[:8] == 'MemTotal': |
138 |
+ mem = l.split(':',1)[1].strip() |
139 |
+ if mem: |
140 |
+ self.content += '<p class="info">Total memory: ' + mem + '</p>' |
141 |
|
142 |
|
143 |
def addFig(self, title, image, descr='', alt='', width=None): |
144 |
@@ -45,10 +60,10 @@ h1, h2, .plot, .descr, .date { |
145 |
self.content += '<a href="' + image + '">' |
146 |
self.content += '<img src="' + image + '" alt="' + alt + '"' |
147 |
if width is not None: |
148 |
- self.content += ' style="width:' + str(width) + '"' |
149 |
+ self.content += ' style="width:' + str(width) + '; height:auto"' |
150 |
self.content += ' /></a>' |
151 |
self.content += '</div>' |
152 |
- self.content += '</div>' |
153 |
+ self.content += '</div><hr />' |
154 |
|
155 |
def close(self): |
156 |
self.content += "</body></html>" |
157 |
|
158 |
diff --git a/app-benchmarks/autobench/files/python/main.py b/app-benchmarks/autobench/files/python/main.py |
159 |
index 86c555a..8994168 100644 |
160 |
--- a/app-benchmarks/autobench/files/python/main.py |
161 |
+++ b/app-benchmarks/autobench/files/python/main.py |
162 |
@@ -190,6 +190,8 @@ for tn,(name,test) in enumerate(tests.items(),1): |
163 |
|
164 |
# Test every implementation |
165 |
test['results'] = {} |
166 |
+ if len(impls) == 0: |
167 |
+ Print("No implementation found") |
168 |
for impl in impls: |
169 |
Print("Testing " + impl) |
170 |
Print.down() |