diff options
author | spiros <andyspiros@gmail.com> | 2011-06-15 14:55:43 +0200 |
---|---|---|
committer | spiros <andyspiros@gmail.com> | 2011-06-15 14:55:43 +0200 |
commit | bb92ba7dd4ebb313038d5ea0452c06787d3998c0 (patch) | |
tree | 61ba473b49f3a650b107332692c41c12be1f336c /cblas.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 'cblas.py')
-rw-r--r-- | cblas.py | 72 |
1 files changed, 59 insertions, 13 deletions
@@ -1,23 +1,69 @@ -import os, blasbase +import os, btlbase import subprocess as sp +import shlex -class Module(blasbase.ModuleBase): +class Module(btlbase.BTLBase): + def _initialize(self): + self.libname = "cblas" + self.avail1 = ['axpy', 'axpby', 'rot'] + self.avail2 = ['matrix_vector','atv','symv','syr2','ger', + 'trisolve_vector'] + self.avail3 = ['matrix_matrix', 'aat', 'trisolve_matrix', 'trmm'] + self.avail = self.avail1 + self.avail2 + self.avail3 + + def _parse_args(self, args): + # Parse arguments + tests = [] + for i in args: + if i == '1': + tests += avail1 + continue + if i == '2': + tests += avail2 + continue + if i == '3': + tests += avail3 + continue + 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, then choose four standard tests + if len(self.tests) == 0: + self.tests = ['axpy', 'matrix_vector', \ + 'trisolve_vector', 'matrix_matrix'] + @staticmethod - def get_impls(root): - output = sp.Popen( - ['eselect', '--no-color', '--brief', 'cblas', 'list'], - env={'ROOT' : root}, stdout=sp.PIPE - ).communicate()[0] - return output.strip().split('\n') - + def _btl_source(): + return "/libs/BLAS/main.cpp" + + @staticmethod + def _btl_includes(): + return ["/libs/BLAS"] + + def _btl_defines(self): + return ["CBLASNAME=" + self.libname, "CBLAS_INTERFACE"] + def _get_flags(self, root, impl, libdir): # Retrieve pkgconfig settings and map the directories to the new root - path = \ - "%s/etc/env.d/alternatives/cblas/%s/%s/pkgconfig" % (root,impl,libdir) + path = "%s/etc/env.d/alternatives/%s/%s/%s/pkgconfig" % \ + (root, self.libname, impl, libdir) pkgconf = sp.Popen('pkg-config --libs --cflags cblas', 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 pkgconf + " -DCBLAS_INTERFACE" + 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 +del btlbase |