1 |
commit: f553faebe10b3ccd17206181dfe9d31bd33a8ba7 |
2 |
Author: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Sep 29 10:23:02 2012 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Sat Sep 29 10:23:02 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=f553faeb |
7 |
|
8 |
Updated the (C)BLAS module to use the new interfaces. |
9 |
|
10 |
--- |
11 |
.../NI_internal/CDeclarations.hpp | 0 |
12 |
.../NumericInterface}/NI_internal/CInterface.hpp | 0 |
13 |
.../NI_internal/FortranDeclarations.hpp | 0 |
14 |
.../NI_internal/FortranInterface.hpp | 8 +- |
15 |
.../NumericInterface}/NI_internal/utils.hpp | 0 |
16 |
.../NumericInterface}/NumericInterface.hpp | 0 |
17 |
btl/actions/action_rot.hpp | 2 +- |
18 |
btl/libs/BLAS/main.cpp | 87 +++++++++++++++++-- |
19 |
numbench/modules/__init__.py | 1 + |
20 |
numbench/modules/internal/blasBase.py | 2 +- |
21 |
numbench/utils/btl.py | 3 +- |
22 |
11 files changed, 87 insertions(+), 16 deletions(-) |
23 |
|
24 |
diff --git a/NumericInterface/NI_internal/CDeclarations.hpp b/btl/NumericInterface/NI_internal/CDeclarations.hpp |
25 |
similarity index 100% |
26 |
rename from NumericInterface/NI_internal/CDeclarations.hpp |
27 |
rename to btl/NumericInterface/NI_internal/CDeclarations.hpp |
28 |
|
29 |
diff --git a/NumericInterface/NI_internal/CInterface.hpp b/btl/NumericInterface/NI_internal/CInterface.hpp |
30 |
similarity index 100% |
31 |
rename from NumericInterface/NI_internal/CInterface.hpp |
32 |
rename to btl/NumericInterface/NI_internal/CInterface.hpp |
33 |
|
34 |
diff --git a/NumericInterface/NI_internal/FortranDeclarations.hpp b/btl/NumericInterface/NI_internal/FortranDeclarations.hpp |
35 |
similarity index 100% |
36 |
rename from NumericInterface/NI_internal/FortranDeclarations.hpp |
37 |
rename to btl/NumericInterface/NI_internal/FortranDeclarations.hpp |
38 |
|
39 |
diff --git a/NumericInterface/NI_internal/FortranInterface.hpp b/btl/NumericInterface/NI_internal/FortranInterface.hpp |
40 |
similarity index 97% |
41 |
rename from NumericInterface/NI_internal/FortranInterface.hpp |
42 |
rename to btl/NumericInterface/NI_internal/FortranInterface.hpp |
43 |
index ab20783..576145d 100644 |
44 |
--- a/NumericInterface/NI_internal/FortranInterface.hpp |
45 |
+++ b/btl/NumericInterface/NI_internal/FortranInterface.hpp |
46 |
@@ -24,6 +24,10 @@ |
47 |
|
48 |
#define FORTFUNC(F) CAT(CAT(NI_SCALARPREFIX, F), _) |
49 |
|
50 |
+#ifndef NI_NAME |
51 |
+# define NI_NAME CAT(CAT(FortranInterface,$),NI_SCALAR) |
52 |
+#endif |
53 |
+ |
54 |
|
55 |
template<> |
56 |
class NumericInterface<NI_SCALAR> |
57 |
@@ -40,9 +44,7 @@ public: |
58 |
public: |
59 |
static std::string name() |
60 |
{ |
61 |
- std::string name = "FortranInterface<"; |
62 |
- name += MAKE_STRING(NI_SCALAR); |
63 |
- name += ">"; |
64 |
+ std::string name = MAKE_STRING(NI_NAME); |
65 |
return name; |
66 |
} |
67 |
|
68 |
|
69 |
diff --git a/NumericInterface/NI_internal/utils.hpp b/btl/NumericInterface/NI_internal/utils.hpp |
70 |
similarity index 100% |
71 |
rename from NumericInterface/NI_internal/utils.hpp |
72 |
rename to btl/NumericInterface/NI_internal/utils.hpp |
73 |
|
74 |
diff --git a/NumericInterface/NumericInterface.hpp b/btl/NumericInterface/NumericInterface.hpp |
75 |
similarity index 100% |
76 |
rename from NumericInterface/NumericInterface.hpp |
77 |
rename to btl/NumericInterface/NumericInterface.hpp |
78 |
|
79 |
diff --git a/btl/actions/action_rot.hpp b/btl/actions/action_rot.hpp |
80 |
index 93cba4e..574254a 100644 |
81 |
--- a/btl/actions/action_rot.hpp |
82 |
+++ b/btl/actions/action_rot.hpp |
83 |
@@ -50,7 +50,7 @@ public: |
84 |
} |
85 |
|
86 |
double fpo() { |
87 |
- return 2*double(_size); |
88 |
+ return 6*double(_size); |
89 |
} |
90 |
|
91 |
inline void initialize(){ |
92 |
|
93 |
diff --git a/btl/libs/BLAS/main.cpp b/btl/libs/BLAS/main.cpp |
94 |
index da156b8..9f43464 100644 |
95 |
--- a/btl/libs/BLAS/main.cpp |
96 |
+++ b/btl/libs/BLAS/main.cpp |
97 |
@@ -17,9 +17,14 @@ |
98 |
// |
99 |
|
100 |
// Include the numeric interface |
101 |
-#define NI_FORTRAN |
102 |
+#ifdef NI_BLAS |
103 |
+# define NI_FORTRAN |
104 |
+#endif |
105 |
+ |
106 |
#include "NumericInterface.hpp" |
107 |
|
108 |
+typedef NumericInterface<double> Interface; |
109 |
+ |
110 |
// Include the BTL |
111 |
#include "utilities.h" |
112 |
#include "bench.hh" |
113 |
@@ -28,20 +33,82 @@ |
114 |
#include "actionsBLAS.hpp" |
115 |
|
116 |
#include <string> |
117 |
+#include <iostream> |
118 |
+ |
119 |
+using namespace std; |
120 |
|
121 |
BTL_MAIN; |
122 |
|
123 |
int main(int argv, char **argc) |
124 |
{ |
125 |
- bench<Action_axpy<NumericInterface<double> > >(4, 6000, 20); |
126 |
- bench<Action_rot<NumericInterface<double> > >(4, 6000, 20); |
127 |
- |
128 |
- bench<Action_MatrixVector<NumericInterface<double> > >(4, 2000, 20); |
129 |
- bench<Action_MatrixTVector<NumericInterface<double> > >(4, 2000, 20); |
130 |
- bench<Action_SymMatrixVector<NumericInterface<double> > >(4, 2000, 20); |
131 |
- bench<Action_TriSolveVector<NumericInterface<double> > >(4, 2000, 20); |
132 |
- bench<Action_Rank1Update<NumericInterface<double> > >(4, 2000, 20); |
133 |
- bench<Action_Rank2Update<NumericInterface<double> > >(4, 2000, 20); |
134 |
+ bool |
135 |
+ do_axpy=false, do_rot=false, |
136 |
+ |
137 |
+ do_MatrixVector=false, do_MatrixTVector=false, do_SymMatrixVector=false, |
138 |
+ do_Rank1Update=false, do_Rank2Update=false, do_TriSolveVector=false, |
139 |
+ |
140 |
+ do_MatrixMatrix=false, do_MatrixTMatrix=false, |
141 |
+ do_TriMatrixMatrix=false, do_TriSolveMatrix=false |
142 |
+ ; |
143 |
+ |
144 |
+ int N = 100; |
145 |
+ |
146 |
+ |
147 |
+ for (int i = 1; i < argv; ++i) { |
148 |
+ std::string arg = argc[i]; |
149 |
+ |
150 |
+ if (arg == "axpy") do_axpy = true; |
151 |
+ else if (arg == "rot") do_rot = true; |
152 |
+ |
153 |
+ else if (arg == "MatrixVector") do_MatrixVector = true; |
154 |
+ else if (arg == "MatrixTVector") do_MatrixTVector = true; |
155 |
+ else if (arg == "SymMatrixVector") do_SymMatrixVector = true; |
156 |
+ else if (arg == "Rank1Update") do_Rank1Update = true; |
157 |
+ else if (arg == "Rank2Update") do_Rank2Update = true; |
158 |
+ else if (arg == "TriSolveVector") do_TriSolveVector = true; |
159 |
+ |
160 |
+ else if (arg == "MatrixMatrix") do_MatrixMatrix = true; |
161 |
+ else if (arg == "MatrixTMatrix") do_MatrixTMatrix = true; |
162 |
+ else if (arg == "TriMatrixMatrix") do_TriMatrixMatrix = true; |
163 |
+ else if (arg == "TrisolveMatrix") do_TriSolveMatrix = true; |
164 |
+ |
165 |
+ // Check switch -N |
166 |
+ else if (arg[0] == '-' && arg[1] == 'N') { |
167 |
+ if (arg[2] != '\0') |
168 |
+ N = atoi(arg.c_str()+2); |
169 |
+ else |
170 |
+ N = atoi(argc[++i]); |
171 |
+ } |
172 |
+ } |
173 |
+ |
174 |
+ if (do_axpy) |
175 |
+ bench<Action_axpy<Interface> >(MIN_AXPY,MAX_AXPY, N); |
176 |
+ if (do_rot) |
177 |
+ bench<Action_rot<Interface> >(MIN_AXPY,MAX_AXPY, N); |
178 |
+ |
179 |
+ if (do_MatrixVector) |
180 |
+ bench<Action_MatrixVector<Interface> >(MIN_MV,MAX_MV, N); |
181 |
+ if (do_MatrixTVector) |
182 |
+ bench<Action_MatrixTVector<Interface> >(MIN_MV,MAX_MV, N); |
183 |
+ if (do_SymMatrixVector) |
184 |
+ bench<Action_SymMatrixVector<Interface> >(MIN_MV,MAX_MV, N); |
185 |
+ if (do_Rank1Update) |
186 |
+ bench<Action_Rank1Update<Interface> >(MIN_MV,MAX_MV, N); |
187 |
+ if (do_Rank2Update) |
188 |
+ bench<Action_Rank2Update<Interface> >(MIN_MV,MAX_MV, N); |
189 |
+ if (do_TriSolveVector) |
190 |
+ bench<Action_TriSolveVector<Interface> >(MIN_MM,MAX_MM, N); |
191 |
+ |
192 |
+ /* |
193 |
+ if (matrix_matrix) |
194 |
+ bench<Action_matrix_matrix_product<Interface> >(MIN_MM,MAX_MM, N); |
195 |
+ if (aat) |
196 |
+ bench<Action_aat_product<Interface> >(MIN_MM,MAX_MM, N); |
197 |
+ if (trisolve_matrix) |
198 |
+ bench<Action_trisolve_matrix<Interface> >(MIN_MM,MAX_MM, N); |
199 |
+ if (trmm) |
200 |
+ bench<Action_trmm<Interface> >(MIN_MM,MAX_MM, N); |
201 |
+ */ |
202 |
|
203 |
|
204 |
return 0; |
205 |
|
206 |
diff --git a/numbench/modules/__init__.py b/numbench/modules/__init__.py |
207 |
index ba077a6..5b7cd3c 100644 |
208 |
--- a/numbench/modules/__init__.py |
209 |
+++ b/numbench/modules/__init__.py |
210 |
@@ -51,6 +51,7 @@ def loadModule(modname, args=None): |
211 |
|
212 |
# Get the arguments string |
213 |
args = "" if args is None else args |
214 |
+ args = tuple(args) if type(args) == type([]) else args |
215 |
args = args if type(args) == type(()) else tuple(args.split(' ')) |
216 |
|
217 |
# Load the module |
218 |
|
219 |
diff --git a/numbench/modules/internal/blasBase.py b/numbench/modules/internal/blasBase.py |
220 |
index bf2faf5..fa88ed5 100644 |
221 |
--- a/numbench/modules/internal/blasBase.py |
222 |
+++ b/numbench/modules/internal/blasBase.py |
223 |
@@ -65,7 +65,7 @@ def runTest(self, test, implementation): |
224 |
logdir=pjoin(test['logdir'], implementation), |
225 |
testdir=pjoin(test['testdir'], implementation), |
226 |
btlincludes=('libs/BLAS',), |
227 |
- defines=("CBLASNAME=" + self.libname, self.libname.upper() + "_INTERFACE"), |
228 |
+ defines = ("NI_NAME=" + self.libname, "NI_" + self.libname.upper()), |
229 |
flags=alt.getFlags(test, self.libname, implementation), |
230 |
tests=self.tests |
231 |
) |
232 |
|
233 |
diff --git a/numbench/utils/btl.py b/numbench/utils/btl.py |
234 |
index 6801299..cc0a7fe 100644 |
235 |
--- a/numbench/utils/btl.py |
236 |
+++ b/numbench/utils/btl.py |
237 |
@@ -23,7 +23,8 @@ from os.path import join as pjoin, dirname |
238 |
import os, re, shlex, subprocess as sp |
239 |
|
240 |
# BTL global flags |
241 |
-btlincludes = ('actions','generic_bench','generic_bench/utils','libs/STL') |
242 |
+btlincludes = ('actions', 'generic_bench', 'generic_bench/utils', |
243 |
+ 'NumericInterface') |
244 |
btllibraries = ('rt',) |
245 |
btldefines = ('NDEBUG',) |