* [gentoo-commits] proj/auto-numerical-bench:master commit in: /, btl/actions/, btl/libs/LAPACK/
@ 2011-06-15 17:54 Andrea Arteaga
0 siblings, 0 replies; only message in thread
From: Andrea Arteaga @ 2011-06-15 17:54 UTC (permalink / raw
To: gentoo-commits
commit: acf8d6ff64ae1b2dd7e5e1f3940a03086aa81065
Author: spiros <andyspiros <AT> gmail <DOT> com>
AuthorDate: Wed Jun 15 17:53:55 2011 +0000
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Wed Jun 15 17:53:55 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=acf8d6ff
Bugfix. Script now is directory-independent.
---
btl/actions/action_lu_decomp.hh | 2 +-
btl/libs/LAPACK/lapack_interface_impl.hh | 24 +++++-----
lapack.py | 6 +-
main.py | 69 +++++++++++++++--------------
4 files changed, 52 insertions(+), 49 deletions(-)
diff --git a/btl/actions/action_lu_decomp.hh b/btl/actions/action_lu_decomp.hh
index 2448e82..18e9939 100644
--- a/btl/actions/action_lu_decomp.hh
+++ b/btl/actions/action_lu_decomp.hh
@@ -76,7 +76,7 @@ public :
static inline std::string name( void )
{
- return "complete_lu_decomp_"+Interface::name();
+ return "lu_decomp_"+Interface::name();
}
double nb_op_base( void ){
diff --git a/btl/libs/LAPACK/lapack_interface_impl.hh b/btl/libs/LAPACK/lapack_interface_impl.hh
index 18ce305..a2bd299 100644
--- a/btl/libs/LAPACK/lapack_interface_impl.hh
+++ b/btl/libs/LAPACK/lapack_interface_impl.hh
@@ -1,4 +1,4 @@
-#define LPF(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_)
+#define LAPACKFUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_)
template<> class lapack_interface<SCALAR> : public c_interface_base<SCALAR>
{
@@ -13,8 +13,8 @@ public:
{
int *ipiv = new int[N];
int info;
- LPF(copy)(&N, b, &intone, x, &intone);
- LPF(gesv)(&N, &intone, A, &N, ipiv, x, &N, &info);
+ LAPACKFUNC(copy)(&N, b, &intone, x, &intone);
+ LAPACKFUNC(gesv)(&N, &intone, A, &N, ipiv, x, &N, &info);
delete[] ipiv;
}
@@ -22,13 +22,13 @@ public:
{
int *ipiv = new int[N];
int info;
- LPF(copy)(&N, b, &intone, x, &intone);
+ LAPACKFUNC(copy)(&N, b, &intone, x, &intone);
SCALAR work1;
int MONE = -1;
- LPF(gels)(¬rans, &N, &N, &intone, A, &N, x, &N, &work1, &MONE, &info);
+ LAPACKFUNC(gels)(¬rans, &N, &N, &intone, A, &N, x, &N, &work1, &MONE, &info);
int lwork = (int)work1;
SCALAR *work2 = new SCALAR[lwork];
- LPF(gels)(¬rans, &N, &N, &intone, A, &N, x, &N, work2, &lwork, &info);
+ LAPACKFUNC(gels)(¬rans, &N, &N, &intone, A, &N, x, &N, work2, &lwork, &info);
delete[] work2;
delete[] ipiv;
}
@@ -38,8 +38,8 @@ public:
int N2 = N*N;
int *ipiv = new int[N];
int info;
- LPF(copy)(&N2, X, &intone, C, &intone);
- LPF(getrf)(&N, &N, C, &N, ipiv, &info);
+ LAPACKFUNC(copy)(&N2, X, &intone, C, &intone);
+ LAPACKFUNC(getrf)(&N, &N, C, &N, ipiv, &info);
delete[] ipiv;
}
@@ -47,8 +47,8 @@ public:
{
int N2 = N*N;
int info;
- LPF(copy)(&N2, X, &intone, C, &intone);
- LPF(potrf)(&lower, &N, C, &N, &info);
+ LAPACKFUNC(copy)(&N2, X, &intone, C, &intone);
+ LAPACKFUNC(potrf)(&lower, &N, C, &N, &info);
}
static inline void symm_ev(const gene_matrix& X, gene_vector& W, int N)
@@ -56,11 +56,11 @@ public:
char jobz = 'N';
SCALAR *work = new SCALAR;
int lwork = -1, info;
- LPF(syev)(&jobz, &lower, &N, X, &N, W, work, &lwork, &info);
+ LAPACKFUNC(syev)(&jobz, &lower, &N, X, &N, W, work, &lwork, &info);
lwork = *work;
delete work;
work = new SCALAR[lwork];
- LPF(syev)(&jobz, &lower, &N, X, &N, W, work, &lwork, &info);
+ LAPACKFUNC(syev)(&jobz, &lower, &N, X, &N, W, work, &lwork, &info);
delete[] work;
}
diff --git a/lapack.py b/lapack.py
index 1d2f3cb..ec98cd5 100644
--- a/lapack.py
+++ b/lapack.py
@@ -1,8 +1,8 @@
-import os, blasbase
+import os, btlbase
import subprocess as sp
import shlex
-class Module(blasbase.BTLBase):
+class Module(btlbase.BTLBase):
def _initialize(self):
self.libname = "lapack"
self.avail = ['general_solve', 'least_squares', 'lu_decomp', \
@@ -53,4 +53,4 @@ class Module(blasbase.BTLBase):
).communicate()[0]
return output.strip().split('\n')
-del blasbase
+del btlbase
diff --git a/main.py b/main.py
index 8933834..9799a43 100644
--- a/main.py
+++ b/main.py
@@ -1,8 +1,29 @@
+#! /usr/bin/env python2
+
import os, sys, shlex
from PortageUtils import *
import subprocess as sp
import time
-
+
+# Retrieve relevant files/directories
+curdir = os.path.abspath('.')
+scriptdir = os.path.dirname(os.path.realpath(__file__))
+if os.getuid() == 0:
+ pkgsdir = "/var/cache/benchmarks/packages/"
+ figdir = "/var/cache/benchmarks/results/"
+else:
+ pkgsdir = os.environ['HOME'] + "/.benchmarks/packages/"
+ figdir = os.environ['HOME'] + "/.benchmarks/results/"
+figdir += time.strftime('%Y%m%d-%H%M') + '/'
+rootsdir = "/var/tmp/benchmarks/roots/"
+testsdir = "/var/tmp/benchmarks/tests/"
+libdir = sp.Popen \
+ ('ABI=$(portageq envvar ABI); echo /usr/`portageq envvar LIBDIR_$ABI`/', \
+ stdout=sp.PIPE, shell=True).communicate()[0].strip()
+
+def print_usage():
+ print "Usage: benchmarks [blas|cblas|lapack] file args"
+
class _Print:
def __init__(self, maxlevel=10):
self._level = 0
@@ -21,29 +42,19 @@ class _Print:
def down(self, n=1):
self._level = max(self._level+n, 0)
-
Print = _Print(3)
-
-
-# Retrieve relevant directories
-if os.getuid() == 0:
- pkgsdir = "/var/cache/benchmarks/packages/"
- figdir = "/var/cache/benchmarks/results/"
-else:
- pkgsdir = os.environ['HOME'] + "/.benchmarks/packages/"
- figdir = os.environ['HOME'] + "/.benchmarks/results/"
-figdir += time.strftime('%Y%m%d-%H%M') + '/'
-rootsdir = "/var/tmp/benchmarks/roots/"
-testsdir = "/var/tmp/benchmarks/tests/"
-libdir = sp.Popen \
- ('ABI=$(portageq envvar ABI); echo /usr/`portageq envvar LIBDIR_$ABI`/', \
- stdout=sp.PIPE, shell=True).communicate()[0].strip()
-
-
-def print_usage():
- print "Usage: benchmarks [blas|cblas|lapack] file args"
-
+# Import the desired module or print help and exit
+try:
+ testsfname = os.path.abspath(sys.argv[2])
+ os.chdir(scriptdir)
+ tmp = __import__(sys.argv[1], fromlist = ['Module'])
+ mod = tmp.Module(Print, libdir, sys.argv[3:])
+ del tmp
+except ImportError, IndexError:
+ print_usage()
+ exit(1)
+
def tests_from_input(input):
tests = {}
@@ -70,16 +81,7 @@ def tests_from_input(input):
sys.stderr.write('Error: package ' + spl[1] + ' not found\n')
return tests
-
-# Import the desired module or print help and exit
-try:
- tmp = __import__(sys.argv[1], fromlist = ['Module'])
- mod = tmp.Module(Print, libdir, sys.argv[3:])
- del tmp
- testsfname = sys.argv[2]
-except ImportError, IndexError:
- print_usage()
- exit(1)
+
"""
@@ -196,7 +198,7 @@ for tn,(name,test) in enumerate(tests.items(),1):
print
-
+# Reports will be saved in figdir
if not os.path.exists(figdir):
os.makedirs(figdir)
@@ -206,3 +208,4 @@ for (name,test) in tests.items():
results[(name, impl)] = test['results'][impl]
mod.save_results(results, figdir)
+
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-15 17:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 17:54 [gentoo-commits] proj/auto-numerical-bench:master commit in: /, btl/actions/, btl/libs/LAPACK/ Andrea Arteaga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox