diff options
-rw-r--r-- | numbench/modules/scalapack.py | 75 | ||||
-rw-r--r-- | numbench/reports/__init__.py | 0 | ||||
-rw-r--r-- | numbench/reports/html.py | 2 | ||||
-rw-r--r-- | numbench/utils/btl.py | 7 | ||||
-rw-r--r-- | samples/cblastests.xml | 37 | ||||
-rw-r--r-- | samples/scalapacktests.xml | 17 |
6 files changed, 127 insertions, 11 deletions
diff --git a/numbench/modules/scalapack.py b/numbench/modules/scalapack.py new file mode 100644 index 0000000..28e694f --- /dev/null +++ b/numbench/modules/scalapack.py @@ -0,0 +1,75 @@ +#===================================================== +# 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 join as pjoin + +from internal import btlBase +from ..utils import btl, alternatives as alt + +availableTests = ('axpy', 'matrix_vector', 'lu_decomp', 'cholesky', + 'qr_decomp', 'svd_decomp', 'symm_ev') +defaultTests = availableTests + +class Module: + libname = 'scalapack' + descr = 'Test module for ScaLAPACK implementations' + + def __init__(self, args): + passargs = [] + skip = 0 + self.numproc = 4 + for i, a in enumerate(args): + if skip > 0: + skip -= 1 + continue + elif a in ('-n', '--numproc'): + self.numproc = int(args[i+1]) + else: + passargs.append(a) + + self.tests = btl.selectTests(availableTests, args) + if len(self.tests) == 0: + self.tests = defaultTests + + def getImplementations(self, test): + return alt.getImplementations(test['root'], self.libname) + + def runTest(self, test, implementation): + btlincludes = ['libs/'+i for i in \ + ('BLAS', 'LAPACK', 'BLACS', 'PBLAS', 'STL')] + + # Set up btlconfig + btlconfig = dict ( + CXX = 'mpic++', + source = 'libs/PBLAS/main.cpp', + preargs = ('mpirun', '-np', self.numproc), + exe = pjoin(test['testdir'], implementation, 'test'), + logdir = pjoin(test['logdir'], implementation), + testdir = pjoin(test['testdir'], implementation), + btlincludes = tuple(btlincludes), + defines = ('PBLASNAME='+self.libname, ), + flags = alt.getFlags(test, self.libname, implementation), + tests = self.tests + ) + + return btlBase.runTest(self, test, btlconfig) + + getTests = btlBase.getTests + reportConf = btlBase.reportConf + + diff --git a/numbench/reports/__init__.py b/numbench/reports/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/numbench/reports/__init__.py diff --git a/numbench/reports/html.py b/numbench/reports/html.py index 356f2ab..0ab9ba4 100644 --- a/numbench/reports/html.py +++ b/numbench/reports/html.py @@ -19,7 +19,7 @@ import time from os.path import join as pjoin, basename from xml.sax.saxutils import escape as xmlescape -import benchconfig as cfg +from .. import benchconfig as cfg class ReportFile: def __init__(self, fname, title='Benchmarks report', \ diff --git a/numbench/utils/btl.py b/numbench/utils/btl.py index 541ff1e..d464d38 100644 --- a/numbench/utils/btl.py +++ b/numbench/utils/btl.py @@ -162,7 +162,10 @@ def compileTest(test, btlconfig): def runTest(test, btlconfig): + # Set runtime environment runenv = btlconfig['runenv'] + if not runenv.has_key('BTL_CONFIG'): + runenv['BTL_CONFIG'] = '--real' # Check linking logfs = file(pjoin(btlconfig['logdir'], 'btlLinking.log'), 'w') @@ -173,9 +176,9 @@ def runTest(test, btlconfig): # Prepare arguments args = (btlconfig['exe'],) + tuple(btlconfig['tests']) if btlconfig.has_key('preargs'): - args = btlconfig['preargs'] + args + args = tuple(btlconfig['preargs']) + args if btlconfig.has_key('postargs'): - args = args + btlconfig['postargs'] + args = args + tuple(btlconfig['postargs']) # Open log logfs = file(pjoin(btlconfig['logdir'], "btlRun.log"), 'w') diff --git a/samples/cblastests.xml b/samples/cblastests.xml index 7993f44..1b9bc2d 100644 --- a/samples/cblastests.xml +++ b/samples/cblastests.xml @@ -14,7 +14,7 @@ </emergeenv> </test> - <test id="openblas"> + <test id="openblas1"> <pkg>sci-libs/openblas-9999</pkg> <emergeenv> <var name="TARGET">NEHALEM</var> @@ -22,20 +22,41 @@ <var name="CFLAGS">-O3</var> <var name="USE">incblas</var> </emergeenv> + <runenv> + <var name="OPENBLAS_NUM_THREADS">1</var> + </runenv> </test> - <test id="mkl"> - <pkg>sci-libs/mkl-10.3.7.256</pkg> - <skip>mkl32*</skip> - <skip>*int64*</skip> - <skip>*openmp</skip> + <test id="openblas2"> + <pkg>sci-libs/openblas-9999</pkg> + <emergeenv> + <var name="TARGET">NEHALEM</var> + <var name="FFLAGS">-O3</var> + <var name="CFLAGS">-O3</var> + <var name="USE">incblas</var> + </emergeenv> + <runenv> + <var name="OPENBLAS_NUM_THREADS">2</var> + </runenv> </test> - <test id="gsl"> - <pkg>sci-libs/gsl-1.15-r2</pkg> + <test id="openblas4"> + <pkg>sci-libs/openblas-9999</pkg> <emergeenv> + <var name="TARGET">NEHALEM</var> + <var name="FFLAGS">-O3</var> <var name="CFLAGS">-O3</var> + <var name="USE">incblas</var> </emergeenv> + <runenv> + <var name="OPENBLAS_NUM_THREADS">4</var> + </runenv> + </test> + + <test id="mkl"> + <pkg>sci-libs/mkl-10.3.7.256</pkg> + <skip>mkl32*</skip> + <skip>*int64*</skip> </test> </tests> diff --git a/samples/scalapacktests.xml b/samples/scalapacktests.xml new file mode 100644 index 0000000..b74b5bc --- /dev/null +++ b/samples/scalapacktests.xml @@ -0,0 +1,17 @@ +<tests> + + <test id="reference-O3"> + <pkg>sci-libs/scalapack-1.8.0</pkg> + <emergeenv> + <var name="FFLAGS">-O3</var> + </emergeenv> + </test> + + <test id="reference-O1"> + <pkg>sci-libs/scalapack-1.8.0</pkg> + <emergeenv> + <var name="FFLAGS">-O1</var> + </emergeenv> + </test> + +</tests> |