From 2e70cd3b49d01110923e7ea239da0e1572d3ff17 Mon Sep 17 00:00:00 2001 From: Andrea Arteaga Date: Fri, 23 Mar 2012 11:36:50 +0100 Subject: Solved BTL clock problem. Added initial (not tested) scalapack new module. Solved HTML issues. --- numbench/modules/scalapack.py | 75 +++++++++++++++++++++++++++++++++++++++++++ numbench/reports/__init__.py | 0 numbench/reports/html.py | 2 +- numbench/utils/btl.py | 7 ++-- samples/cblastests.xml | 37 ++++++++++++++++----- samples/scalapacktests.xml | 17 ++++++++++ 6 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 numbench/modules/scalapack.py create mode 100644 numbench/reports/__init__.py create mode 100644 samples/scalapacktests.xml 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 +#===================================================== +# +# 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 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 @@ - + sci-libs/openblas-9999 NEHALEM @@ -22,20 +22,41 @@ -O3 incblas + + 1 + - - sci-libs/mkl-10.3.7.256 - mkl32* - *int64* - *openmp + + sci-libs/openblas-9999 + + NEHALEM + -O3 + -O3 + incblas + + + 2 + - - sci-libs/gsl-1.15-r2 + + sci-libs/openblas-9999 + NEHALEM + -O3 -O3 + incblas + + 4 + + + + + sci-libs/mkl-10.3.7.256 + mkl32* + *int64* 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 @@ + + + + sci-libs/scalapack-1.8.0 + + -O3 + + + + + sci-libs/scalapack-1.8.0 + + -O1 + + + + -- cgit v1.2.3-65-gdbad