Gentoo Archives: gentoo-commits

From: Andrea Arteaga <andyspiros@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/auto-numerical-bench:master commit in: numbench/, numbench/modules/internal/, samples/, numbench/modules/, ...
Date: Sun, 04 Mar 2012 22:39:14
Message-Id: 1330900645.de54ffc4d0f9a808ebbfc9455719f66a8c4b2663.spiros@gentoo
1 commit: de54ffc4d0f9a808ebbfc9455719f66a8c4b2663
2 Author: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
3 AuthorDate: Sun Mar 4 22:37:25 2012 +0000
4 Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
5 CommitDate: Sun Mar 4 22:37:25 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=de54ffc4
7
8 Added support for FFTW and sample configuration file.
9
10 ---
11 numbench/benchconfig.py | 8 +--
12 numbench/modules/blas.py | 4 +-
13 numbench/modules/cblas.py | 4 +-
14 numbench/modules/fftw.py | 70 +++++++++++++++++++++++++++++++
15 numbench/modules/internal/btlBase.py | 12 +++---
16 numbench/modules/internal/lapackBase.py | 4 +-
17 numbench/modules/lapack.py | 4 +-
18 numbench/utils/portageutils.py | 2 +-
19 samples/fftwtests.xml | 31 ++++++++++++++
20 9 files changed, 119 insertions(+), 20 deletions(-)
21
22 diff --git a/numbench/benchconfig.py b/numbench/benchconfig.py
23 index a3b40cf..c7ff33b 100644
24 --- a/numbench/benchconfig.py
25 +++ b/numbench/benchconfig.py
26 @@ -1,5 +1,5 @@
27 #=====================================================
28 -# Copyright (C) 2011 Andrea Arteaga <andyspiros@×××××.com>
29 +# Copyright (C) 2011-2012 Andrea Arteaga <andyspiros@×××××.com>
30 #=====================================================
31 #
32 # This program is free software; you can redistribute it and/or
33 @@ -39,11 +39,9 @@ if not locals().has_key('initialized'):
34 ('ABI=$(portageq envvar ABI); echo `portageq envvar LIBDIR_$ABI`', \
35 stdout=sp.PIPE, shell=True).communicate()[0].strip()
36 if not libdir:
37 - libdir = '/usr/lib'
38 + libdir = 'usr/lib'
39 else:
40 - libdir = '/usr/' + libdir
41 - while libdir[0] == '/':
42 - libdir = libdir[1:]
43 + libdir = 'usr/' + libdir
44
45 # Parse arguments
46 passargs = sys.argv[3:]
47
48 diff --git a/numbench/modules/blas.py b/numbench/modules/blas.py
49 index 49aa31c..24834f5 100644
50 --- a/numbench/modules/blas.py
51 +++ b/numbench/modules/blas.py
52 @@ -18,8 +18,8 @@
53 import internal.blasBase as base
54
55 class Module:
56 - libname = "blas"
57 - descr = "Test module for BLAS implementations"
58 + libname = 'blas'
59 + descr = 'Test module for BLAS implementations'
60
61 __init__ = base.init
62 getImplementations = base.getImplementations
63
64 diff --git a/numbench/modules/cblas.py b/numbench/modules/cblas.py
65 index bdc17a5..a0ef2c7 100644
66 --- a/numbench/modules/cblas.py
67 +++ b/numbench/modules/cblas.py
68 @@ -18,8 +18,8 @@
69 import internal.blasBase as base
70
71 class Module:
72 - libname = "cblas"
73 - descr = "Test module for CBLAS implementations"
74 + libname = 'cblas'
75 + descr = 'Test module for CBLAS implementations'
76
77 __init__ = base.init
78 getImplementations = base.getImplementations
79
80 diff --git a/numbench/modules/fftw.py b/numbench/modules/fftw.py
81 new file mode 100644
82 index 0000000..1283244
83 --- /dev/null
84 +++ b/numbench/modules/fftw.py
85 @@ -0,0 +1,70 @@
86 +#=====================================================
87 +# Copyright (C) 2012 Andrea Arteaga <andyspiros@×××××.com>
88 +#=====================================================
89 +#
90 +# This program is free software; you can redistribute it and/or
91 +# modify it under the terms of the GNU General Public License
92 +# as published by the Free Software Foundation; either version 2
93 +# of the License, or (at your option) any later version.
94 +#
95 +# This program is distributed in the hope that it will be useful,
96 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
97 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98 +# GNU General Public License for more details.
99 +# You should have received a copy of the GNU General Public License
100 +# along with this program; if not, write to the Free Software
101 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
102 +#
103 +from os.path import exists, join as pjoin
104 +from ..utils import btl
105 +from internal import btlBase
106 +from .. import benchconfig as cfg
107 +
108 +availableTests = (
109 + 'FFTW_1D_Forward_Measure', 'FFTW_1D_Forward_Estimate',
110 + 'FFTW_1D_Backward_Measure', 'FFTW_1D_Backward_Estimate',
111 +
112 + 'FFTW_2D_Forward_Measure', 'FFTW_2D_Forward_Estimate',
113 + 'FFTW_2D_Backward_Measure', 'FFTW_2D_Backward_Estimate',
114 +
115 + 'FFTW_3D_Forward_Measure', 'FFTW_3D_Forward_Estimate',
116 + 'FFTW_3D_Backward_Measure', 'FFTW_3D_Backward_Estimate',
117 +)
118 +defaultTests = availableTests
119 +
120 +
121 +class Module:
122 + libname = 'fftw'
123 + descr = 'Test module for FFTW library'
124 +
125 + def __init__(self, args):
126 + self.tests = btl.selectTests(availableTests, args)
127 + if len(self.tests) == 0:
128 + self.tests = defaultTests
129 +
130 + def getImplementations(self, test):
131 + ret = ['fftw3']
132 + for impl in ('fftw3_threads', 'fftw3_omp'):
133 + l = pjoin(test['root'], cfg.libdir, 'lib'+impl+'.so')
134 + if exists(l):
135 + ret.append(impl)
136 + return ret
137 +
138 + def runTest(self, test, implementation):
139 + # Set up btlconfig
140 + btlconfig = dict (
141 + source = 'libs/FFTW/main.cpp',
142 + exe = pjoin(test['testdir'], implementation, 'test'),
143 + libraries = [implementation, 'm'],
144 + logdir = pjoin(test['logdir'], implementation),
145 + testdir = pjoin(test['testdir'], implementation),
146 + tests = self.tests
147 + )
148 +
149 + if implementation != 'fftw3':
150 + btlconfig['libraries'].append('fftw3')
151 +
152 + return btlBase.runTest(self, test, btlconfig)
153 +
154 + getTests = btlBase.getTests
155 + reportConf = btlBase.reportConf
156 \ No newline at end of file
157
158 diff --git a/numbench/modules/internal/btlBase.py b/numbench/modules/internal/btlBase.py
159 index 8237692..4cbb555 100644
160 --- a/numbench/modules/internal/btlBase.py
161 +++ b/numbench/modules/internal/btlBase.py
162 @@ -30,26 +30,26 @@ def runTest(self, test, btlconfig):
163 for i in btlconfig['tests']])
164
165 if all([exists(i) for i in tmpres.values()]):
166 - Print("Results exist - skipping run")
167 + Print('Results exist - skipping run')
168 return tmpres
169
170 # Compile test suite
171 ret = btl.compileTest(test, btlconfig)
172 if ret != 0:
173 - Print("Compilation failed with code: %i" % ret)
174 + Print('Compilation failed with code: %i' % ret)
175 return None
176 else:
177 - Print("Compilation successful")
178 + Print('Compilation successful')
179
180 # Run test suite
181 ret, result = btl.runTest(test, btlconfig)
182 if ret != 0:
183 - Print("Execution failed with code: %i" % ret)
184 - Print("The results will be incomplete")
185 + Print('Execution failed with code: %i' % ret)
186 + Print('The results will be incomplete')
187 # TODO: remove this if possible (return incomplete results)
188 return None
189 else:
190 - Print("Execution successful")
191 + Print('Execution successful')
192
193 return result
194
195
196 diff --git a/numbench/modules/internal/lapackBase.py b/numbench/modules/internal/lapackBase.py
197 index 7cd0c8c..b0f4a4c 100644
198 --- a/numbench/modules/internal/lapackBase.py
199 +++ b/numbench/modules/internal/lapackBase.py
200 @@ -40,11 +40,11 @@ def runTest(self, test, implementation):
201 # Set up btlconfig
202 btlconfig = dict (
203 source = 'libs/LAPACK/main.cpp',
204 - exe = pjoin(test['testdir'], implementation, "test"),
205 + exe = pjoin(test['testdir'], implementation, 'test'),
206 logdir = pjoin(test['logdir'], implementation),
207 testdir = pjoin(test['testdir'], implementation),
208 btlincludes = ('libs/BLAS', 'libs/LAPACK'),
209 - defines = ("LAPACKNAME="+self.libname, ),
210 + defines = ('LAPACKNAME='+self.libname, ),
211 flags = alt.getFlags(test, self.libname, implementation),
212 tests = self.tests
213 )
214
215 diff --git a/numbench/modules/lapack.py b/numbench/modules/lapack.py
216 index 073e51a..13e46d5 100644
217 --- a/numbench/modules/lapack.py
218 +++ b/numbench/modules/lapack.py
219 @@ -18,8 +18,8 @@
220 import internal.lapackBase as base
221
222 class Module:
223 - libname = "lapack"
224 - descr = "Test module for LAPACK implementations"
225 + libname = 'lapack'
226 + descr = 'Test module for LAPACK implementations'
227
228 __init__ = base.init
229 getImplementations = base.getImplementations
230
231 diff --git a/numbench/utils/portageutils.py b/numbench/utils/portageutils.py
232 index 41c0cdc..f58bb2b 100644
233 --- a/numbench/utils/portageutils.py
234 +++ b/numbench/utils/portageutils.py
235 @@ -19,7 +19,7 @@ import commands as cmd
236 import subprocess as sp
237 import os, portage, shlex
238 from os.path import join as pjoin, dirname
239 -from utils import benchutils as bu
240 +import benchutils as bu
241
242 class InstallException(Exception):
243 def __init__(self, package, command, logfile):
244
245 diff --git a/samples/fftwtests.xml b/samples/fftwtests.xml
246 new file mode 100644
247 index 0000000..7791931
248 --- /dev/null
249 +++ b/samples/fftwtests.xml
250 @@ -0,0 +1,31 @@
251 +<tests>
252 +
253 + <test id="fftw-O0">
254 + <pkg>sci-libs/fftw-3.3-r2</pkg>
255 + <emergeenv>
256 + <var name="CFLAGS">-O0</var>
257 + </emergeenv>
258 + </test>
259 +
260 + <test id="fftw-O1">
261 + <pkg>sci-libs/fftw-3.3-r2</pkg>
262 + <emergeenv>
263 + <var name="CFLAGS">-O1</var>
264 + </emergeenv>
265 + </test>
266 +
267 + <test id="fftw-O2">
268 + <pkg>sci-libs/fftw-3.3-r2</pkg>
269 + <emergeenv>
270 + <var name="CFLAGS">-O2</var>
271 + </emergeenv>
272 + </test>
273 +
274 + <test id="fftw-O3">
275 + <pkg>sci-libs/fftw-3.3-r2</pkg>
276 + <emergeenv>
277 + <var name="CFLAGS">-O3</var>
278 + </emergeenv>
279 + </test>
280 +
281 +</tests>