diff options
author | 2012-03-04 23:37:25 +0100 | |
---|---|---|
committer | 2012-03-04 23:37:25 +0100 | |
commit | de54ffc4d0f9a808ebbfc9455719f66a8c4b2663 (patch) | |
tree | c96417e1dcdff776c179393b701f7382aa39ec57 | |
parent | Moved benchutils and portageutils to utils/. (diff) | |
download | auto-numerical-bench-de54ffc4d0f9a808ebbfc9455719f66a8c4b2663.tar.gz auto-numerical-bench-de54ffc4d0f9a808ebbfc9455719f66a8c4b2663.tar.bz2 auto-numerical-bench-de54ffc4d0f9a808ebbfc9455719f66a8c4b2663.zip |
Added support for FFTW and sample configuration file.
-rw-r--r-- | numbench/benchconfig.py | 8 | ||||
-rw-r--r-- | numbench/modules/blas.py | 4 | ||||
-rw-r--r-- | numbench/modules/cblas.py | 4 | ||||
-rw-r--r-- | numbench/modules/fftw.py | 70 | ||||
-rw-r--r-- | numbench/modules/internal/btlBase.py | 12 | ||||
-rw-r--r-- | numbench/modules/internal/lapackBase.py | 4 | ||||
-rw-r--r-- | numbench/modules/lapack.py | 4 | ||||
-rw-r--r-- | numbench/utils/portageutils.py | 2 | ||||
-rw-r--r-- | samples/fftwtests.xml | 31 |
9 files changed, 119 insertions, 20 deletions
diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py index a3b40cf..c7ff33b 100644 --- a/numbench/benchconfig.py +++ b/numbench/benchconfig.py @@ -1,5 +1,5 @@ #===================================================== -# Copyright (C) 2011 Andrea Arteaga <andyspiros@gmail.com> +# Copyright (C) 2011-2012 Andrea Arteaga <andyspiros@gmail.com> #===================================================== # # This program is free software; you can redistribute it and/or @@ -39,11 +39,9 @@ if not locals().has_key('initialized'): ('ABI=$(portageq envvar ABI); echo `portageq envvar LIBDIR_$ABI`', \ stdout=sp.PIPE, shell=True).communicate()[0].strip() if not libdir: - libdir = '/usr/lib' + libdir = 'usr/lib' else: - libdir = '/usr/' + libdir - while libdir[0] == '/': - libdir = libdir[1:] + libdir = 'usr/' + libdir # Parse arguments passargs = sys.argv[3:] diff --git a/numbench/modules/blas.py b/numbench/modules/blas.py index 49aa31c..24834f5 100644 --- a/numbench/modules/blas.py +++ b/numbench/modules/blas.py @@ -18,8 +18,8 @@ import internal.blasBase as base class Module: - libname = "blas" - descr = "Test module for BLAS implementations" + libname = 'blas' + descr = 'Test module for BLAS implementations' __init__ = base.init getImplementations = base.getImplementations diff --git a/numbench/modules/cblas.py b/numbench/modules/cblas.py index bdc17a5..a0ef2c7 100644 --- a/numbench/modules/cblas.py +++ b/numbench/modules/cblas.py @@ -18,8 +18,8 @@ import internal.blasBase as base class Module: - libname = "cblas" - descr = "Test module for CBLAS implementations" + libname = 'cblas' + descr = 'Test module for CBLAS implementations' __init__ = base.init getImplementations = base.getImplementations diff --git a/numbench/modules/fftw.py b/numbench/modules/fftw.py new file mode 100644 index 0000000..1283244 --- /dev/null +++ b/numbench/modules/fftw.py @@ -0,0 +1,70 @@ +#===================================================== +# Copyright (C) 2012 Andrea Arteaga <andyspiros@gmail.com> +#===================================================== +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +from os.path import exists, join as pjoin +from ..utils import btl +from internal import btlBase +from .. import benchconfig as cfg + +availableTests = ( + 'FFTW_1D_Forward_Measure', 'FFTW_1D_Forward_Estimate', + 'FFTW_1D_Backward_Measure', 'FFTW_1D_Backward_Estimate', + + 'FFTW_2D_Forward_Measure', 'FFTW_2D_Forward_Estimate', + 'FFTW_2D_Backward_Measure', 'FFTW_2D_Backward_Estimate', + + 'FFTW_3D_Forward_Measure', 'FFTW_3D_Forward_Estimate', + 'FFTW_3D_Backward_Measure', 'FFTW_3D_Backward_Estimate', +) +defaultTests = availableTests + + +class Module: + libname = 'fftw' + descr = 'Test module for FFTW library' + + def __init__(self, args): + self.tests = btl.selectTests(availableTests, args) + if len(self.tests) == 0: + self.tests = defaultTests + + def getImplementations(self, test): + ret = ['fftw3'] + for impl in ('fftw3_threads', 'fftw3_omp'): + l = pjoin(test['root'], cfg.libdir, 'lib'+impl+'.so') + if exists(l): + ret.append(impl) + return ret + + def runTest(self, test, implementation): + # Set up btlconfig + btlconfig = dict ( + source = 'libs/FFTW/main.cpp', + exe = pjoin(test['testdir'], implementation, 'test'), + libraries = [implementation, 'm'], + logdir = pjoin(test['logdir'], implementation), + testdir = pjoin(test['testdir'], implementation), + tests = self.tests + ) + + if implementation != 'fftw3': + btlconfig['libraries'].append('fftw3') + + return btlBase.runTest(self, test, btlconfig) + + getTests = btlBase.getTests + reportConf = btlBase.reportConf
\ No newline at end of file diff --git a/numbench/modules/internal/btlBase.py b/numbench/modules/internal/btlBase.py index 8237692..4cbb555 100644 --- a/numbench/modules/internal/btlBase.py +++ b/numbench/modules/internal/btlBase.py @@ -30,26 +30,26 @@ def runTest(self, test, btlconfig): for i in btlconfig['tests']]) if all([exists(i) for i in tmpres.values()]): - Print("Results exist - skipping run") + Print('Results exist - skipping run') return tmpres # Compile test suite ret = btl.compileTest(test, btlconfig) if ret != 0: - Print("Compilation failed with code: %i" % ret) + Print('Compilation failed with code: %i' % ret) return None else: - Print("Compilation successful") + Print('Compilation successful') # Run test suite ret, result = btl.runTest(test, btlconfig) if ret != 0: - Print("Execution failed with code: %i" % ret) - Print("The results will be incomplete") + Print('Execution failed with code: %i' % ret) + Print('The results will be incomplete') # TODO: remove this if possible (return incomplete results) return None else: - Print("Execution successful") + Print('Execution successful') return result diff --git a/numbench/modules/internal/lapackBase.py b/numbench/modules/internal/lapackBase.py index 7cd0c8c..b0f4a4c 100644 --- a/numbench/modules/internal/lapackBase.py +++ b/numbench/modules/internal/lapackBase.py @@ -40,11 +40,11 @@ def runTest(self, test, implementation): # Set up btlconfig btlconfig = dict ( source = 'libs/LAPACK/main.cpp', - exe = pjoin(test['testdir'], implementation, "test"), + exe = pjoin(test['testdir'], implementation, 'test'), logdir = pjoin(test['logdir'], implementation), testdir = pjoin(test['testdir'], implementation), btlincludes = ('libs/BLAS', 'libs/LAPACK'), - defines = ("LAPACKNAME="+self.libname, ), + defines = ('LAPACKNAME='+self.libname, ), flags = alt.getFlags(test, self.libname, implementation), tests = self.tests ) diff --git a/numbench/modules/lapack.py b/numbench/modules/lapack.py index 073e51a..13e46d5 100644 --- a/numbench/modules/lapack.py +++ b/numbench/modules/lapack.py @@ -18,8 +18,8 @@ import internal.lapackBase as base class Module: - libname = "lapack" - descr = "Test module for LAPACK implementations" + libname = 'lapack' + descr = 'Test module for LAPACK implementations' __init__ = base.init getImplementations = base.getImplementations diff --git a/numbench/utils/portageutils.py b/numbench/utils/portageutils.py index 41c0cdc..f58bb2b 100644 --- a/numbench/utils/portageutils.py +++ b/numbench/utils/portageutils.py @@ -19,7 +19,7 @@ import commands as cmd import subprocess as sp import os, portage, shlex from os.path import join as pjoin, dirname -from utils import benchutils as bu +import benchutils as bu class InstallException(Exception): def __init__(self, package, command, logfile): diff --git a/samples/fftwtests.xml b/samples/fftwtests.xml new file mode 100644 index 0000000..7791931 --- /dev/null +++ b/samples/fftwtests.xml @@ -0,0 +1,31 @@ +<tests> + + <test id="fftw-O0"> + <pkg>sci-libs/fftw-3.3-r2</pkg> + <emergeenv> + <var name="CFLAGS">-O0</var> + </emergeenv> + </test> + + <test id="fftw-O1"> + <pkg>sci-libs/fftw-3.3-r2</pkg> + <emergeenv> + <var name="CFLAGS">-O1</var> + </emergeenv> + </test> + + <test id="fftw-O2"> + <pkg>sci-libs/fftw-3.3-r2</pkg> + <emergeenv> + <var name="CFLAGS">-O2</var> + </emergeenv> + </test> + + <test id="fftw-O3"> + <pkg>sci-libs/fftw-3.3-r2</pkg> + <emergeenv> + <var name="CFLAGS">-O3</var> + </emergeenv> + </test> + +</tests> |