1 |
commit: d6e2443b1bf4bac6e9ec836f6155d9d26e0a0d48 |
2 |
Author: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Feb 28 12:03:41 2012 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Tue Feb 28 12:03:41 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=d6e2443b |
7 |
|
8 |
Removed useless files and deprecated modules. |
9 |
|
10 |
--- |
11 |
cblastests.in | 12 -- |
12 |
fftwtests.in | 5 - |
13 |
lapacktests.in | 9 -- |
14 |
numbench/basemodule.py | 287 ------------------------------------------- |
15 |
numbench/benchchilds.py | 30 ----- |
16 |
numbench/blas.py | 23 ---- |
17 |
numbench/blas_accuracy.py | 164 ------------------------ |
18 |
numbench/blasbase.py | 82 ------------ |
19 |
numbench/btlbase.py | 194 ----------------------------- |
20 |
numbench/cblas.py | 23 ---- |
21 |
numbench/fftw.py | 86 ------------- |
22 |
numbench/lapack.py | 70 ----------- |
23 |
numbench/lapack_accuracy.py | 169 ------------------------- |
24 |
numbench/metis.py | 184 --------------------------- |
25 |
numbench/scalapack.py | 88 ------------- |
26 |
15 files changed, 0 insertions(+), 1426 deletions(-) |
27 |
|
28 |
diff --git a/cblastests.in b/cblastests.in |
29 |
deleted file mode 100644 |
30 |
index 670ddc4..0000000 |
31 |
--- a/cblastests.in |
32 |
+++ /dev/null |
33 |
@@ -1,12 +0,0 @@ |
34 |
-# Testing different implementations of CBLAS |
35 |
- |
36 |
-# cblas-reference is a wrapper for blas: test this with different blas implementations |
37 |
-reference-eigen sci-libs/cblas-reference-20110218 blas:eigen |
38 |
-reference-openblas sci-libs/cblas-reference-20110218 blas:openblas-threads |
39 |
-reference-acml sci-libs/cblas-reference-20110218 blas:acml64-gfortran |
40 |
- |
41 |
-# Other implementations are not wrappers |
42 |
-# Test them using gcc-4.6.1 and enabling vectorization |
43 |
-gsl gsl-1.15-r1 CC=gcc-4.6.1 CFLAGS="-O3 -pipe -march=native -msse3 -msse4.1 -msse4.2" |
44 |
-goto sci-libs/gotoblas2-1.13 CC=gcc-4.6.1 CFLAGS="-O3 -pipe -march=native -msse3 -msse4.1 -msse4.2" USE=incblas TARGET=NEHALEM |
45 |
-openblas sci-libs/openblas CC=gcc-4.6.1 CFLAGS="-O3 -pipe -march=native -msse3 -msse4.1 -msse4.2" USE=incblas TARGET=NEHALEM |
46 |
\ No newline at end of file |
47 |
|
48 |
diff --git a/fftwtests.in b/fftwtests.in |
49 |
deleted file mode 100644 |
50 |
index 04a905d..0000000 |
51 |
--- a/fftwtests.in |
52 |
+++ /dev/null |
53 |
@@ -1,5 +0,0 @@ |
54 |
-# Testing FFTW with different gcc versions and enabling vectorization |
55 |
- |
56 |
-gcc-4.6.1 sci-libs/fftw-3.2.2-r1 CC=gcc-4.6.1 CFLAGS="-O3 -march=native -msse2 -msse3 -mssse3 -msse4.1 -msse4.2" |
57 |
-gcc-4.5.2 sci-libs/fftw-3.2.2-r1 CC=gcc-4.5.2 CFLAGS="-O3 -march=native -msse2 -msse3 -mssse3 -msse4.1 -msse4.2" |
58 |
-gcc-4.3.6 sci-libs/fftw-3.2.2-r1 CC=gcc-4.3.6 CFLAGS="-O3 -march=native -msse2 -msse3 -mssse3 -msse4.1 -msse4.2" |
59 |
\ No newline at end of file |
60 |
|
61 |
diff --git a/lapacktests.in b/lapacktests.in |
62 |
deleted file mode 100644 |
63 |
index f427ebb..0000000 |
64 |
--- a/lapacktests.in |
65 |
+++ /dev/null |
66 |
@@ -1,9 +0,0 @@ |
67 |
-# Testing different implementations of LAPACK |
68 |
- |
69 |
-# lapack-reference relies on blas: test this with different blas implementations |
70 |
-reference_eigen sci-libs/lapack-reference-3.3.1-r1 blas:eigen |
71 |
-reference_openblas sci-libs/lapack-reference-3.3.1-r1 blas:openblas-threads |
72 |
- |
73 |
-# Testing other full LAPACK implementations enabling vectorization |
74 |
-atlas sci-libs/atlas-3.9.41 CFLAGS="-O3 -march=native -msse3 -msse4.1 -msse4.2" |
75 |
-acml sci-libs/acml-4.4.0-r1 -acml32-gfortran -acml32-gfortran-openmp |
76 |
\ No newline at end of file |
77 |
|
78 |
diff --git a/numbench/basemodule.py b/numbench/basemodule.py |
79 |
deleted file mode 100644 |
80 |
index 3e7beb7..0000000 |
81 |
--- a/numbench/basemodule.py |
82 |
+++ /dev/null |
83 |
@@ -1,287 +0,0 @@ |
84 |
-#===================================================== |
85 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
86 |
-#===================================================== |
87 |
-# |
88 |
-# This program is free software; you can redistribute it and/or |
89 |
-# modify it under the terms of the GNU General Public License |
90 |
-# as published by the Free Software Foundation; either version 2 |
91 |
-# of the License, or (at your option) any later version. |
92 |
-# |
93 |
-# This program is distributed in the hope that it will be useful, |
94 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
95 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
96 |
-# GNU General Public License for more details. |
97 |
-# You should have received a copy of the GNU General Public License |
98 |
-# along with this program; if not, write to the Free Software |
99 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
100 |
-# |
101 |
-from os.path import join as pjoin, basename, dirname |
102 |
-import subprocess as sp |
103 |
-import shlex, os, sys |
104 |
-import shutil as shu |
105 |
- |
106 |
-import benchconfig as cfg |
107 |
-from htmlreport import HTMLreport |
108 |
-import basemodule |
109 |
-from benchutils import mkdir, run_cmd |
110 |
-from benchprint import Print |
111 |
-import utils.benchpkgconfig as pc |
112 |
-from testdescr import testdescr |
113 |
- |
114 |
-try: |
115 |
- if not locals().has_key('initialized'): |
116 |
- initialized = True |
117 |
- import matplotlib |
118 |
- matplotlib.use('Agg') |
119 |
- import matplotlib.pyplot as plt |
120 |
- import numpy as np |
121 |
- with_images = True |
122 |
-except ImportError: |
123 |
- sys.stderr.write('Error: matplotlib and numpy are needed' + \ |
124 |
- 'in order to generate the reports!\n') |
125 |
- sys.stderr.write('Continue anyway.\n\n') |
126 |
- with_images = False |
127 |
- |
128 |
- |
129 |
-class BaseModule: |
130 |
- def __init__(self, args): |
131 |
- self.summary = False |
132 |
- self.summary_only = False |
133 |
- |
134 |
- self._initialize() |
135 |
- |
136 |
- passargs = [] |
137 |
- for i in args: |
138 |
- if i in ('-S', '--summary-only'): |
139 |
- self.summary_only = True |
140 |
- continue |
141 |
- elif i in ('-s', '--summary'): |
142 |
- self.summary = True |
143 |
- continue |
144 |
- else: |
145 |
- passargs += [i] |
146 |
- |
147 |
- self._parse_args(passargs) |
148 |
- |
149 |
- @classmethod |
150 |
- def printHelp(cls): |
151 |
- print "Usage: numbench " + cfg.modulename + " [options] [tests]" |
152 |
- print |
153 |
- print "Generic options:" |
154 |
- print " -s -summary" |
155 |
- print " Generate a summary image that contains all tests results" |
156 |
- print " and show it on the HTML report page." |
157 |
- print |
158 |
- print " -S -summary-only" |
159 |
- print " Only generate the summary image and skip all other plots." |
160 |
- print |
161 |
- |
162 |
- # Alternatives-2 version |
163 |
- def get_impls(self, root): |
164 |
- output = sp.Popen( |
165 |
- ['eselect', '--no-color', '--brief', self.libname, 'list'], |
166 |
- env={'ROOT' : root}, stdout=sp.PIPE).communicate()[0] |
167 |
- output = output.strip() |
168 |
- if '(none found)' in output: |
169 |
- return [] |
170 |
- else: |
171 |
- return [i.split()[0] for i in output.split('\n')] |
172 |
- |
173 |
- # Alternatives-2 version |
174 |
- def instructionsFor(self, impl): |
175 |
- Print("# eselect " + self.libname + " set " + impl) |
176 |
- |
177 |
- def getTest(self, root, impl, testdir, logdir): |
178 |
- TestClass = self._testClass() |
179 |
- t = TestClass(root, impl, testdir, logdir) |
180 |
- t.libname = self.libname |
181 |
- t.tests = self.tests |
182 |
- t.files = self.files |
183 |
- return t |
184 |
- |
185 |
- def save_results(self, results, plottype='plot', ylabel="MFlops"): |
186 |
- if not with_images: |
187 |
- Print("Report generation skipped - missing libraries") |
188 |
- return |
189 |
- |
190 |
- try: |
191 |
- plt.figure() |
192 |
- except: |
193 |
- Print("Unable to generate plots") |
194 |
- Print("Please make sure that X is running and $DISPLAY is set") |
195 |
- return |
196 |
- |
197 |
- # Copy inputfile and logs |
198 |
- shu.copytree(cfg.logdir, pjoin(cfg.reportdir, 'log')) |
199 |
- baseinfile = basename(cfg.inputfile) |
200 |
- shu.copy2(cfg.inputfile, pjoin(cfg.reportdir, baseinfile)) |
201 |
- |
202 |
- if plottype == 'plot': plotf = plt.plot |
203 |
- elif plottype == 'semilogx': plotf = plt.semilogx |
204 |
- elif plottype == 'semilogy': plotf = plt.semilogy |
205 |
- elif plottype == 'loglog': plotf = plt.loglog |
206 |
- else: |
207 |
- raise Exception('Unrecognized plot type: "' + plottype + '"') |
208 |
- |
209 |
- # Re-order the result dictionary |
210 |
- newresults = {} |
211 |
- for test in self.tests: |
212 |
- newresults[test] = {} |
213 |
- for nameimpl in results: |
214 |
- nameimplstr = pjoin(*nameimpl) |
215 |
- if results[nameimpl] == None: |
216 |
- continue |
217 |
- resdat = results[nameimpl][test] |
218 |
- newresults[test][nameimplstr] = resdat |
219 |
- |
220 |
- # Begin the HTML report |
221 |
- htmlfname = pjoin(cfg.reportdir, 'index.html') |
222 |
- html = HTMLreport(htmlfname) |
223 |
- |
224 |
- # Generate summary - a single image with all plots |
225 |
- if self.summary or self.summary_only: |
226 |
- # Save summary figure |
227 |
- sprows = (len(self.tests)+1)/2 |
228 |
- plt.figure(figsize=(16,6*sprows), dpi=300) |
229 |
- plt.subplots_adjust(wspace=.4, hspace=.4) |
230 |
- for i, test in enumerate(self.tests, 1): |
231 |
- plt.subplot(sprows, 2, i) |
232 |
- plt.title(testdescr[test]) |
233 |
- for impl in newresults[test]: |
234 |
- x,y = np.loadtxt(newresults[test][impl], unpack=True) |
235 |
- plotf(x,y, label=impl, hold=True) |
236 |
- if self.summary_only: |
237 |
- plt.legend(loc='best') |
238 |
- plt.xlabel('size') |
239 |
- plt.ylabel(ylabel) |
240 |
- plt.grid(True) |
241 |
- fname = pjoin(cfg.reportdir, 'summary.png') |
242 |
- plt.savefig(fname, format='png', bbox_inches='tight', \ |
243 |
- transparent=True) |
244 |
- html.addFig("Summary", image=os.path.basename(fname), width='90%') |
245 |
- Print('Summary figure saved: ' + fname) |
246 |
- |
247 |
- # Generate plots |
248 |
- if not self.summary_only: |
249 |
- for test in self.tests: |
250 |
- plt.figure(figsize=(12,9), dpi=300) |
251 |
- for impl in newresults[test]: |
252 |
- x,y = np.loadtxt(newresults[test][impl], unpack=True) |
253 |
- plotf(x,y, label=impl, hold=True) |
254 |
- plt.legend(loc='best') |
255 |
- plt.xlabel('size') |
256 |
- plt.ylabel(ylabel) |
257 |
- plt.grid(True) |
258 |
- fname = pjoin(cfg.reportdir, test+".png") |
259 |
- plt.savefig(fname, format='png', bbox_inches='tight', \ |
260 |
- transparent=True) |
261 |
- html.addFig(testdescr[test], image=os.path.basename(fname)) |
262 |
- Print('Figure ' + fname + ' saved') |
263 |
- |
264 |
- html.close() |
265 |
- Print('HTML report generated: ' + htmlfname) |
266 |
- |
267 |
-class CompilationError(Exception): |
268 |
- def __init__(self, logfile): |
269 |
- self.logfile = logfile |
270 |
- |
271 |
- |
272 |
-class BaseTest: |
273 |
- libname = None |
274 |
- tests = None |
275 |
- files = None |
276 |
- |
277 |
- def __init__(self, root, impl, testdir, logdir): |
278 |
- self.root = root |
279 |
- self.impl = impl |
280 |
- self.testdir = testdir |
281 |
- self.logdir = pjoin(logdir, impl) |
282 |
- self.compileenv = {} |
283 |
- self.runenv = {} |
284 |
- |
285 |
- mkdir(self.logdir) |
286 |
- |
287 |
- self.libdir = cfg.libdir |
288 |
- while self.libdir[0] == '/': |
289 |
- self.libdir = self.libdir[1:] |
290 |
- self.libdir = pjoin(self.root, self.libdir) |
291 |
- |
292 |
- # Base version |
293 |
- def _generateResults(self): |
294 |
- return dict(zip(self.tests, self.files)) |
295 |
- |
296 |
- # Alternatives-2 version with pkg-config |
297 |
- def _get_flags(self): |
298 |
- # 1. Run with no requires |
299 |
- pfile = pc.getFile(self.libname, self.impl, self.root) |
300 |
- flags = pc.run(pfile, self.root, False) |
301 |
- logfile = file(pjoin(self.logdir, 'pkg-config.log'), 'w') |
302 |
- print >> logfile, "File:", pfile |
303 |
- print >> logfile, "Result:", flags |
304 |
- |
305 |
- # 2. Get requires |
306 |
- requires = pc.requires(pfile) |
307 |
- print >> logfile, "Requires:", requires |
308 |
- |
309 |
- # 3.Substitute requires and add flags |
310 |
- for r in requires: |
311 |
- if r in self.changes.keys(): |
312 |
- pfile = pc.getFile(r, self.changes[r]) |
313 |
- flags += ' ' + pc.run(pfile) |
314 |
- else: |
315 |
- flags += ' ' + pc.run(r) |
316 |
- print >> logfile, "Third run:", flags |
317 |
- logfile.close() |
318 |
- |
319 |
- return shlex.split(flags) |
320 |
- |
321 |
- def run_test(self, changes={}): |
322 |
- self.changes = changes |
323 |
- |
324 |
- # Convenient renames and definition of report files |
325 |
- name = self.libname |
326 |
- root = self.root |
327 |
- testdir = self.testdir |
328 |
- self.files = [pjoin(testdir,f) for f in self.files] |
329 |
- if cfg.libdir[0] == '/': |
330 |
- libdir = root+cfg.libdir |
331 |
- else: |
332 |
- libdir = pjoin(root, cfg.libdir) |
333 |
- |
334 |
- # Create dir. If all results already exist use them and do not perform |
335 |
- # the tests, otherwise remove every old results. |
336 |
- runtests = False |
337 |
- if os.path.exists(testdir): |
338 |
- runtests = not all([os.path.exists(i) for i in self.files]) |
339 |
- else: |
340 |
- os.makedirs(testdir) |
341 |
- runtests = True |
342 |
- if not runtests: |
343 |
- Print("Not testing: results exist") |
344 |
- return self._generateResults() |
345 |
- for i in self.files: |
346 |
- if os.path.exists(i): os.remove(i) |
347 |
- |
348 |
- # Compile test suite |
349 |
- try: |
350 |
- returncode, exe, logfile = self._compileTest() |
351 |
- if returncode != 0: |
352 |
- raise CompilationError(logfile) |
353 |
- except CompilationError as e: |
354 |
- Print("Compilation failed") |
355 |
- Print("See log: " + e.logfile) |
356 |
- return |
357 |
- Print("Compilation successful") |
358 |
- |
359 |
- # Run test |
360 |
- logfile = pjoin(self.logdir, name+"_run.log") |
361 |
- retcode = self._executeTest(exe, logfile=logfile) |
362 |
- if retcode != 0: |
363 |
- Print("Test failed") |
364 |
- Print("See log: " + logfile) |
365 |
- return |
366 |
- Print("Test successful") |
367 |
- |
368 |
- # Return |
369 |
- return self._generateResults() |
370 |
- |
371 |
|
372 |
diff --git a/numbench/benchchilds.py b/numbench/benchchilds.py |
373 |
deleted file mode 100644 |
374 |
index 1686639..0000000 |
375 |
--- a/numbench/benchchilds.py |
376 |
+++ /dev/null |
377 |
@@ -1,30 +0,0 @@ |
378 |
-#===================================================== |
379 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
380 |
-#===================================================== |
381 |
-# |
382 |
-# This program is free software; you can redistribute it and/or |
383 |
-# modify it under the terms of the GNU General Public License |
384 |
-# as published by the Free Software Foundation; either version 2 |
385 |
-# of the License, or (at your option) any later version. |
386 |
-# |
387 |
-# This program is distributed in the hope that it will be useful, |
388 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
389 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
390 |
-# GNU General Public License for more details. |
391 |
-# You should have received a copy of the GNU General Public License |
392 |
-# along with this program; if not, write to the Free Software |
393 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
394 |
-# |
395 |
-try: |
396 |
- copy = procs |
397 |
- del copy |
398 |
-except: |
399 |
- procs = [] |
400 |
- |
401 |
-def terminate(): |
402 |
- for p in procs: |
403 |
- if p.poll() is None: |
404 |
- p.kill() |
405 |
- |
406 |
-def append(proc): |
407 |
- procs.append(proc) |
408 |
\ No newline at end of file |
409 |
|
410 |
diff --git a/numbench/blas.py b/numbench/blas.py |
411 |
deleted file mode 100644 |
412 |
index afdaa19..0000000 |
413 |
--- a/numbench/blas.py |
414 |
+++ /dev/null |
415 |
@@ -1,23 +0,0 @@ |
416 |
-#===================================================== |
417 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
418 |
-#===================================================== |
419 |
-# |
420 |
-# This program is free software; you can redistribute it and/or |
421 |
-# modify it under the terms of the GNU General Public License |
422 |
-# as published by the Free Software Foundation; either version 2 |
423 |
-# of the License, or (at your option) any later version. |
424 |
-# |
425 |
-# This program is distributed in the hope that it will be useful, |
426 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
427 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
428 |
-# GNU General Public License for more details. |
429 |
-# You should have received a copy of the GNU General Public License |
430 |
-# along with this program; if not, write to the Free Software |
431 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
432 |
-# |
433 |
-import blasbase |
434 |
- |
435 |
-class Module(blasbase.BLASBase): |
436 |
- def _initialize(self): |
437 |
- self.libname = "blas" |
438 |
- blasbase.BLASBase._initialize(self) |
439 |
\ No newline at end of file |
440 |
|
441 |
diff --git a/numbench/blas_accuracy.py b/numbench/blas_accuracy.py |
442 |
deleted file mode 100644 |
443 |
index f194d31..0000000 |
444 |
--- a/numbench/blas_accuracy.py |
445 |
+++ /dev/null |
446 |
@@ -1,164 +0,0 @@ |
447 |
-#===================================================== |
448 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
449 |
-#===================================================== |
450 |
-# |
451 |
-# This program is free software; you can redistribute it and/or |
452 |
-# modify it under the terms of the GNU General Public License |
453 |
-# as published by the Free Software Foundation; either version 2 |
454 |
-# of the License, or (at your option) any later version. |
455 |
-# |
456 |
-# This program is distributed in the hope that it will be useful, |
457 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
458 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
459 |
-# GNU General Public License for more details. |
460 |
-# You should have received a copy of the GNU General Public License |
461 |
-# along with this program; if not, write to the Free Software |
462 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
463 |
-# |
464 |
-import subprocess as sp |
465 |
-import shlex, os |
466 |
-from os.path import join as pjoin |
467 |
- |
468 |
-from benchutils import mkdir, run_cmd |
469 |
-from benchprint import Print |
470 |
-from htmlreport import HTMLreport |
471 |
-import basemodule |
472 |
-import benchconfig as cfg |
473 |
-import benchchildren |
474 |
- |
475 |
-class Module(basemodule.BaseModule): |
476 |
- |
477 |
- def _initialize(self): |
478 |
- self.libname = 'blas' |
479 |
- self.avail=['axpy', 'matrix_vector', 'trisolve_vector', 'matrix_matrix'] |
480 |
- |
481 |
- def _parse_args(self, args): |
482 |
- # Parse arguments |
483 |
- tests = [] |
484 |
- for i in args: |
485 |
- if i in self.avail: |
486 |
- tests.append(i) |
487 |
- continue |
488 |
- raise Exception("Argument not recognized: " + i) |
489 |
- |
490 |
- # Sort tests |
491 |
- self.tests = [i for i in self.avail if i in tests] |
492 |
- |
493 |
- # If no test is specified, then do everything |
494 |
- if len(self.tests) == 0: |
495 |
- self.tests = self.avail |
496 |
- |
497 |
- # Generate list of dat (result) files, relative to the testdir |
498 |
- self.files = [pjoin('accuracy_%s_%s.dat' % (op, self.libname)) \ |
499 |
- for op in self.tests] |
500 |
- |
501 |
- @staticmethod |
502 |
- def _testClass(): |
503 |
- return BLAS_accuracyTest |
504 |
- |
505 |
- |
506 |
- def save_results(self, results): |
507 |
- basemodule.BaseModule.save_results(self, results, 'loglog') |
508 |
- |
509 |
-class BLAS_accuracyTest(basemodule.BaseTest): |
510 |
- |
511 |
- compileenv = {} |
512 |
- runenv = {} |
513 |
- |
514 |
- def _compileTest(self): |
515 |
- self.compileenv = {} |
516 |
- |
517 |
- # Flags and envvars lists |
518 |
- includes = [pjoin(self.root, 'usr/include')] |
519 |
- libraries = [] |
520 |
- libdirs = [self.libdir] |
521 |
- defines = ['NDEBUG'] |
522 |
- flags = [] |
523 |
- |
524 |
- ## Interpret flags |
525 |
- for flag in self._get_flags() + \ |
526 |
- shlex.split(run_cmd(['portageq', 'envvar', 'CXXFLAGS']).strip()): |
527 |
- flag = flag.strip() |
528 |
- if flag[:2] == '-l': |
529 |
- libraries.append(flag[2:]) |
530 |
- elif flag[:2] == '-L': |
531 |
- libdirs.append(flag[2:]) |
532 |
- elif flag[:2] == '-I': |
533 |
- includes.append(flag[2:]) |
534 |
- else: |
535 |
- flags.append(flag) |
536 |
- |
537 |
- # Set compile environment |
538 |
- self.compileenv['INCLUDE_PATH'] = ':'.join(includes) |
539 |
- self.compileenv['LIBRARY_PATH'] = ':'.join(libdirs) |
540 |
- self.compileenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
541 |
- self.runenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
542 |
- |
543 |
- exe = pjoin(self.testdir, "test") |
544 |
- source = pjoin(cfg.btldir, "accuracy/main_blas.cpp") |
545 |
- |
546 |
- # Retrieve compiler |
547 |
- cxx = 'g++' |
548 |
- cxx_portage = run_cmd(['portageq', 'envvar', 'CXX']).strip() |
549 |
- if cxx_portage != '': |
550 |
- cxx = cxx_portage |
551 |
- if os.environ.has_key('CXX'): |
552 |
- cxx = os.environ['CXX'] |
553 |
- |
554 |
- # Form command line arguments |
555 |
- args = [cxx, source, '-o', exe] |
556 |
- args += ['-I'+I for I in includes] |
557 |
- args += ['-l'+l for l in libraries] |
558 |
- args += ['-L'+L for L in libdirs] |
559 |
- args += ['-D'+D for D in defines] |
560 |
- args += flags |
561 |
- |
562 |
- # Open logfile or redirect to PIPE |
563 |
- logfile = file(pjoin(self.logdir, "compile.log"), 'w') |
564 |
- logfile.write(' '.join([n+'='+v for n,v in self.compileenv.items()])) |
565 |
- logfile.write(' ' + ' '.join(args) + '\n' + 80*'-' + '\n') |
566 |
- logfile.flush() |
567 |
- |
568 |
- # Execute |
569 |
- proc=sp.Popen(args,stdout=logfile,stderr=sp.STDOUT,env=self.compileenv) |
570 |
- proc.wait() |
571 |
- |
572 |
- # Close, return |
573 |
- logfile.close() |
574 |
- return proc.returncode, exe, logfile.name |
575 |
- |
576 |
- |
577 |
- def _executeTest(self, exe, logfile): |
578 |
- # Log dynamic link |
579 |
- lddlogfile = file(pjoin(self.logdir, 'ldd.log'), 'w') |
580 |
- sp.Popen(['ldd', '-v', exe], stdout=lddlogfile, env=self.runenv).wait() |
581 |
- |
582 |
- # Open pipe |
583 |
- logfile = file(logfile, 'w') |
584 |
- args = [exe] + self.tests |
585 |
- logfile.write(' '.join([n+'='+v for n,v in self.runenv.items()]) + ' ') |
586 |
- logfile.write(' '.join(args) + '\n') |
587 |
- logfile.write(80*'-' + '\n') |
588 |
- proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=sp.PIPE, |
589 |
- env=self.runenv, cwd=self.testdir) |
590 |
- benchchildren.append(proc) |
591 |
- |
592 |
- # Interpret output |
593 |
- Print.down() |
594 |
- while True: |
595 |
- line = proc.stdout.readline() |
596 |
- if not line: |
597 |
- break |
598 |
- logfile.write(line) |
599 |
- if len(line.strip()) == 0: |
600 |
- continue |
601 |
- if line[0] != ' ': |
602 |
- Print.up() |
603 |
- Print(line.strip().split()[-1]) |
604 |
- Print.down() |
605 |
- else: |
606 |
- Print(line.strip()) |
607 |
- Print.up() |
608 |
- logfile.close() |
609 |
- proc.wait() |
610 |
- return proc.returncode |
611 |
|
612 |
diff --git a/numbench/blasbase.py b/numbench/blasbase.py |
613 |
deleted file mode 100644 |
614 |
index c08987f..0000000 |
615 |
--- a/numbench/blasbase.py |
616 |
+++ /dev/null |
617 |
@@ -1,82 +0,0 @@ |
618 |
-#===================================================== |
619 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
620 |
-#===================================================== |
621 |
-# |
622 |
-# This program is free software; you can redistribute it and/or |
623 |
-# modify it under the terms of the GNU General Public License |
624 |
-# as published by the Free Software Foundation; either version 2 |
625 |
-# of the License, or (at your option) any later version. |
626 |
-# |
627 |
-# This program is distributed in the hope that it will be useful, |
628 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
629 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
630 |
-# GNU General Public License for more details. |
631 |
-# You should have received a copy of the GNU General Public License |
632 |
-# along with this program; if not, write to the Free Software |
633 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
634 |
-# |
635 |
-import os, btlbase |
636 |
-import subprocess as sp |
637 |
-import shlex |
638 |
-from os.path import join as pjoin |
639 |
- |
640 |
-avail1 = ['axpy', 'axpby', 'rot'] |
641 |
-avail2 = ['matrix_vector','atv','symv', 'ger', 'syr2', |
642 |
- 'trisolve_vector'] |
643 |
-avail3 = ['matrix_matrix', 'aat', 'trisolve_matrix', 'trmm'] |
644 |
- |
645 |
-class BLASBase(btlbase.BTLBase): |
646 |
- |
647 |
- avail1 = avail1 |
648 |
- avail2 = avail2 |
649 |
- avail3 = avail3 |
650 |
- avail = avail1 + avail2 + avail3 |
651 |
- |
652 |
- def _initialize(self): |
653 |
- pass |
654 |
- |
655 |
- def _parse_args(self, args): |
656 |
- passargs = [] |
657 |
- # Parse arguments |
658 |
- tests = [] |
659 |
- for i in args: |
660 |
- if i == '1': |
661 |
- tests += self.avail1 |
662 |
- continue |
663 |
- if i == '2': |
664 |
- tests += self.avail2 |
665 |
- continue |
666 |
- if i == '3': |
667 |
- tests += self.avail3 |
668 |
- continue |
669 |
- if i in self.avail: |
670 |
- tests.append(i) |
671 |
- continue |
672 |
- passargs.append(i) |
673 |
- |
674 |
- # Sort tests |
675 |
- self.tests = [i for i in self.avail if i in tests] |
676 |
- |
677 |
- # If no test is specified, then choose four standard tests |
678 |
- if len(self.tests) == 0: |
679 |
- self.tests = ['axpy', 'matrix_vector', \ |
680 |
- 'trisolve_vector', 'matrix_matrix'] |
681 |
- |
682 |
- btlbase.BTLBase._parse_args(self, passargs) |
683 |
- |
684 |
- @staticmethod |
685 |
- def _testClass(): |
686 |
- return BLASTest |
687 |
- |
688 |
- |
689 |
-class BLASTest(btlbase.BTLTest): |
690 |
- @staticmethod |
691 |
- def _btl_source(): |
692 |
- return "libs/BLAS/main.cpp" |
693 |
- |
694 |
- @staticmethod |
695 |
- def _btl_includes(): |
696 |
- return ["libs/BLAS"] |
697 |
- |
698 |
- def _btl_defines(self): |
699 |
- return ["CBLASNAME="+self.libname, self.libname.upper()+"_INTERFACE"] |
700 |
\ No newline at end of file |
701 |
|
702 |
diff --git a/numbench/btlbase.py b/numbench/btlbase.py |
703 |
deleted file mode 100644 |
704 |
index 23f1c51..0000000 |
705 |
--- a/numbench/btlbase.py |
706 |
+++ /dev/null |
707 |
@@ -1,194 +0,0 @@ |
708 |
-#===================================================== |
709 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
710 |
-#===================================================== |
711 |
-# |
712 |
-# This program is free software; you can redistribute it and/or |
713 |
-# modify it under the terms of the GNU General Public License |
714 |
-# as published by the Free Software Foundation; either version 2 |
715 |
-# of the License, or (at your option) any later version. |
716 |
-# |
717 |
-# This program is distributed in the hope that it will be useful, |
718 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
719 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
720 |
-# GNU General Public License for more details. |
721 |
-# You should have received a copy of the GNU General Public License |
722 |
-# along with this program; if not, write to the Free Software |
723 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
724 |
-# |
725 |
-import sys, os, shlex |
726 |
-import subprocess as sp |
727 |
-from os.path import join as pjoin |
728 |
- |
729 |
-from benchutils import mkdir, run_cmd |
730 |
-from benchprint import Print |
731 |
-from htmlreport import HTMLreport |
732 |
-import basemodule |
733 |
-import benchconfig as cfg |
734 |
-import benchchildren |
735 |
-from testdescr import testdescr |
736 |
- |
737 |
-class BTLBase(basemodule.BaseModule): |
738 |
- |
739 |
- @classmethod |
740 |
- def printHelp(cls): |
741 |
- basemodule.BaseModule.printHelp() |
742 |
- |
743 |
- print "Tests:" |
744 |
- for i in cls.avail: |
745 |
- print " " + i + ":" |
746 |
- print " " + testdescr[i] |
747 |
- print |
748 |
- |
749 |
- def _parse_args(self, args): |
750 |
- # Generate list of dat (result) files, relative to the testdir |
751 |
- self.files = [pjoin('bench_%s_%s.dat' % (op, self.libname)) \ |
752 |
- for op in self.tests] |
753 |
- |
754 |
- for i in args: |
755 |
- if i[:2] == '-N': |
756 |
- BTLTest.N = i[2:] |
757 |
- continue |
758 |
- raise Exception("Argument not recognized: " + i) |
759 |
- |
760 |
- def save_results(self, results): |
761 |
- basemodule.BaseModule.save_results(self, results, 'semilogx') |
762 |
- |
763 |
- |
764 |
-class BTLTest(basemodule.BaseTest): |
765 |
- |
766 |
- N = None |
767 |
- |
768 |
- def _compileTest(self): |
769 |
- self.compileenv = {} |
770 |
- self.runenv = {} |
771 |
- |
772 |
- # Includes |
773 |
- includes = [pjoin(cfg.btldir, i) for i in \ |
774 |
- ('actions', 'generic_bench', 'generic_bench/utils', 'libs/STL') + \ |
775 |
- tuple(self._btl_includes())] + [pjoin(self.root, 'usr/include')] |
776 |
- |
777 |
- # Libraries |
778 |
- libraries = ['rt'] |
779 |
- |
780 |
- # Libdirs |
781 |
- libdirs = [self.libdir] |
782 |
- |
783 |
- # Defines |
784 |
- defines = ['NDEBUG'] + self._btl_defines() |
785 |
- defines = self._btl_defines() |
786 |
- |
787 |
- # Flags |
788 |
- flags = [] |
789 |
- |
790 |
- ## Interpret flags |
791 |
- for flag in self._get_flags() + \ |
792 |
- shlex.split(run_cmd(['portageq', 'envvar', 'CXXFLAGS']).strip()): |
793 |
- flag = flag.strip() |
794 |
- if flag[:2] == '-l': |
795 |
- libraries.append(flag[2:]) |
796 |
- elif flag[:2] == '-L': |
797 |
- libdirs.append(flag[2:]) |
798 |
- elif flag[:2] == '-I': |
799 |
- includes.append(flag[2:]) |
800 |
- else: |
801 |
- flags.append(flag) |
802 |
- |
803 |
- # Set compile environment |
804 |
- self.compileenv['INCLUDE_PATH'] = ':'.join(includes) |
805 |
- self.compileenv['LIBRARY_PATH'] = ':'.join(libdirs) |
806 |
- self.compileenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
807 |
- self.runenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
808 |
- # PATH |
809 |
- envpath = ':'.join([pjoin(self.root, l) for l in ('bin', 'usr/bin')]) |
810 |
- if (os.environ.has_key('PATH')): |
811 |
- envpath += ':' + os.environ['PATH'] |
812 |
- self.compileenv['PATH'] = envpath |
813 |
- self.runenv['PATH'] = envpath |
814 |
- |
815 |
- exe = pjoin(self.testdir, "test") |
816 |
- |
817 |
- # Retrieve compiler |
818 |
- cxx = 'g++' |
819 |
- cxx_portage = run_cmd(['portageq', 'envvar', 'CXX']).strip() |
820 |
- if cxx_portage != '': |
821 |
- cxx = cxx_portage |
822 |
- if os.environ.has_key('CXX'): |
823 |
- cxx = os.environ['CXX'] |
824 |
- |
825 |
- # Form command line arguments |
826 |
- args = [cxx, pjoin(cfg.btldir, self._btl_source()), '-o', exe] |
827 |
- args += ['-I'+I for I in includes] |
828 |
- args += ['-l'+l for l in libraries] |
829 |
- args += ['-L'+L for L in libdirs] |
830 |
- args += ['-D'+D for D in defines] |
831 |
- args += flags |
832 |
- |
833 |
- # Open logfile or redirect to PIPE |
834 |
- logfile = file(pjoin(self.logdir, "compile.log"), 'w') |
835 |
- logfile.write(' '.join([n+'='+v for n,v in self.compileenv.items()])) |
836 |
- logfile.write(' ' + ' '.join(args) + '\n' + 80*'-' + '\n') |
837 |
- logfile.flush() |
838 |
- |
839 |
- # Execute |
840 |
- proc=sp.Popen(args,stdout=logfile,stderr=sp.STDOUT,env=self.compileenv) |
841 |
- proc.wait() |
842 |
- |
843 |
- # Close, return |
844 |
- logfile.close() |
845 |
- return proc.returncode, exe, logfile.name |
846 |
- |
847 |
- def _executeTest(self, exe, logfile, preargs=[]): |
848 |
- # Log dynamic link |
849 |
- lddlogfile = file(pjoin(self.logdir, 'ldd.log'), 'w') |
850 |
- sp.Popen(['ldd', '-v', exe], stdout=lddlogfile, env=self.runenv).wait() |
851 |
- |
852 |
- # Open pipe |
853 |
- logfile = file(logfile, 'w') |
854 |
- args = preargs + [exe] + list(self.tests) |
855 |
- if self.N is not None: |
856 |
- args.append('-N' + self.N) |
857 |
- logfile.write(' '.join( \ |
858 |
- [n + '="'+v+'"' for n,v in self.runenv.items()] ) + ' ') |
859 |
- logfile.write(' '.join(args) + '\n') |
860 |
- logfile.write(80*'-' + '\n') |
861 |
- proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=sp.PIPE, |
862 |
- env=self.runenv, cwd=self.testdir) |
863 |
- benchchildren.append(proc) |
864 |
- |
865 |
- # Interpret output |
866 |
- while True: |
867 |
- # Each operation test begins with a line on stderr |
868 |
- errline = proc.stderr.readline() |
869 |
- if not errline: |
870 |
- break |
871 |
- logfile.write(errline) |
872 |
- resfile = errline.split()[-1] |
873 |
- testname = resfile[6:-5-len(self.libname)] |
874 |
- Print(resfile) |
875 |
- |
876 |
- # Many different sizes for each operation test |
877 |
- Print.down() |
878 |
- cur = 0 |
879 |
- tot = 1 |
880 |
- while cur != tot: |
881 |
- outline = proc.stdout.readline() |
882 |
- # If the line is void, something gone wrong |
883 |
- if not outline: |
884 |
- Print.up() |
885 |
- Print('Execution error') |
886 |
- return 1 |
887 |
- logfile.write(outline) |
888 |
- logfile.flush() |
889 |
- |
890 |
- # Interpret line |
891 |
- outline = outline.strip() |
892 |
- (cur, tot) = shlex.split(outline)[-1][1:-1].split('/') |
893 |
- cur = int(cur); tot = int(tot) |
894 |
- Print(outline) |
895 |
- |
896 |
- |
897 |
- Print.up() |
898 |
- logfile.close() |
899 |
- proc.wait() |
900 |
- Print("Execution finished with return code " + str(proc.returncode)) |
901 |
- return proc.returncode |
902 |
|
903 |
diff --git a/numbench/cblas.py b/numbench/cblas.py |
904 |
deleted file mode 100644 |
905 |
index ad33663..0000000 |
906 |
--- a/numbench/cblas.py |
907 |
+++ /dev/null |
908 |
@@ -1,23 +0,0 @@ |
909 |
-#===================================================== |
910 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
911 |
-#===================================================== |
912 |
-# |
913 |
-# This program is free software; you can redistribute it and/or |
914 |
-# modify it under the terms of the GNU General Public License |
915 |
-# as published by the Free Software Foundation; either version 2 |
916 |
-# of the License, or (at your option) any later version. |
917 |
-# |
918 |
-# This program is distributed in the hope that it will be useful, |
919 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
920 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
921 |
-# GNU General Public License for more details. |
922 |
-# You should have received a copy of the GNU General Public License |
923 |
-# along with this program; if not, write to the Free Software |
924 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
925 |
-# |
926 |
-import blasbase |
927 |
- |
928 |
-class Module(blasbase.BLASBase): |
929 |
- def _initialize(self): |
930 |
- self.libname = "cblas" |
931 |
- blasbase.BLASBase._initialize(self) |
932 |
\ No newline at end of file |
933 |
|
934 |
diff --git a/numbench/fftw.py b/numbench/fftw.py |
935 |
deleted file mode 100644 |
936 |
index ec30508..0000000 |
937 |
--- a/numbench/fftw.py |
938 |
+++ /dev/null |
939 |
@@ -1,86 +0,0 @@ |
940 |
-#===================================================== |
941 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
942 |
-#===================================================== |
943 |
-# |
944 |
-# This program is free software; you can redistribute it and/or |
945 |
-# modify it under the terms of the GNU General Public License |
946 |
-# as published by the Free Software Foundation; either version 2 |
947 |
-# of the License, or (at your option) any later version. |
948 |
-# |
949 |
-# This program is distributed in the hope that it will be useful, |
950 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
951 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
952 |
-# GNU General Public License for more details. |
953 |
-# You should have received a copy of the GNU General Public License |
954 |
-# along with this program; if not, write to the Free Software |
955 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
956 |
-# |
957 |
-import os, btlbase |
958 |
- |
959 |
-class Module(btlbase.BTLBase): |
960 |
- def _initialize(self): |
961 |
- self.libname = "fftw" |
962 |
- self.avail = ( |
963 |
- "FFTW_1D_Forward_Measure", "FFTW_1D_Forward_Estimate", |
964 |
- "FFTW_1D_Backward_Measure", "FFTW_1D_Backward_Estimate", |
965 |
- |
966 |
- "FFTW_2D_Forward_Measure", "FFTW_2D_Forward_Estimate", |
967 |
- "FFTW_2D_Backward_Measure", "FFTW_2D_Backward_Estimate", |
968 |
- |
969 |
- "FFTW_3D_Forward_Measure", "FFTW_3D_Forward_Estimate", |
970 |
- "FFTW_3D_Backward_Measure", "FFTW_3D_Backward_Estimate" |
971 |
- ) |
972 |
- |
973 |
- def _parse_args(self, args): |
974 |
- passargs = [] |
975 |
- |
976 |
- # Parse arguments |
977 |
- tests = [] |
978 |
- for i in args: |
979 |
- if i in self.avail: |
980 |
- tests.append(i) |
981 |
- continue |
982 |
- passargs.append(i) |
983 |
- |
984 |
- # Sort tests |
985 |
- self.tests = [i for i in self.avail if i in tests] |
986 |
- |
987 |
- # If no test is specified, run everything |
988 |
- if len(self.tests) == 0: |
989 |
- self.tests = self.avail |
990 |
- |
991 |
- btlbase.BTLBase._parse_args(self, passargs) |
992 |
- |
993 |
- @staticmethod |
994 |
- def get_impls(root): |
995 |
- return ['fftw', 'fftw_threads'] |
996 |
- |
997 |
- def instructionsFor(self, impl): |
998 |
- Print("Use command 'pkg-config --cflags --libs " + impl + \ |
999 |
- "' when compiling") |
1000 |
- |
1001 |
- @staticmethod |
1002 |
- def _testClass(): |
1003 |
- return FFTWTest |
1004 |
- |
1005 |
- |
1006 |
- |
1007 |
-class FFTWTest(btlbase.BTLTest): |
1008 |
- |
1009 |
- def _get_flags(self): |
1010 |
- if self.impl == 'fftw': |
1011 |
- return ['-lfftw3', '-lm', '-g3'] |
1012 |
- elif self.impl == 'fftw_threads': |
1013 |
- return ['-lfftw3_threads', '-lm'] |
1014 |
- |
1015 |
- @staticmethod |
1016 |
- def _btl_source(): |
1017 |
- return "libs/FFTW/main.cpp" |
1018 |
- |
1019 |
- @staticmethod |
1020 |
- def _btl_includes(): |
1021 |
- return ["libs/FFTW"] |
1022 |
- |
1023 |
- @staticmethod |
1024 |
- def _btl_defines(): |
1025 |
- return [] |
1026 |
\ No newline at end of file |
1027 |
|
1028 |
diff --git a/numbench/lapack.py b/numbench/lapack.py |
1029 |
deleted file mode 100644 |
1030 |
index f440903..0000000 |
1031 |
--- a/numbench/lapack.py |
1032 |
+++ /dev/null |
1033 |
@@ -1,70 +0,0 @@ |
1034 |
-#===================================================== |
1035 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
1036 |
-#===================================================== |
1037 |
-# |
1038 |
-# This program is free software; you can redistribute it and/or |
1039 |
-# modify it under the terms of the GNU General Public License |
1040 |
-# as published by the Free Software Foundation; either version 2 |
1041 |
-# of the License, or (at your option) any later version. |
1042 |
-# |
1043 |
-# This program is distributed in the hope that it will be useful, |
1044 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1045 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1046 |
-# GNU General Public License for more details. |
1047 |
-# You should have received a copy of the GNU General Public License |
1048 |
-# along with this program; if not, write to the Free Software |
1049 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1050 |
-# |
1051 |
-import os, btlbase |
1052 |
-import subprocess as sp |
1053 |
-import shlex |
1054 |
- |
1055 |
-class Module(btlbase.BTLBase): |
1056 |
- |
1057 |
- libname = "lapack" |
1058 |
- avail = ['general_solve', 'least_squares', 'lu_decomp', \ |
1059 |
- 'cholesky', 'qr_decomp', 'svd_decomp', 'syev', 'stev', 'symm_ev'] |
1060 |
- |
1061 |
- def _initialize(self): |
1062 |
- pass |
1063 |
- |
1064 |
- def _parse_args(self, args): |
1065 |
- passargs = [] |
1066 |
- |
1067 |
- # Parse arguments |
1068 |
- tests = [] |
1069 |
- for i in args: |
1070 |
- if i in self.avail: |
1071 |
- tests.append(i) |
1072 |
- continue |
1073 |
- passargs.append(i) |
1074 |
- |
1075 |
- # Sort tests |
1076 |
- self.tests = [i for i in self.avail if i in tests] |
1077 |
- |
1078 |
- # If no test is specified, run everything |
1079 |
- if len(self.tests) == 0: |
1080 |
- self.tests = ['lu_decomp', 'cholesky', 'qr_decomp', 'svd_decomp',\ |
1081 |
- 'syev', 'stev'] |
1082 |
- |
1083 |
- btlbase.BTLBase._parse_args(self, passargs) |
1084 |
- |
1085 |
- @staticmethod |
1086 |
- def _testClass(): |
1087 |
- return LapackTest |
1088 |
- |
1089 |
- |
1090 |
- |
1091 |
-class LapackTest(btlbase.BTLTest): |
1092 |
- @staticmethod |
1093 |
- def _btl_source(): |
1094 |
- return "libs/LAPACK/main.cpp" |
1095 |
- |
1096 |
- @staticmethod |
1097 |
- def _btl_includes(): |
1098 |
- return ["libs/BLAS", "libs/LAPACK"] |
1099 |
- |
1100 |
- @staticmethod |
1101 |
- def _btl_defines(): |
1102 |
- return ["LAPACKNAME=lapack"] |
1103 |
- |
1104 |
\ No newline at end of file |
1105 |
|
1106 |
diff --git a/numbench/lapack_accuracy.py b/numbench/lapack_accuracy.py |
1107 |
deleted file mode 100644 |
1108 |
index 3e04aa3..0000000 |
1109 |
--- a/numbench/lapack_accuracy.py |
1110 |
+++ /dev/null |
1111 |
@@ -1,169 +0,0 @@ |
1112 |
-#===================================================== |
1113 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
1114 |
-#===================================================== |
1115 |
-# |
1116 |
-# This program is free software; you can redistribute it and/or |
1117 |
-# modify it under the terms of the GNU General Public License |
1118 |
-# as published by the Free Software Foundation; either version 2 |
1119 |
-# of the License, or (at your option) any later version. |
1120 |
-# |
1121 |
-# This program is distributed in the hope that it will be useful, |
1122 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1123 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1124 |
-# GNU General Public License for more details. |
1125 |
-# You should have received a copy of the GNU General Public License |
1126 |
-# along with this program; if not, write to the Free Software |
1127 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1128 |
-# |
1129 |
-import subprocess as sp |
1130 |
-import shlex, os |
1131 |
-from os.path import join as pjoin |
1132 |
- |
1133 |
-from benchutils import mkdir, run_cmd |
1134 |
-from benchprint import Print |
1135 |
-from htmlreport import HTMLreport |
1136 |
-import basemodule |
1137 |
-import benchconfig as cfg |
1138 |
-import benchchildren |
1139 |
- |
1140 |
-class Module(basemodule.BaseModule): |
1141 |
- |
1142 |
- def _initialize(self): |
1143 |
- self.libname = 'lapack' |
1144 |
- self.avail=['lu_decomp', 'cholesky', 'svd_decomp', 'qr_decomp', \ |
1145 |
- 'syev', 'stev'] |
1146 |
- |
1147 |
- def _parse_args(self, args): |
1148 |
- # Parse arguments |
1149 |
- tests = [] |
1150 |
- for i in args: |
1151 |
- if i in self.avail: |
1152 |
- tests.append(i) |
1153 |
- continue |
1154 |
- raise Exception("Argument not recognized: " + i) |
1155 |
- |
1156 |
- # Sort tests |
1157 |
- self.tests = [i for i in self.avail if i in tests] |
1158 |
- |
1159 |
- # If no test is specified, then do everything |
1160 |
- if len(self.tests) == 0: |
1161 |
- self.tests = self.avail |
1162 |
- |
1163 |
- # Generate list of dat (result) files, relative to the testdir |
1164 |
- self.files = [pjoin('accuracy_%s_%s.dat' % (op, self.libname)) \ |
1165 |
- for op in self.tests] |
1166 |
- |
1167 |
- @staticmethod |
1168 |
- def _testClass(): |
1169 |
- return LAPACK_accuracyTest |
1170 |
- |
1171 |
- |
1172 |
- def save_results(self, results): |
1173 |
- basemodule.BaseModule.save_results(self, results, 'plot', \ |
1174 |
- 'Relative error') |
1175 |
- |
1176 |
-class LAPACK_accuracyTest(basemodule.BaseTest): |
1177 |
- |
1178 |
- compileenv = {} |
1179 |
- runenv = {} |
1180 |
- |
1181 |
- def _compileTest(self): |
1182 |
- self.compileenv = {} |
1183 |
- |
1184 |
- # Flags and envvars lists |
1185 |
- includes = [pjoin(self.root, 'usr/include'), |
1186 |
- pjoin(cfg.btldir, 'accuracy'), |
1187 |
- pjoin(cfg.btldir, 'libs', 'LAPACK'), |
1188 |
- pjoin(cfg.btldir, 'generic_bench', 'utils')] |
1189 |
- libraries = [] |
1190 |
- libdirs = [self.libdir] |
1191 |
- defines = ['NDEBUG'] |
1192 |
- flags = [] |
1193 |
- |
1194 |
- ## Interpret flags |
1195 |
- for flag in self._get_flags() + \ |
1196 |
- shlex.split(run_cmd(['portageq', 'envvar', 'CXXFLAGS']).strip()): |
1197 |
- flag = flag.strip() |
1198 |
- if flag[:2] == '-l': |
1199 |
- libraries.append(flag[2:]) |
1200 |
- elif flag[:2] == '-L': |
1201 |
- libdirs.append(flag[2:]) |
1202 |
- elif flag[:2] == '-I': |
1203 |
- includes.append(flag[2:]) |
1204 |
- else: |
1205 |
- flags.append(flag) |
1206 |
- |
1207 |
- # Set compile environment |
1208 |
- self.compileenv['INCLUDE_PATH'] = ':'.join(includes) |
1209 |
- self.compileenv['LIBRARY_PATH'] = ':'.join(libdirs) |
1210 |
- self.compileenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
1211 |
- self.runenv['LD_LIBRARY_PATH'] = ':'.join(libdirs) |
1212 |
- |
1213 |
- exe = pjoin(self.testdir, "test") |
1214 |
- source = pjoin(cfg.btldir, "accuracy/lapack/main_lapack.cpp") |
1215 |
- |
1216 |
- # Retrieve compiler |
1217 |
- cxx = 'g++' |
1218 |
- cxx_portage = run_cmd(['portageq', 'envvar', 'CXX']).strip() |
1219 |
- if cxx_portage != '': |
1220 |
- cxx = cxx_portage |
1221 |
- if os.environ.has_key('CXX'): |
1222 |
- cxx = os.environ['CXX'] |
1223 |
- |
1224 |
- # Form command line arguments |
1225 |
- args = [cxx, source, '-o', exe] |
1226 |
- args += ['-I'+I for I in includes] |
1227 |
- args += ['-l'+l for l in libraries] |
1228 |
- args += ['-L'+L for L in libdirs] |
1229 |
- args += ['-D'+D for D in defines] |
1230 |
- args += flags |
1231 |
- |
1232 |
- # Open logfile or redirect to PIPE |
1233 |
- logfile = file(pjoin(self.logdir, "compile.log"), 'w') |
1234 |
- logfile.write(' '.join([n+'='+v for n,v in self.compileenv.items()])) |
1235 |
- logfile.write(' ' + ' '.join(args) + '\n' + 80*'-' + '\n') |
1236 |
- logfile.flush() |
1237 |
- |
1238 |
- # Execute |
1239 |
- proc=sp.Popen(args,stdout=logfile,stderr=sp.STDOUT,env=self.compileenv) |
1240 |
- proc.wait() |
1241 |
- |
1242 |
- # Close, return |
1243 |
- logfile.close() |
1244 |
- return proc.returncode, exe, logfile.name |
1245 |
- |
1246 |
- |
1247 |
- def _executeTest(self, exe, logfile): |
1248 |
- # Log dynamic link |
1249 |
- lddlogfile = file(pjoin(self.logdir, 'ldd.log'), 'w') |
1250 |
- sp.Popen(['ldd', '-v', exe], stdout=lddlogfile, env=self.runenv).wait() |
1251 |
- |
1252 |
- # Open pipe |
1253 |
- logfile = file(logfile, 'w') |
1254 |
- args = [exe] + self.tests |
1255 |
- logfile.write(' '.join([n+'='+v for n,v in self.runenv.items()]) + ' ') |
1256 |
- logfile.write(' '.join(args) + '\n') |
1257 |
- logfile.write(80*'-' + '\n') |
1258 |
- proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=logfile, |
1259 |
- env=self.runenv, cwd=self.testdir) |
1260 |
- benchchildren.append(proc) |
1261 |
- |
1262 |
- # Interpret output |
1263 |
- Print.down() |
1264 |
- while True: |
1265 |
- line = proc.stdout.readline() |
1266 |
- if not line: |
1267 |
- break |
1268 |
- logfile.write(line) |
1269 |
- if len(line.strip()) == 0: |
1270 |
- continue |
1271 |
- if line[0] != ' ': |
1272 |
- Print.up() |
1273 |
- Print(line.strip()) |
1274 |
- Print.down() |
1275 |
- else: |
1276 |
- Print(line[1:-1]) |
1277 |
- Print.up() |
1278 |
- logfile.close() |
1279 |
- proc.wait() |
1280 |
- return proc.returncode |
1281 |
|
1282 |
diff --git a/numbench/metis.py b/numbench/metis.py |
1283 |
deleted file mode 100644 |
1284 |
index 4c7c36b..0000000 |
1285 |
--- a/numbench/metis.py |
1286 |
+++ /dev/null |
1287 |
@@ -1,184 +0,0 @@ |
1288 |
-#===================================================== |
1289 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
1290 |
-#===================================================== |
1291 |
-# |
1292 |
-# This program is free software; you can redistribute it and/or |
1293 |
-# modify it under the terms of the GNU General Public License |
1294 |
-# as published by the Free Software Foundation; either version 2 |
1295 |
-# of the License, or (at your option) any later version. |
1296 |
-# |
1297 |
-# This program is distributed in the hope that it will be useful, |
1298 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1299 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1300 |
-# GNU General Public License for more details. |
1301 |
-# You should have received a copy of the GNU General Public License |
1302 |
-# along with this program; if not, write to the Free Software |
1303 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1304 |
-# |
1305 |
-import os, shlex, numpy as np, subprocess as sp |
1306 |
-from os.path import realpath, exists as pexists, join as pjoin |
1307 |
-from random import randint |
1308 |
- |
1309 |
-import basemodule |
1310 |
-import benchconfig as cfg |
1311 |
-from benchutils import mkdir |
1312 |
-from benchprint import Print |
1313 |
-import benchchildren |
1314 |
- |
1315 |
-inputsdir = pjoin(cfg.testsdir, 'metis-input') |
1316 |
-mkdir(inputsdir) |
1317 |
- |
1318 |
-avail_graph = ['pmetis-8', 'kmetis-8', 'pmetis-64', 'kmetis-64'] |
1319 |
-avail_mesh = [] |
1320 |
-avail_matrix = [] |
1321 |
- |
1322 |
-class Module(basemodule.BaseModule): |
1323 |
- |
1324 |
- #classmethod |
1325 |
- def _initialize(cls): |
1326 |
- cls.avail = avail_graph + avail_mesh + avail_matrix |
1327 |
- |
1328 |
- def _parse_args(self, args): |
1329 |
- tests = [] |
1330 |
- |
1331 |
- # Parse arguments |
1332 |
- for i in args: |
1333 |
- if i in self.avail: |
1334 |
- tests.append(i) |
1335 |
- else: |
1336 |
- raise Exception("Argument not recognized: " + i) |
1337 |
- |
1338 |
- if len(tests) == 0: |
1339 |
- # If not test provided, perform all |
1340 |
- self.tests = self.avail |
1341 |
- else: |
1342 |
- # Sort tests |
1343 |
- self.tests = [i for i in self.avail if i in tests] |
1344 |
- |
1345 |
- @staticmethod |
1346 |
- def get_impls(*args, **kwargs): |
1347 |
- return ('metis',) |
1348 |
- |
1349 |
- def instructionsFor(self, impl): |
1350 |
- Print("Nothing to do") |
1351 |
- |
1352 |
- def save_results(self, results): |
1353 |
- basemodule.BaseModule.save_results(self, results, 'loglog', 'Seconds') |
1354 |
- |
1355 |
- def getTest(self, root, impl, testdir, logdir): |
1356 |
- t = MetisTest(root, testdir, logdir, self.tests) |
1357 |
- return t |
1358 |
- |
1359 |
- |
1360 |
-class MetisTest: |
1361 |
- sizes = None |
1362 |
- |
1363 |
- def __init__(self, root, testdir, logdir, tests): |
1364 |
- self.root = root |
1365 |
- self.testdir = testdir |
1366 |
- self.logdir = logdir |
1367 |
- self.tests = tests |
1368 |
- mkdir(logdir) |
1369 |
- mkdir(testdir) |
1370 |
- |
1371 |
- @classmethod |
1372 |
- def _getSizes(cls): |
1373 |
- if cls.sizes is None: |
1374 |
- cls.sizes = [int(i) for i in np.logspace(3, 6, 100)] |
1375 |
- return cls.sizes |
1376 |
- |
1377 |
- def _generateFiles(self): |
1378 |
- Print("Generating input files...") |
1379 |
- # Graph |
1380 |
- if len([i for i in self.tests if i in avail_graph]) != 0: |
1381 |
- for size in self._getSizes(): |
1382 |
- fname = pjoin(inputsdir, 'input_%i.graph' % size) |
1383 |
- if not pexists(fname): |
1384 |
- writeGraph(size, fname) |
1385 |
- Print("Done") |
1386 |
- |
1387 |
- |
1388 |
- def run_test(self, changes={}): |
1389 |
- self._generateFiles() |
1390 |
- result = {} |
1391 |
- |
1392 |
- for t in [i for i in self.tests if i in avail_graph]: |
1393 |
- Print('Doing ' + t) |
1394 |
- Print.down() |
1395 |
- res = [] |
1396 |
- |
1397 |
- for s,size in enumerate(self._getSizes(), 1): |
1398 |
- inputfile = pjoin(inputsdir, 'input_%i.graph' % size) |
1399 |
- |
1400 |
- # Setting environment |
1401 |
- env = os.environ.copy() |
1402 |
- envpath = env.has_key('PATH') and env['PATH'] or '' |
1403 |
- env['PATH'] = ':'.join([pjoin(self.root, p) for p in \ |
1404 |
- ('bin', 'usr/bin')]) + ':' + envpath |
1405 |
- envlib = env.has_key('LD_LIBARY_PATH') and \ |
1406 |
- env['LD_LIBARY_PATH'] or '' |
1407 |
- env['LD_LIBRARY_PATH'] = ':'.join([pjoin(self.root,p) for p in \ |
1408 |
- ('usr/lib', 'usr/lib64', 'usr/lib32')]) + ':' + envlib |
1409 |
- |
1410 |
- # Get executable |
1411 |
- exe, parts = t.split('-') |
1412 |
- exe = pjoin(self.root, 'usr/bin', exe) |
1413 |
- |
1414 |
- # Check dynamic linking |
1415 |
- logf = file(pjoin(self.logdir, 'ldd.log'), 'w') |
1416 |
- p = sp.Popen(\ |
1417 |
- ['ldd', '-v', exe], stdout=logf, stderr=sp.STDOUT, env=env |
1418 |
- ) |
1419 |
- p.wait() |
1420 |
- |
1421 |
- # Execute |
1422 |
- logname = pjoin(self.logdir, t + '_%i.log' % size) |
1423 |
- cmd = [exe, inputfile, parts] |
1424 |
- pr = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT, env=env) |
1425 |
- benchchildren.append(pr) |
1426 |
- lines = pr.communicate()[0].split('\n') |
1427 |
- |
1428 |
- # Interpret output |
1429 |
- for i,line in enumerate(lines): |
1430 |
- if line[:18] == "Timing Information": |
1431 |
- begin_timing = i+1 |
1432 |
- break |
1433 |
- |
1434 |
- lines = [i[:-1] for i in lines[begin_timing+1:]] |
1435 |
- for l in lines: |
1436 |
- if l.strip()[:13] == "Partitioning:": |
1437 |
- time = float(shlex.split(l)[1]) |
1438 |
- break |
1439 |
- res.append((size,time)) |
1440 |
- Print("size: %6i %2.3f sec. (%i/%i)" % (size, time, s, 100)) |
1441 |
- |
1442 |
- Print.up() |
1443 |
- |
1444 |
- # Write sizes / times to result file |
1445 |
- resfname = pjoin(self.testdir, t+'.dat') |
1446 |
- resfs = file(resfname, 'w') |
1447 |
- for i in res: |
1448 |
- print >> resfs, i[0], i[1] |
1449 |
- resfs.close() |
1450 |
- result[t] = resfname |
1451 |
- return result |
1452 |
- |
1453 |
- |
1454 |
-def writeGraph(size, filename): |
1455 |
- edges = [[] for i in xrange(size)] |
1456 |
- nedges = 0 |
1457 |
- for e1 in xrange(len(edges)): |
1458 |
- n = 0 |
1459 |
- tot = randint(1, min(size / 4, 5)) |
1460 |
- while n < tot: |
1461 |
- e2 = randint(0, size - 1) |
1462 |
- if e2 not in edges[e1] and e1 != e2: |
1463 |
- edges[e1].append(e2) |
1464 |
- edges[e2].append(e1) |
1465 |
- n += 1 |
1466 |
- nedges += 1 |
1467 |
- fs = file(filename, 'w') |
1468 |
- print >> fs, size, nedges |
1469 |
- for s in edges: |
1470 |
- print >> fs, ' '.join([str(i+1) for i in s]) |
1471 |
- fs.close() |
1472 |
|
1473 |
diff --git a/numbench/scalapack.py b/numbench/scalapack.py |
1474 |
deleted file mode 100644 |
1475 |
index c639ef9..0000000 |
1476 |
--- a/numbench/scalapack.py |
1477 |
+++ /dev/null |
1478 |
@@ -1,88 +0,0 @@ |
1479 |
-#===================================================== |
1480 |
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com> |
1481 |
-#===================================================== |
1482 |
-# |
1483 |
-# This program is free software; you can redistribute it and/or |
1484 |
-# modify it under the terms of the GNU General Public License |
1485 |
-# as published by the Free Software Foundation; either version 2 |
1486 |
-# of the License, or (at your option) any later version. |
1487 |
-# |
1488 |
-# This program is distributed in the hope that it will be useful, |
1489 |
-# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1490 |
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1491 |
-# GNU General Public License for more details. |
1492 |
-# You should have received a copy of the GNU General Public License |
1493 |
-# along with this program; if not, write to the Free Software |
1494 |
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1495 |
-# |
1496 |
-import os, btlbase, shlex, subprocess as sp |
1497 |
- |
1498 |
-numproc = 4 |
1499 |
- |
1500 |
-class Module(btlbase.BTLBase): |
1501 |
- def _initialize(self): |
1502 |
- self.libname = "scalapack" |
1503 |
- self.avail = ['axpy', 'matrix_vector', 'lu_decomp', 'cholesky', |
1504 |
- 'qr_decomp', 'svd_decomp', 'symm_ev'] |
1505 |
- |
1506 |
- def _parse_args(self, args): |
1507 |
- passargs = [] |
1508 |
- |
1509 |
- # Parse arguments |
1510 |
- tests = [] |
1511 |
- skip = 0 |
1512 |
- |
1513 |
- for i, a in enumerate(args): |
1514 |
- if skip != 0: |
1515 |
- skip -= 1 |
1516 |
- continue |
1517 |
- if a == '-n': |
1518 |
- skip += 1 |
1519 |
- numproc = args[i+1] |
1520 |
- continue |
1521 |
- if a in self.avail: |
1522 |
- tests.append(a) |
1523 |
- continue |
1524 |
- passargs.append(a) |
1525 |
- |
1526 |
- # Sort tests |
1527 |
- self.tests = [i for i in self.avail if i in tests] |
1528 |
- |
1529 |
- # If no test is specified, then choose four standard tests |
1530 |
- if len(self.tests) == 0: |
1531 |
- self.tests = self.avail |
1532 |
- |
1533 |
- btlbase.BTLBase._parse_args(self, passargs) |
1534 |
- |
1535 |
- @staticmethod |
1536 |
- def _testClass(): |
1537 |
- return ScaLAPACKTest |
1538 |
- |
1539 |
- |
1540 |
-class ScaLAPACKTest(btlbase.BTLTest): |
1541 |
-# def __init__(self, *args, **kwargs): |
1542 |
-# os.environ['CXX'] = 'mpic++' |
1543 |
-# btlbase.BTLTest.__init__(self, *args, **kwargs) |
1544 |
- |
1545 |
- def _get_flags(self): |
1546 |
- proc = sp.Popen(['mpic++', '-showme'], stdout=sp.PIPE) |
1547 |
- out = proc.communicate()[0] |
1548 |
- if proc.returncode != 0: |
1549 |
- raise Exception("An MPI implementation is needed in order to" \ |
1550 |
- + " run the scalapack tests.") |
1551 |
- return shlex.split(out)[1:] + btlbase.BTLTest._get_flags(self) |
1552 |
- |
1553 |
- def _executeTest(self, exe, logfile): |
1554 |
- btlbase.BTLTest._executeTest(self, exe, logfile, \ |
1555 |
- ['mpirun', '-n', str(numproc)]) |
1556 |
- |
1557 |
- @staticmethod |
1558 |
- def _btl_source(): |
1559 |
- return "libs/PBLAS/main.cpp" |
1560 |
- |
1561 |
- @staticmethod |
1562 |
- def _btl_includes(): |
1563 |
- return ["libs/"+i for i in ("BLAS", "LAPACK", "BLACS", "PBLAS", "STL")] |
1564 |
- |
1565 |
- def _btl_defines(self): |
1566 |
- return ["PBLASNAME="+self.libname] |
1567 |
\ No newline at end of file |