Home | History | Annotate | Download | only in bench
      1 
      2 #include <iostream>
      3 #include "BenchUtil.h"
      4 #include "basicbenchmark.h"
      5 
      6 int main(int argc, char *argv[])
      7 {
      8   DISABLE_SSE_EXCEPTIONS();
      9 
     10   // this is the list of matrix type and size we want to bench:
     11   // ((suffix) (matrix size) (number of iterations))
     12   #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000))
     13 //   #define MODES ((Xd)(20)(10000))
     14 
     15   #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \
     16     << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \
     17     << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "   /   "
     18 
     19   std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl;
     20 
     21   const int tries = 10;
     22 
     23   #define _RUN_BENCH(R,ARG,EL) \
     24     std::cout << ARG( \
     25       BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\
     26          BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \
     27     << "   ";
     28 
     29   BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<LazyEval>, MODES );
     30   std::cout << endl;
     31   BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<EarlyEval>, MODES );
     32   std::cout << endl;
     33 
     34   return 0;
     35 }
     36