diff options
author | Andrea Arteaga <andyspiros@gmail.com> | 2012-08-11 18:32:12 +0200 |
---|---|---|
committer | Andrea Arteaga <andyspiros@gmail.com> | 2012-08-11 18:32:12 +0200 |
commit | 490f1e0cb69e5faf2055be71f18584b99e624c76 (patch) | |
tree | 0d7c03c36c34415c6c01e30510a46fb9d13d75d4 | |
parent | Updated manpage. (diff) | |
download | auto-numerical-bench-490f1e0cb69e5faf2055be71f18584b99e624c76.tar.gz auto-numerical-bench-490f1e0cb69e5faf2055be71f18584b99e624c76.tar.bz2 auto-numerical-bench-490f1e0cb69e5faf2055be71f18584b99e624c76.zip |
Insert static modules list and check is requested module exists.
-rw-r--r-- | numbench/main.py | 15 | ||||
-rw-r--r-- | numbench/modules/__init__.py | 16 |
2 files changed, 20 insertions, 11 deletions
diff --git a/numbench/main.py b/numbench/main.py index a7f752b..0e98b41 100644 --- a/numbench/main.py +++ b/numbench/main.py @@ -57,15 +57,6 @@ def print_help(): for m in modnames: M = modules.loadModule(m) print " %s - %s" % (m, M.descr) -# print " blas - Test BLAS implementations" -# print " cblas - Test CBLAS implementations" -# print " lapack - Test LAPACK implementations" -# print " lapacke - Test LAPACK implementations" -# print " scalapack - Test the ScaLAPACK library" -# #print " blas_accuracy - Test BLAS implementations for accuracy" -# #print " lapack_accuracy - Test LAPACK implementations for accuracy" -# print " fftw - Test the FFTW library" -# #print " metis - Test the METIS tools" print print "More information about a module is available through the command:" print " numbench module --help" @@ -108,6 +99,12 @@ parser = Parser(cfg.inputfile) cfg.modulename = parser.getModuleName() cfg.moduleargs = parser.getModuleArguments() +# Check whether the given module exists +if not cfg.modulename in modules.getAllModulesNames(): + print "Error: module " + cfg.modulename + " does not exist.\n\n" + print_help() + exit(2) + # Set-up directories cfg.setDirs() diff --git a/numbench/modules/__init__.py b/numbench/modules/__init__.py index fdd704e..9696252 100644 --- a/numbench/modules/__init__.py +++ b/numbench/modules/__init__.py @@ -18,12 +18,25 @@ import os from os.path import basename, dirname, realpath +# List here the "stable" modules in a static and ordered list +modnames = [ + 'blas', + 'cblas', + 'lapack', + 'lapacke', + 'scalapack', + 'fftw' +] + class ModuleNotFoundException(RuntimeError): pass def getModulesNames(): + return modnames + +def getAllModulesNames(): files = os.listdir(dirname(realpath(__file__))) me = basename(__file__) modnames = [] @@ -32,7 +45,6 @@ def getModulesNames(): modnames.append(f[:-3]) return modnames - def loadModule(modname, args=None): if not modname in getModulesNames(): raise ModuleNotFoundException("module " + modname + " not found") @@ -42,5 +54,5 @@ def loadModule(modname, args=None): args = args if type(args) == type('') else ' '.join(args) # Load the module - tmp = __import__(modname, fromlist=["Module"]) + tmp = __import__('numbench.modules.' + modname, fromlist=["Module"]) return tmp.Module(args) |