public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/auto-numerical-bench:master commit in: numbench/, numbench/modules/internal/
@ 2012-09-17  8:07 Andrea Arteaga
  0 siblings, 0 replies; only message in thread
From: Andrea Arteaga @ 2012-09-17  8:07 UTC (permalink / raw
  To: gentoo-commits

commit:     da26057ff6528ef42a13e9f6ec7ec515ea28b369
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Mon Sep  3 12:39:43 2012 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Mon Sep  3 12:39:43 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=da26057f

Work on reports: smaller legend, smarter labels, errorbars.

---
 numbench/modules/internal/blasBase.py |   22 ++++++--------
 numbench/modules/internal/btlBase.py  |    2 +-
 numbench/report.py                    |   51 +++++++++++++++-----------------
 3 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/numbench/modules/internal/blasBase.py b/numbench/modules/internal/blasBase.py
index 75e1f0e..dd786db 100644
--- a/numbench/modules/internal/blasBase.py
+++ b/numbench/modules/internal/blasBase.py
@@ -22,7 +22,7 @@ from os.path import join as pjoin
 
 
 avail1 = ('axpy', 'axpby', 'rot')
-avail2 = ('matrix_vector','atv','symv', 'ger', 'syr2', 'trisolve_vector')
+avail2 = ('matrix_vector', 'atv', 'symv', 'ger', 'syr2', 'trisolve_vector')
 avail3 = ('matrix_matrix', 'aat', 'trisolve_matrix', 'trmm')
 availableTests = avail1 + avail2 + avail3
 defaultTests = ('axpy', 'matrix_vector', 'trisolve_vector', 'matrix_matrix')
@@ -47,7 +47,7 @@ def init(self, args):
             continue
         passargs.append(i)
 
-    self.tests = btl.selectTests(availableTests, passargs+tests)
+    self.tests = btl.selectTests(availableTests, passargs + tests)
     if len(self.tests) == 0:
         self.tests = defaultTests
 
@@ -59,19 +59,17 @@ def getImplementations(self, test):
 def runTest(self, test, implementation):
     # Set up btlconfig
     btlconfig = dict (
-      source = 'libs/BLAS/main.cpp',
-      exe = pjoin(test['testdir'], implementation, "test"),
-      logdir = pjoin(test['logdir'], implementation),
-      testdir = pjoin(test['testdir'], implementation),
-      btlincludes = ('libs/BLAS',),
-      defines = ("CBLASNAME="+self.libname, self.libname.upper()+"_INTERFACE"),
-      flags = alt.getFlags(test, self.libname, implementation),
-      tests = self.tests
+      source='libs/BLAS/main.cpp',
+      exe=pjoin(test['testdir'], implementation, "test"),
+      logdir=pjoin(test['logdir'], implementation),
+      testdir=pjoin(test['testdir'], implementation),
+      btlincludes=('libs/BLAS',),
+      defines=("CBLASNAME=" + self.libname, self.libname.upper() + "_INTERFACE"),
+      flags=alt.getFlags(test, self.libname, implementation),
+      tests=self.tests
     )
 
     return btlBase.runTest(self, test, btlconfig)
 
 getTests = btlBase.getTests
 reportConf = btlBase.reportConf
-
-reportConf = btlBase.reportConf

diff --git a/numbench/modules/internal/btlBase.py b/numbench/modules/internal/btlBase.py
index 4cbb555..6b9fea1 100644
--- a/numbench/modules/internal/btlBase.py
+++ b/numbench/modules/internal/btlBase.py
@@ -20,7 +20,7 @@ import numbench.utils.btl as btl
 from numbench.benchprint import Print
 
 def reportConf(*args):
-    return {'type':'semilogx', 'xlabel':'size', 'ylabel':'MFlops'}
+    return {'xscale':'log', 'xlabel':'size', 'ylabel':'MFlops'}
 
 
 def runTest(self, test, btlconfig):

diff --git a/numbench/report.py b/numbench/report.py
index e0de31a..29bcd99 100644
--- a/numbench/report.py
+++ b/numbench/report.py
@@ -28,24 +28,12 @@ from benchprint import Print
 
 class Plotter:
     def __init__(self, conf):
-        # Set plot function
+        # Store configuration
         self.conf = conf
-        if not conf.has_key('type'):
-            self.plotf = plt.plot
-        elif type(conf['type']) == type(''):
-            try:
-                self.plotf = plt.__dict__[conf['type']]
-            except:
-                print >> sys.stderr, \
-                  'Plot function "', conf['type'], '" not found. Using plot'
-                self.plotf = plt.plot
-                return
-        else:
-            self.plot = conf['type']
 
         # Labels
-        self.xlabel = conf.has_key('xlabel') and conf['xlabel'] or ''
-        self.ylabel = conf.has_key('ylabel') and conf['ylabel'] or ''
+        self.xlabel = conf.get('xlabel', '')
+        self.ylabel = conf.get('ylabel', '')
 
         # Initialize markers
         markers = ('-', '--', 'v', '^', 'o', 's', 'p', 'h', '*', '+', 'x', 'D')
@@ -54,16 +42,23 @@ class Plotter:
         self.curstyle = 0
 
         # Open figure
-        plt.figure(figsize=(12, 9), dpi=300)
+        self.figure = plt.figure(figsize=(12, 9), dpi=300)
 
 
-    def addPlot(self, x, y, label):
+    def addPlot(self, X, label):
         style = self.linestyles[self.curstyle]
         self.curstyle = (self.curstyle + 1) % len(self.linestyles)
-        self.plotf(x, y, style, label=label, hold=True)
+        if X.shape[1] == 2:
+            plt.plot(X[:, 0], X[:, 1], style, label=label, hold=True)
+        elif X.shape[1] == 3:
+            x, y, e = X[:, 0], X[:, 1], X[:, 2]
+            plt.errorbar(x, y, e, fmt=style, label=label, hold=True)
 
     def savePlot(self, fname):
-        plt.legend(loc='best')
+        axes = self.figure.get_axes()
+        axes.set_xscale(self.conf.get('xscale', 'linear'))
+        axes.set_yscale(self.conf.get('yscale', 'linear'))
+        plt.legend(loc='best', prop={'size':'x-small'})
         plt.xlabel(self.xlabel)
         plt.ylabel(self.ylabel)
         plt.grid(True)
@@ -96,14 +91,16 @@ def saveReport():
         p = Plotter(cfg.module.reportConf())
 
         for tid, test in cfg.tests.items():
-            if test.has_key('implementations'):
-                for impl in test['implementations']:
-
-                    implres = test['results'][impl]
-                    if implres and implres.has_key(operation):
-                        resultsFile = implres[operation]
-                        x, y = np.loadtxt(resultsFile, unpack=True)
-                        p.addPlot(x, y, tid + '/' + impl)
+            longlabel = len(test.get('implementations')) > 1
+            for impl in test.get('implementations', []):
+
+                # Add line to the plot
+                implres = test['results'][impl]
+                if implres and implres.has_key(operation):
+                    resultsFile = implres[operation]
+                    X = np.loadtxt(resultsFile, unpack=False)
+                    label = tid + '/' + impl if longlabel else tid
+                    p.addPlot(X, label)
 
         imgpath = pjoin('images', operation + '.' + cfg.imageformat)
         fname = pjoin(cfg.reportdir, imgpath)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-17  8:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17  8:07 [gentoo-commits] proj/auto-numerical-bench:master commit in: numbench/, numbench/modules/internal/ Andrea Arteaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox