1 |
commit: cb8694256a08f68e6447c7ff89e65809ef576e05 |
2 |
Author: spiros <andyspiros <AT> gmail <DOT> com> |
3 |
AuthorDate: Wed Jul 20 22:27:37 2011 +0000 |
4 |
Commit: Andrea Arteaga <andyspiros <AT> gmail <DOT> com> |
5 |
CommitDate: Wed Jul 20 22:27:37 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=cb869425 |
7 |
|
8 |
Added 2D FFTW tests. Much work around FFTW. |
9 |
|
10 |
--- |
11 |
btl/actions/action_fftw_1d.hh | 111 ++++++++++++++++++++ |
12 |
btl/actions/action_fftw_1d_backward_estimate.hh | 94 ----------------- |
13 |
btl/actions/action_fftw_1d_backward_measure.hh | 94 ----------------- |
14 |
btl/actions/action_fftw_1d_forward_estimate.hh | 94 ----------------- |
15 |
btl/actions/action_fftw_1d_forward_measure.hh | 94 ----------------- |
16 |
btl/actions/action_fftw_2d.hh | 111 ++++++++++++++++++++ |
17 |
btl/actions/base_action_fftw.hh | 69 ++++++++++++ |
18 |
btl/actions/fftw_actions.hh | 7 +- |
19 |
btl/generic_bench/bench.hh | 6 + |
20 |
.../timers/distributed_perf_analyzer_root.hh | 4 +- |
21 |
btl/libs/FFTW/fftw_interface.hh | 4 + |
22 |
btl/libs/FFTW/main.cpp | 31 ++++-- |
23 |
fftw.py | 5 +- |
24 |
13 files changed, 334 insertions(+), 390 deletions(-) |
25 |
|
26 |
diff --git a/btl/actions/action_fftw_1d.hh b/btl/actions/action_fftw_1d.hh |
27 |
new file mode 100644 |
28 |
index 0000000..f81d4c3 |
29 |
--- /dev/null |
30 |
+++ b/btl/actions/action_fftw_1d.hh |
31 |
@@ -0,0 +1,111 @@ |
32 |
+#ifndef ACTION_FFTW_1D |
33 |
+#define ACTION_FFTW_1D |
34 |
+#include <string> |
35 |
+#include <cmath> |
36 |
+ |
37 |
+#include "base_action_fftw.hh" |
38 |
+ |
39 |
+ |
40 |
+/* FORWARD - MEASURE */ |
41 |
+template<class Interface> |
42 |
+class Action_FFTW_1D_Forward_Measure : public Action_FFTW_base<Interface> |
43 |
+{ |
44 |
+public: |
45 |
+ // Constructor |
46 |
+ Action_FFTW_1D_Forward_Measure(const int& size) : |
47 |
+ Action_FFTW_base<Interface>(size, 1) |
48 |
+ { |
49 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_FORWARD, FFTW_MEASURE); |
50 |
+ } |
51 |
+ |
52 |
+ // Action name |
53 |
+ static inline std::string name( void ) |
54 |
+ { |
55 |
+ return "FFTW_1D_Forward_Measure_"+Interface::name(); |
56 |
+ } |
57 |
+ |
58 |
+ // Algorithm complexity |
59 |
+ double nb_op_base( void ){ |
60 |
+ const static double log_2 = std::log(2.); |
61 |
+ return this->size_ * std::log(this->size_)/log_2; |
62 |
+ } |
63 |
+}; |
64 |
+ |
65 |
+ |
66 |
+/* FORWARD - ESTIMATE */ |
67 |
+template<class Interface> |
68 |
+class Action_FFTW_1D_Forward_Estimate : public Action_FFTW_base<Interface> |
69 |
+{ |
70 |
+public: |
71 |
+ // Constructor |
72 |
+ Action_FFTW_1D_Forward_Estimate(const int& size) : |
73 |
+ Action_FFTW_base<Interface>(size, 1) |
74 |
+ { |
75 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_FORWARD, FFTW_ESTIMATE); |
76 |
+ } |
77 |
+ |
78 |
+ // Action name |
79 |
+ static inline std::string name( void ) |
80 |
+ { |
81 |
+ return "FFTW_1D_Forward_Estimate_"+Interface::name(); |
82 |
+ } |
83 |
+ |
84 |
+ // Algorithm complexity |
85 |
+ double nb_op_base( void ){ |
86 |
+ const static double log_2 = std::log(2.); |
87 |
+ return this->size_ * std::log(this->size_)/log_2; |
88 |
+ } |
89 |
+}; |
90 |
+ |
91 |
+/* BACKWARD - MEASURE */ |
92 |
+template<class Interface> |
93 |
+class Action_FFTW_1D_Backward_Measure : public Action_FFTW_base<Interface> |
94 |
+{ |
95 |
+public: |
96 |
+ // Constructor |
97 |
+ Action_FFTW_1D_Backward_Measure(const int& size) : |
98 |
+ Action_FFTW_base<Interface>(size, 1) |
99 |
+ { |
100 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_BACKWARD, FFTW_MEASURE); |
101 |
+ } |
102 |
+ |
103 |
+ // Action name |
104 |
+ static inline std::string name( void ) |
105 |
+ { |
106 |
+ return "FFTW_1D_Backward_Measure_"+Interface::name(); |
107 |
+ } |
108 |
+ |
109 |
+ // Algorithm complexity |
110 |
+ double nb_op_base( void ){ |
111 |
+ const static double log_2 = std::log(2.); |
112 |
+ return this->size_ * std::log(this->size_)/log_2; |
113 |
+ } |
114 |
+}; |
115 |
+ |
116 |
+ |
117 |
+/* BACKWARD - ESTIMATE */ |
118 |
+template<class Interface> |
119 |
+class Action_FFTW_1D_Backward_Estimate : public Action_FFTW_base<Interface> |
120 |
+{ |
121 |
+public: |
122 |
+ // Constructor |
123 |
+ Action_FFTW_1D_Backward_Estimate(const int& size) : |
124 |
+ Action_FFTW_base<Interface>(size, 1) |
125 |
+ { |
126 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_BACKWARD, FFTW_ESTIMATE); |
127 |
+ } |
128 |
+ |
129 |
+ // Action name |
130 |
+ static inline std::string name( void ) |
131 |
+ { |
132 |
+ return "FFTW_1D_Backward_Estimate_"+Interface::name(); |
133 |
+ } |
134 |
+ |
135 |
+ // Algorithm complexity |
136 |
+ double nb_op_base( void ){ |
137 |
+ const static double log_2 = std::log(2.); |
138 |
+ return this->size_ * std::log(this->size_)/log_2; |
139 |
+ } |
140 |
+}; |
141 |
+ |
142 |
+#endif // ACTION_FFTW_1D |
143 |
|
144 |
diff --git a/btl/actions/action_fftw_1d_backward_estimate.hh b/btl/actions/action_fftw_1d_backward_estimate.hh |
145 |
deleted file mode 100644 |
146 |
index eda5468..0000000 |
147 |
--- a/btl/actions/action_fftw_1d_backward_estimate.hh |
148 |
+++ /dev/null |
149 |
@@ -1,94 +0,0 @@ |
150 |
-#ifndef ACTION_FFTW_1D_BACKWARD_ESTIMATE |
151 |
-#define ACTION_FFTW_1D_BACKWARD_ESTIMATE |
152 |
-#include "utilities.h" |
153 |
-#include "STL_interface.hh" |
154 |
-#include <string> |
155 |
-#include <cmath> |
156 |
-#include "init/init_function.hh" |
157 |
-#include "init/init_vector.hh" |
158 |
- |
159 |
-using namespace std; |
160 |
- |
161 |
-template<class Interface> |
162 |
-class Action_FFTW_1D_Backward_Estimate { |
163 |
- |
164 |
-public : |
165 |
- |
166 |
- // Ctor |
167 |
- |
168 |
- Action_FFTW_1D_Backward_Estimate( int size ):_size(size) |
169 |
- { |
170 |
- MESSAGE("Action_FFTW_1D_Backward_Estimate Ctor"); |
171 |
- |
172 |
- // STL vector initialization |
173 |
- |
174 |
- init_vector<pseudo_random>(X_stl,_size); |
175 |
- init_vector<null_function>(Y_stl,_size); |
176 |
- |
177 |
- // generic matrix and vector initialization |
178 |
- |
179 |
- Interface::vector_from_stl(X,X_stl); |
180 |
- Interface::vector_from_stl(Y,Y_stl); |
181 |
- |
182 |
- Interface::fftw_init_plan(p,_size, X, Y, FFTW_FORWARD, FFTW_MEASURE); |
183 |
- |
184 |
- } |
185 |
- |
186 |
- // invalidate copy ctor |
187 |
- |
188 |
- Action_FFTW_1D_Backward_Estimate( const Action_FFTW_1D_Backward_Estimate & ) |
189 |
- { |
190 |
- INFOS("illegal call to Action_FFTW_1D_Backward_Estimate Copy Ctor"); |
191 |
- exit(1); |
192 |
- } |
193 |
- |
194 |
- // Dtor |
195 |
- |
196 |
- ~Action_FFTW_1D_Backward_Estimate( void ){ |
197 |
- |
198 |
- MESSAGE("Action_FFTW_1D_Backward_Estimate Dtor"); |
199 |
- |
200 |
- // deallocation |
201 |
- |
202 |
- Interface::free_vector(X); |
203 |
- Interface::free_vector(Y); |
204 |
- } |
205 |
- |
206 |
- // action name |
207 |
- |
208 |
- static inline std::string name( void ) |
209 |
- { |
210 |
- return "FFTW_1D_Backward_Estimate_"+Interface::name(); |
211 |
- } |
212 |
- |
213 |
- double nb_op_base( void ){ |
214 |
- const static double log_2 = log(2.); |
215 |
- return _size * log(_size)/log_2; |
216 |
- } |
217 |
- |
218 |
- inline void initialize( void ){ |
219 |
- } |
220 |
- |
221 |
- inline void calculate( void ) { |
222 |
- BTL_ASM_COMMENT("mybegin FFTW_1D_Backward_Estimate"); |
223 |
- Interface::fftw_run(p); |
224 |
- BTL_ASM_COMMENT("myend FFTW_1D_Backward_Estimate"); |
225 |
- } |
226 |
- |
227 |
- void check_result( void ){ |
228 |
- } |
229 |
- |
230 |
-private : |
231 |
- |
232 |
- typename Interface::stl_vector X_stl; |
233 |
- typename Interface::stl_vector Y_stl; |
234 |
- |
235 |
- typename Interface::gene_vector X; |
236 |
- typename Interface::gene_vector Y; |
237 |
- |
238 |
- typename Interface::plan p; |
239 |
- |
240 |
- int _size; |
241 |
-}; |
242 |
- |
243 |
-#endif // ACTION_FFTW_1D_BACKWARD_ESTIMATE |
244 |
|
245 |
diff --git a/btl/actions/action_fftw_1d_backward_measure.hh b/btl/actions/action_fftw_1d_backward_measure.hh |
246 |
deleted file mode 100644 |
247 |
index e204423..0000000 |
248 |
--- a/btl/actions/action_fftw_1d_backward_measure.hh |
249 |
+++ /dev/null |
250 |
@@ -1,94 +0,0 @@ |
251 |
-#ifndef ACTION_FFTW_1D_BACKWARD_MEASURE |
252 |
-#define ACTION_FFTW_1D_BACKWARD_MEASURE |
253 |
-#include "utilities.h" |
254 |
-#include "STL_interface.hh" |
255 |
-#include <string> |
256 |
-#include <cmath> |
257 |
-#include "init/init_function.hh" |
258 |
-#include "init/init_vector.hh" |
259 |
- |
260 |
-using namespace std; |
261 |
- |
262 |
-template<class Interface> |
263 |
-class Action_FFTW_1D_Backward_Measure { |
264 |
- |
265 |
-public : |
266 |
- |
267 |
- // Ctor |
268 |
- |
269 |
- Action_FFTW_1D_Backward_Measure( int size ):_size(size) |
270 |
- { |
271 |
- MESSAGE("Action_FFTW_1D_Backward_Measure Ctor"); |
272 |
- |
273 |
- // STL vector initialization |
274 |
- |
275 |
- init_vector<pseudo_random>(X_stl,_size); |
276 |
- init_vector<null_function>(Y_stl,_size); |
277 |
- |
278 |
- // generic matrix and vector initialization |
279 |
- |
280 |
- Interface::vector_from_stl(X,X_stl); |
281 |
- Interface::vector_from_stl(Y,Y_stl); |
282 |
- |
283 |
- Interface::fftw_init_plan(p,_size, X, Y, FFTW_FORWARD, FFTW_MEASURE); |
284 |
- |
285 |
- } |
286 |
- |
287 |
- // invalidate copy ctor |
288 |
- |
289 |
- Action_FFTW_1D_Backward_Measure( const Action_FFTW_1D_Backward_Measure & ) |
290 |
- { |
291 |
- INFOS("illegal call to Action_FFTW_1D_Backward_Measure Copy Ctor"); |
292 |
- exit(1); |
293 |
- } |
294 |
- |
295 |
- // Dtor |
296 |
- |
297 |
- ~Action_FFTW_1D_Backward_Measure( void ){ |
298 |
- |
299 |
- MESSAGE("Action_FFTW_1D_Backward_Measure Dtor"); |
300 |
- |
301 |
- // deallocation |
302 |
- |
303 |
- Interface::free_vector(X); |
304 |
- Interface::free_vector(Y); |
305 |
- } |
306 |
- |
307 |
- // action name |
308 |
- |
309 |
- static inline std::string name( void ) |
310 |
- { |
311 |
- return "FFTW_1D_Backward_Measure_"+Interface::name(); |
312 |
- } |
313 |
- |
314 |
- double nb_op_base( void ){ |
315 |
- const static double log_2 = log(2.); |
316 |
- return _size * log(_size)/log_2; |
317 |
- } |
318 |
- |
319 |
- inline void initialize( void ){ |
320 |
- } |
321 |
- |
322 |
- inline void calculate( void ) { |
323 |
- BTL_ASM_COMMENT("mybegin FFTW_1D_Backward_Measure"); |
324 |
- Interface::fftw_run(p); |
325 |
- BTL_ASM_COMMENT("myend FFTW_1D_Backward_Measure"); |
326 |
- } |
327 |
- |
328 |
- void check_result( void ){ |
329 |
- } |
330 |
- |
331 |
-private : |
332 |
- |
333 |
- typename Interface::stl_vector X_stl; |
334 |
- typename Interface::stl_vector Y_stl; |
335 |
- |
336 |
- typename Interface::gene_vector X; |
337 |
- typename Interface::gene_vector Y; |
338 |
- |
339 |
- typename Interface::plan p; |
340 |
- |
341 |
- int _size; |
342 |
-}; |
343 |
- |
344 |
-#endif // ACTION_FFTW_1D_BACKWARD_MEASURE |
345 |
|
346 |
diff --git a/btl/actions/action_fftw_1d_forward_estimate.hh b/btl/actions/action_fftw_1d_forward_estimate.hh |
347 |
deleted file mode 100644 |
348 |
index efd8743..0000000 |
349 |
--- a/btl/actions/action_fftw_1d_forward_estimate.hh |
350 |
+++ /dev/null |
351 |
@@ -1,94 +0,0 @@ |
352 |
-#ifndef ACTION_FFTW_1D_FORWARD_ESTIMATE |
353 |
-#define ACTION_FFTW_1D_FORWARD_ESTIMATE |
354 |
-#include "utilities.h" |
355 |
-#include "STL_interface.hh" |
356 |
-#include <string> |
357 |
-#include <cmath> |
358 |
-#include "init/init_function.hh" |
359 |
-#include "init/init_vector.hh" |
360 |
- |
361 |
-using namespace std; |
362 |
- |
363 |
-template<class Interface> |
364 |
-class Action_FFTW_1D_Forward_Estimate { |
365 |
- |
366 |
-public : |
367 |
- |
368 |
- // Ctor |
369 |
- |
370 |
- Action_FFTW_1D_Forward_Estimate( int size ):_size(size) |
371 |
- { |
372 |
- MESSAGE("Action_FFTW_1D_Forward_Estimate Ctor"); |
373 |
- |
374 |
- // STL vector initialization |
375 |
- |
376 |
- init_vector<pseudo_random>(X_stl,_size); |
377 |
- init_vector<null_function>(Y_stl,_size); |
378 |
- |
379 |
- // generic matrix and vector initialization |
380 |
- |
381 |
- Interface::vector_from_stl(X,X_stl); |
382 |
- Interface::vector_from_stl(Y,Y_stl); |
383 |
- |
384 |
- Interface::fftw_init_plan(p,_size, X, Y, FFTW_FORWARD, FFTW_MEASURE); |
385 |
- |
386 |
- } |
387 |
- |
388 |
- // invalidate copy ctor |
389 |
- |
390 |
- Action_FFTW_1D_Forward_Estimate( const Action_FFTW_1D_Forward_Estimate & ) |
391 |
- { |
392 |
- INFOS("illegal call to Action_FFTW_1D_Forward_Estimate Copy Ctor"); |
393 |
- exit(1); |
394 |
- } |
395 |
- |
396 |
- // Dtor |
397 |
- |
398 |
- ~Action_FFTW_1D_Forward_Estimate( void ){ |
399 |
- |
400 |
- MESSAGE("Action_FFTW_1D_Forward_Estimate Dtor"); |
401 |
- |
402 |
- // deallocation |
403 |
- |
404 |
- Interface::free_vector(X); |
405 |
- Interface::free_vector(Y); |
406 |
- } |
407 |
- |
408 |
- // action name |
409 |
- |
410 |
- static inline std::string name( void ) |
411 |
- { |
412 |
- return "FFTW_1D_Forward_Estimate_"+Interface::name(); |
413 |
- } |
414 |
- |
415 |
- double nb_op_base( void ){ |
416 |
- const static double log_2 = log(2.); |
417 |
- return _size * log(_size)/log_2; |
418 |
- } |
419 |
- |
420 |
- inline void initialize( void ){ |
421 |
- } |
422 |
- |
423 |
- inline void calculate( void ) { |
424 |
- BTL_ASM_COMMENT("mybegin FFTW_1D_Forward_Estimate"); |
425 |
- Interface::fftw_run(p); |
426 |
- BTL_ASM_COMMENT("myend FFTW_1D_Forward_Estimate"); |
427 |
- } |
428 |
- |
429 |
- void check_result( void ){ |
430 |
- } |
431 |
- |
432 |
-private : |
433 |
- |
434 |
- typename Interface::stl_vector X_stl; |
435 |
- typename Interface::stl_vector Y_stl; |
436 |
- |
437 |
- typename Interface::gene_vector X; |
438 |
- typename Interface::gene_vector Y; |
439 |
- |
440 |
- typename Interface::plan p; |
441 |
- |
442 |
- int _size; |
443 |
-}; |
444 |
- |
445 |
-#endif // ACTION_FFTW_1D_FORWARD_ESTIMATE |
446 |
|
447 |
diff --git a/btl/actions/action_fftw_1d_forward_measure.hh b/btl/actions/action_fftw_1d_forward_measure.hh |
448 |
deleted file mode 100644 |
449 |
index 2697230..0000000 |
450 |
--- a/btl/actions/action_fftw_1d_forward_measure.hh |
451 |
+++ /dev/null |
452 |
@@ -1,94 +0,0 @@ |
453 |
-#ifndef ACTION_FFTW_1D_FORWARD_MEASURE |
454 |
-#define ACTION_FFTW_1D_FORWARD_MEASURE |
455 |
-#include "utilities.h" |
456 |
-#include "STL_interface.hh" |
457 |
-#include <string> |
458 |
-#include <cmath> |
459 |
-#include "init/init_function.hh" |
460 |
-#include "init/init_vector.hh" |
461 |
- |
462 |
-using namespace std; |
463 |
- |
464 |
-template<class Interface> |
465 |
-class Action_FFTW_1D_Forward_Measure { |
466 |
- |
467 |
-public : |
468 |
- |
469 |
- // Ctor |
470 |
- |
471 |
- Action_FFTW_1D_Forward_Measure( int size ):_size(size) |
472 |
- { |
473 |
- MESSAGE("Action_FFTW_1D_Forward_Measure Ctor"); |
474 |
- |
475 |
- // STL vector initialization |
476 |
- |
477 |
- init_vector<pseudo_random>(X_stl,_size); |
478 |
- init_vector<null_function>(Y_stl,_size); |
479 |
- |
480 |
- // generic matrix and vector initialization |
481 |
- |
482 |
- Interface::vector_from_stl(X,X_stl); |
483 |
- Interface::vector_from_stl(Y,Y_stl); |
484 |
- |
485 |
- Interface::fftw_init_plan(p,_size, X, Y, FFTW_FORWARD, FFTW_MEASURE); |
486 |
- |
487 |
- } |
488 |
- |
489 |
- // invalidate copy ctor |
490 |
- |
491 |
- Action_FFTW_1D_Forward_Measure( const Action_FFTW_1D_Forward_Measure & ) |
492 |
- { |
493 |
- INFOS("illegal call to Action_FFTW_1D_Forward_Measure Copy Ctor"); |
494 |
- exit(1); |
495 |
- } |
496 |
- |
497 |
- // Dtor |
498 |
- |
499 |
- ~Action_FFTW_1D_Forward_Measure( void ){ |
500 |
- |
501 |
- MESSAGE("Action_FFTW_1D_Forward_Measure Dtor"); |
502 |
- |
503 |
- // deallocation |
504 |
- |
505 |
- Interface::free_vector(X); |
506 |
- Interface::free_vector(Y); |
507 |
- } |
508 |
- |
509 |
- // action name |
510 |
- |
511 |
- static inline std::string name( void ) |
512 |
- { |
513 |
- return "FFTW_1D_Forward_Measure_"+Interface::name(); |
514 |
- } |
515 |
- |
516 |
- double nb_op_base( void ){ |
517 |
- const static double log_2 = log(2.); |
518 |
- return _size * log(_size)/log_2; |
519 |
- } |
520 |
- |
521 |
- inline void initialize( void ){ |
522 |
- } |
523 |
- |
524 |
- inline void calculate( void ) { |
525 |
- BTL_ASM_COMMENT("mybegin FFTW_1D_Forward_Measure"); |
526 |
- Interface::fftw_run(p); |
527 |
- BTL_ASM_COMMENT("myend FFTW_1D_Forward_Measure"); |
528 |
- } |
529 |
- |
530 |
- void check_result( void ){ |
531 |
- } |
532 |
- |
533 |
-private : |
534 |
- |
535 |
- typename Interface::stl_vector X_stl; |
536 |
- typename Interface::stl_vector Y_stl; |
537 |
- |
538 |
- typename Interface::gene_vector X; |
539 |
- typename Interface::gene_vector Y; |
540 |
- |
541 |
- typename Interface::plan p; |
542 |
- |
543 |
- int _size; |
544 |
-}; |
545 |
- |
546 |
-#endif // ACTION_FFTW_1D_FORWARD_MEASURE |
547 |
|
548 |
diff --git a/btl/actions/action_fftw_2d.hh b/btl/actions/action_fftw_2d.hh |
549 |
new file mode 100644 |
550 |
index 0000000..c8aff39 |
551 |
--- /dev/null |
552 |
+++ b/btl/actions/action_fftw_2d.hh |
553 |
@@ -0,0 +1,111 @@ |
554 |
+#ifndef ACTION_FFTW_2D |
555 |
+#define ACTION_FFTW_2D |
556 |
+#include <string> |
557 |
+#include <cmath> |
558 |
+ |
559 |
+#include "base_action_fftw.hh" |
560 |
+ |
561 |
+ |
562 |
+/* FORWARD - MEASURE */ |
563 |
+template<class Interface> |
564 |
+class Action_FFTW_2D_Forward_Measure : public Action_FFTW_base<Interface> |
565 |
+{ |
566 |
+public: |
567 |
+ // Constructor |
568 |
+ Action_FFTW_2D_Forward_Measure(const int& size) : |
569 |
+ Action_FFTW_base<Interface>(size, 2) |
570 |
+ { |
571 |
+ Interface::fftw_init_plan_2d(this->p, size, this->X, this->Y, FFTW_FORWARD, FFTW_MEASURE); |
572 |
+ } |
573 |
+ |
574 |
+ // Action name |
575 |
+ static inline std::string name( void ) |
576 |
+ { |
577 |
+ return "FFTW_2D_Forward_Measure_"+Interface::name(); |
578 |
+ } |
579 |
+ |
580 |
+ // Algorithm complexity |
581 |
+ double nb_op_base( void ){ |
582 |
+ const static double log_2 = std::log(2.); |
583 |
+ return (this->size_ * std::log(this->size_)/log_2) * 2*this->size_; |
584 |
+ } |
585 |
+}; |
586 |
+ |
587 |
+ |
588 |
+/* FORWARD - ESTIMATE */ |
589 |
+template<class Interface> |
590 |
+class Action_FFTW_2D_Forward_Estimate : public Action_FFTW_base<Interface> |
591 |
+{ |
592 |
+public: |
593 |
+ // Constructor |
594 |
+ Action_FFTW_2D_Forward_Estimate(const int& size) : |
595 |
+ Action_FFTW_base<Interface>(size, 2) |
596 |
+ { |
597 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_FORWARD, FFTW_ESTIMATE); |
598 |
+ } |
599 |
+ |
600 |
+ // Action name |
601 |
+ static inline std::string name( void ) |
602 |
+ { |
603 |
+ return "FFTW_2D_Forward_Estimate_"+Interface::name(); |
604 |
+ } |
605 |
+ |
606 |
+ // Algorithm complexity |
607 |
+ double nb_op_base( void ){ |
608 |
+ const static double log_2 = std::log(2.); |
609 |
+ return (this->size_ * std::log(this->size_)/log_2) * 2*this->size_; |
610 |
+ } |
611 |
+}; |
612 |
+ |
613 |
+/* BACKWARD - MEASURE */ |
614 |
+template<class Interface> |
615 |
+class Action_FFTW_2D_Backward_Measure : public Action_FFTW_base<Interface> |
616 |
+{ |
617 |
+public: |
618 |
+ // Constructor |
619 |
+ Action_FFTW_2D_Backward_Measure(const int& size) : |
620 |
+ Action_FFTW_base<Interface>(size, 2) |
621 |
+ { |
622 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_BACKWARD, FFTW_MEASURE); |
623 |
+ } |
624 |
+ |
625 |
+ // Action name |
626 |
+ static inline std::string name( void ) |
627 |
+ { |
628 |
+ return "FFTW_2D_Backward_Measure_"+Interface::name(); |
629 |
+ } |
630 |
+ |
631 |
+ // Algorithm complexity |
632 |
+ double nb_op_base( void ){ |
633 |
+ const static double log_2 = std::log(2.); |
634 |
+ return (this->size_ * std::log(this->size_)/log_2) * 2*this->size_; |
635 |
+ } |
636 |
+}; |
637 |
+ |
638 |
+ |
639 |
+/* BACKWARD - ESTIMATE */ |
640 |
+template<class Interface> |
641 |
+class Action_FFTW_2D_Backward_Estimate : public Action_FFTW_base<Interface> |
642 |
+{ |
643 |
+public: |
644 |
+ // Constructor |
645 |
+ Action_FFTW_2D_Backward_Estimate(const int& size) : |
646 |
+ Action_FFTW_base<Interface>(size, 2) |
647 |
+ { |
648 |
+ Interface::fftw_init_plan(this->p, size, this->X, this->Y, FFTW_BACKWARD, FFTW_ESTIMATE); |
649 |
+ } |
650 |
+ |
651 |
+ // Action name |
652 |
+ static inline std::string name( void ) |
653 |
+ { |
654 |
+ return "FFTW_2D_Backward_Estimate_"+Interface::name(); |
655 |
+ } |
656 |
+ |
657 |
+ // Algorithm complexity |
658 |
+ double nb_op_base( void ){ |
659 |
+ const static double log_2 = std::log(2.); |
660 |
+ return (this->size_ * std::log(this->size_)/log_2) * 2*this->size_; |
661 |
+ } |
662 |
+}; |
663 |
+ |
664 |
+#endif // ACTION_FFTW_2D |
665 |
|
666 |
diff --git a/btl/actions/base_action_fftw.hh b/btl/actions/base_action_fftw.hh |
667 |
new file mode 100644 |
668 |
index 0000000..410161c |
669 |
--- /dev/null |
670 |
+++ b/btl/actions/base_action_fftw.hh |
671 |
@@ -0,0 +1,69 @@ |
672 |
+#ifndef BASE_ACTION_FFTW_HH |
673 |
+#define BASE_ACTION_FFTW_HH |
674 |
+ |
675 |
+#include "utilities.h" |
676 |
+#include "init/init_function.hh" |
677 |
+#include "init/init_vector.hh" |
678 |
+ |
679 |
+inline int power(const int& base, const int& exp) { |
680 |
+ int ret = 1; |
681 |
+ for (int i = 0; i < exp; ++i) |
682 |
+ ret *= base; |
683 |
+ return ret; |
684 |
+} |
685 |
+ |
686 |
+template<class Interface> |
687 |
+class Action_FFTW_base |
688 |
+{ |
689 |
+public: |
690 |
+ // Constructor |
691 |
+ Action_FFTW_base(const int& size, const int& dimensions) : |
692 |
+ size_(size), dimensions_(dimensions), N_(power(size, dimensions)) |
693 |
+ { |
694 |
+ // STL vector initialization |
695 |
+ init_vector < pseudo_random > (X_stl, N_); |
696 |
+ init_vector < null_function > (Y_stl, N_); |
697 |
+ |
698 |
+ // Generic vector initialization |
699 |
+ Interface::vector_from_stl(X, X_stl); |
700 |
+ Interface::vector_from_stl(Y, Y_stl); |
701 |
+ |
702 |
+ // To be done by the child: |
703 |
+ /* initialize plan! */ |
704 |
+ } |
705 |
+ |
706 |
+ // Invalidate copy constructor |
707 |
+ Action_FFTW_base( const Action_FFTW_base & ) |
708 |
+ { |
709 |
+ INFOS("illegal call to Action_FFTW_base Copy Ctor"); |
710 |
+ exit(1); |
711 |
+ } |
712 |
+ |
713 |
+ // Destructor: |
714 |
+ // frees the memory |
715 |
+ ~Action_FFTW_base() |
716 |
+ { |
717 |
+ Interface::free_vector(X); |
718 |
+ Interface::free_vector(Y); |
719 |
+ } |
720 |
+ |
721 |
+ inline void initialize() { } |
722 |
+ |
723 |
+ inline void calculate( void ) { |
724 |
+ Interface::fftw_run(p); |
725 |
+ } |
726 |
+ |
727 |
+ void check_result( void ){ |
728 |
+ } |
729 |
+ |
730 |
+ |
731 |
+protected: |
732 |
+ const int size_, dimensions_, N_; |
733 |
+ |
734 |
+ typename Interface::stl_vector X_stl, Y_stl; |
735 |
+ typename Interface::gene_vector X, Y; |
736 |
+ |
737 |
+ typename Interface::plan p; |
738 |
+}; |
739 |
+ |
740 |
+#endif /* BASE_ACTION_FFTW_HH */ |
741 |
|
742 |
diff --git a/btl/actions/fftw_actions.hh b/btl/actions/fftw_actions.hh |
743 |
index 3aced22..e18f746 100644 |
744 |
--- a/btl/actions/fftw_actions.hh |
745 |
+++ b/btl/actions/fftw_actions.hh |
746 |
@@ -1,9 +1,8 @@ |
747 |
#ifndef ACTION_FFTW |
748 |
#define ACTION_FFTW |
749 |
|
750 |
-#include "action_fftw_1d_forward_measure.hh" |
751 |
-#include "action_fftw_1d_forward_estimate.hh" |
752 |
-#include "action_fftw_1d_backward_measure.hh" |
753 |
-#include "action_fftw_1d_backward_estimate.hh" |
754 |
+#include "base_action_fftw.hh" |
755 |
+#include "action_fftw_1d.hh" |
756 |
+#include "action_fftw_2d.hh" |
757 |
|
758 |
#endif // ACTION_FFTW |
759 |
|
760 |
diff --git a/btl/generic_bench/bench.hh b/btl/generic_bench/bench.hh |
761 |
index 2a5ba36..7843cf7 100644 |
762 |
--- a/btl/generic_bench/bench.hh |
763 |
+++ b/btl/generic_bench/bench.hh |
764 |
@@ -29,8 +29,12 @@ |
765 |
#include <vector> |
766 |
#include <string> |
767 |
#include "timers/portable_perf_analyzer.hh" |
768 |
+ |
769 |
+#ifdef DISTRIBUTED |
770 |
#include "timers/distributed_perf_analyzer_root.hh" |
771 |
#include "timers/distributed_perf_analyzer_node.hh" |
772 |
+#endif |
773 |
+ |
774 |
// #include "timers/mixed_perf_analyzer.hh" |
775 |
// #include "timers/x86_perf_analyzer.hh" |
776 |
// #include "timers/STL_perf_analyzer.hh" |
777 |
@@ -80,6 +84,7 @@ BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point, bool silen |
778 |
bench<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point,silent); |
779 |
} |
780 |
|
781 |
+#ifdef DISTRIBUTED |
782 |
// distributed Perf Analyzer |
783 |
|
784 |
template <class Action> |
785 |
@@ -92,5 +97,6 @@ BTL_DONT_INLINE void distr_bench( int size_min, int size_max, int nb_point, bool |
786 |
else |
787 |
bench<Distributed_Perf_Analyzer_Root, Action>(size_min, size_max, nb_point, silent); |
788 |
} |
789 |
+#endif |
790 |
|
791 |
#endif |
792 |
|
793 |
diff --git a/btl/generic_bench/timers/distributed_perf_analyzer_root.hh b/btl/generic_bench/timers/distributed_perf_analyzer_root.hh |
794 |
index 98a08ef..807f20a 100644 |
795 |
--- a/btl/generic_bench/timers/distributed_perf_analyzer_root.hh |
796 |
+++ b/btl/generic_bench/timers/distributed_perf_analyzer_root.hh |
797 |
@@ -45,14 +45,14 @@ public: |
798 |
for (int i = 1; i < tries; ++i) { |
799 |
Action _action(size); |
800 |
if (!silent) |
801 |
- std::cout << " " << _action.nb_op_base()*_nb_calc/(m_time_action*1e6) << " "; |
802 |
+ std::cout << " " << _action.nb_op_base()*_nb_calc/(m_time_action*1e6) << " " << std::flush; |
803 |
_action.initialize(); |
804 |
m_time_action = std::min(m_time_action, time_calculate(_action)); |
805 |
} |
806 |
double time_action = m_time_action / (double(_nb_calc)); |
807 |
|
808 |
/* Check */ |
809 |
- int do_check = (BtlConfig::Instance.checkResults && size<128) ? 1 : 1; |
810 |
+ int do_check = (BtlConfig::Instance.checkResults && size<128) ? 1 : 0; |
811 |
igebs2d_(&context, "A", " ", &iONE, &iONE, &do_check, &iONE); |
812 |
if (do_check > 0) { |
813 |
action.initialize(); |
814 |
|
815 |
diff --git a/btl/libs/FFTW/fftw_interface.hh b/btl/libs/FFTW/fftw_interface.hh |
816 |
index db62519..f3077f3 100644 |
817 |
--- a/btl/libs/FFTW/fftw_interface.hh |
818 |
+++ b/btl/libs/FFTW/fftw_interface.hh |
819 |
@@ -54,6 +54,10 @@ public: |
820 |
p = fftw_plan_dft_1d(N, x, y, sign, flags); |
821 |
} |
822 |
|
823 |
+ static inline void fftw_init_plan_2d(plan & p, const int & N, gene_vector & x, gene_vector& y, const int & sign, const int & flags){ |
824 |
+ p = fftw_plan_dft_2d(N, N, x, y, sign, flags); |
825 |
+ } |
826 |
+ |
827 |
static inline void fftw_run(plan & p){ |
828 |
fftw_execute(p); |
829 |
} |
830 |
|
831 |
diff --git a/btl/libs/FFTW/main.cpp b/btl/libs/FFTW/main.cpp |
832 |
index 3f2f0c4..034a279 100644 |
833 |
--- a/btl/libs/FFTW/main.cpp |
834 |
+++ b/btl/libs/FFTW/main.cpp |
835 |
@@ -7,37 +7,54 @@ |
836 |
|
837 |
BTL_MAIN; |
838 |
|
839 |
-int main(int argv, char **argc) |
840 |
+int main(int argc, char **argv) |
841 |
{ |
842 |
bool |
843 |
fftw_1d_forward_measure = false, |
844 |
fftw_1d_forward_estimate = false, |
845 |
fftw_1d_backward_measure = false, |
846 |
- fftw_1d_backward_estimate = false |
847 |
+ fftw_1d_backward_estimate = false, |
848 |
+ |
849 |
+ fftw_2d_forward_measure = false, |
850 |
+ fftw_2d_forward_estimate = false, |
851 |
+ fftw_2d_backward_measure = false, |
852 |
+ fftw_2d_backward_estimate = false |
853 |
; |
854 |
|
855 |
|
856 |
- for (int i = 1; i < argv; ++i) { |
857 |
- std::string arg = argc[i]; |
858 |
+ for (int i = 1; i < argc; ++i) { |
859 |
+ std::string arg = argv[i]; |
860 |
+ |
861 |
if (arg == "FFTW_1D_Forward_Measure" || arg == "all") fftw_1d_forward_measure = true; |
862 |
if (arg == "FFTW_1D_Forward_Estimate" || arg == "all") fftw_1d_forward_estimate = true; |
863 |
if (arg == "FFTW_1D_Backward_Measure" || arg == "all") fftw_1d_backward_measure = true; |
864 |
if (arg == "FFTW_1D_Backward_Estimate" || arg == "all") fftw_1d_backward_estimate = true; |
865 |
+ |
866 |
+ if (arg == "FFTW_2D_Forward_Measure" || arg == "all") fftw_2d_forward_measure = true; |
867 |
+ if (arg == "FFTW_2D_Forward_Estimate" || arg == "all") fftw_2d_forward_estimate = true; |
868 |
+ if (arg == "FFTW_2D_Backward_Measure" || arg == "all") fftw_2d_backward_measure = true; |
869 |
+ if (arg == "FFTW_2D_Backward_Estimate" || arg == "all") fftw_2d_backward_estimate = true; |
870 |
} |
871 |
|
872 |
|
873 |
if (fftw_1d_forward_measure) |
874 |
bench<Action_FFTW_1D_Forward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
875 |
- |
876 |
if (fftw_1d_forward_estimate) |
877 |
bench<Action_FFTW_1D_Forward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
878 |
- |
879 |
if (fftw_1d_backward_measure) |
880 |
bench<Action_FFTW_1D_Backward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
881 |
- |
882 |
if (fftw_1d_backward_estimate) |
883 |
bench<Action_FFTW_1D_Backward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
884 |
|
885 |
+ if (fftw_2d_forward_measure) |
886 |
+ bench<Action_FFTW_2D_Forward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
887 |
+// if (fftw_1d_forward_estimate) |
888 |
+// bench<Action_FFTW_1D_Forward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
889 |
+// if (fftw_1d_backward_measure) |
890 |
+// bench<Action_FFTW_1D_Backward_Measure<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
891 |
+// if (fftw_1d_backward_estimate) |
892 |
+// bench<Action_FFTW_1D_Backward_Estimate<fftw_interface> >(MIN_MV,MAX_MV,NB_POINT); |
893 |
+ |
894 |
|
895 |
return 0; |
896 |
} |
897 |
|
898 |
diff --git a/fftw.py b/fftw.py |
899 |
index d589509..dd2b6e8 100644 |
900 |
--- a/fftw.py |
901 |
+++ b/fftw.py |
902 |
@@ -5,7 +5,10 @@ class Module(btlbase.BTLBase): |
903 |
self.libname = "fftw" |
904 |
self.avail = ( |
905 |
"FFTW_1D_Forward_Measure", "FFTW_1D_Forward_Estimate", |
906 |
- "FFTW_1D_Backward_Measure", "FFTW_1D_Backward_Estimate" |
907 |
+ "FFTW_1D_Backward_Measure", "FFTW_1D_Backward_Estimate", |
908 |
+ |
909 |
+ "FFTW_2D_Forward_Measure", "FFTW_2D_Forward_Estimate", |
910 |
+ "FFTW_2D_Backward_Measure", "FFTW_2D_Backward_Estimate" |
911 |
) |
912 |
|
913 |
def _parse_args(self, args): |