diff options
author | 2011-06-15 14:55:43 +0200 | |
---|---|---|
committer | 2011-06-15 14:55:43 +0200 | |
commit | bb92ba7dd4ebb313038d5ea0452c06787d3998c0 (patch) | |
tree | 61ba473b49f3a650b107332692c41c12be1f336c /lapack.py | |
parent | Work on BTL LAPACK interface and test suite. (diff) | |
download | auto-numerical-bench-bb92ba7dd4ebb313038d5ea0452c06787d3998c0.tar.gz auto-numerical-bench-bb92ba7dd4ebb313038d5ea0452c06787d3998c0.tar.bz2 auto-numerical-bench-bb92ba7dd4ebb313038d5ea0452c06787d3998c0.zip |
Introduced LAPACK, cleanup of btlbase (former blasbase). Some changes
to main.
Diffstat (limited to 'lapack.py')
-rw-r--r-- | lapack.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lapack.py b/lapack.py new file mode 100644 index 0000000..1d2f3cb --- /dev/null +++ b/lapack.py @@ -0,0 +1,56 @@ +import os, blasbase +import subprocess as sp +import shlex + +class Module(blasbase.BTLBase): + def _initialize(self): + self.libname = "lapack" + self.avail = ['general_solve', 'least_squares', 'lu_decomp', \ + 'cholesky', 'symm_ev'] + + def _parse_args(self, args): + # Parse arguments + tests = [] + for i in args: + if i in self.avail: + tests.append(i) + continue + raise Exception("Argument not recognized: " + i) + + # Sort tests + self.tests = [i for i in self.avail if i in tests] + + # If no test is specified, run everything + if len(self.tests) == 0: + self.tests = self.avail + + @staticmethod + def _btl_source(): + return "/libs/LAPACK/main.cpp" + + @staticmethod + def _btl_includes(): + return ["/libs/BLAS", "libs/LAPACK"] + + def _btl_defines(self): + return ["LAPACKNAME=" + self.libname] + + def _get_flags(self, root, impl, libdir): + # Retrieve pkgconfig settings and map the directories to the new root + path = "%s/etc/env.d/alternatives/%s/%s/%s/pkgconfig" % \ + (root, self.libname, impl, libdir) + pkgconf = sp.Popen('pkg-config --libs --cflags lapack', shell=True, \ + stdout=sp.PIPE, env={'PKG_CONFIG_PATH':path}).communicate()[0] + pkgconf = pkgconf.replace('-L/', '-L'+root+'/') + pkgconf = pkgconf.replace('-I/', '-I'+root+'/') + return shlex.split(pkgconf) + + + def get_impls(self, root): + output = sp.Popen( + ['eselect', '--no-color', '--brief', self.libname, 'list'], + env={'ROOT' : root}, stdout=sp.PIPE + ).communicate()[0] + return output.strip().split('\n') + +del blasbase |