aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/basicbenchmark.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-03-09 16:13:47 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-03-09 16:13:47 +0000
commit9d9d81ad71a52c33ba4db9f8a6059d435d279316 (patch)
treed12a85ca594af99b04ce32f652ae67bf0baf228b /bench/basicbenchmark.cpp
parentf64311e07de95694187e5d6d5d2e3cd118302076 (diff)
* basic support for multicore CPU via a .evalOMP() which
internaly uses OpenMP if enabled at compile time. * added a bench/ folder with a couple benchmarks and benchmark tools.
Diffstat (limited to 'bench/basicbenchmark.cpp')
-rw-r--r--bench/basicbenchmark.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/bench/basicbenchmark.cpp b/bench/basicbenchmark.cpp
new file mode 100644
index 000000000..c44ed4514
--- /dev/null
+++ b/bench/basicbenchmark.cpp
@@ -0,0 +1,46 @@
+
+#include "BenchUtil.h"
+#include "basicbenchmark.h"
+
+int main(int argc, char *argv[])
+{
+ // disbale floating point exceptions
+ // this leads to more stable bench results
+ // (this is done by default by ICC)
+ #ifndef __INTEL_COMPILER
+ {
+ int aux;
+ asm(
+ "stmxcsr %[aux] \n\t"
+ "orl $32832, %[aux] \n\t"
+ "ldmxcsr %[aux] \n\t"
+ : : [aux] "m" (aux));
+ }
+ #endif
+
+ // this is the list of matrix type and size we want to bench:
+ // ((suffix) (matrix size) (number of iterations))
+ #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000))
+// #define MODES ((Xd)(20)(10000))
+
+ #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \
+ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \
+ << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << " / "
+
+ std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl;
+
+ const int tries = 10;
+
+ #define _RUN_BENCH(R,ARG,EL) \
+ std::cout << ARG( \
+ BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\
+ BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \
+ << " ";
+
+ BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<LazyEval>, MODES );
+ std::cout << endl;
+ BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<EarlyEval>, MODES );
+ std::cout << endl;
+
+ return 0;
+}