basicbenchmark.h
Go to the documentation of this file.
1 
2 #ifndef EIGEN_BENCH_BASICBENCH_H
3 #define EIGEN_BENCH_BASICBENCH_H
4 
6 
7 template <int Mode, typename MatrixType>
8 void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) __attribute__((noinline));
9 
10 template <int Mode, typename MatrixType>
11 void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) {
12  for (int a = 0; a < iterations; a++) {
13  if (Mode == LazyEval) {
14  asm("#begin_bench_loop LazyEval");
15  if (MatrixType::SizeAtCompileTime != Eigen::Dynamic) asm("#fixedsize");
16  m = (I + 0.00005 * (m + m.lazyProduct(m))).eval();
17  } else if (Mode == OmpEval) {
18  asm("#begin_bench_loop OmpEval");
19  if (MatrixType::SizeAtCompileTime != Eigen::Dynamic) asm("#fixedsize");
20  m = (I + 0.00005 * (m + m.lazyProduct(m))).eval();
21  } else {
22  asm("#begin_bench_loop EarlyEval");
23  if (MatrixType::SizeAtCompileTime != Eigen::Dynamic) asm("#fixedsize");
24  m = I + 0.00005 * (m + m * m);
25  }
26  asm("#end_bench_loop");
27  }
28 }
29 
30 template <int Mode, typename MatrixType>
31 double benchBasic(const MatrixType& mat, int size, int tries) __attribute__((noinline));
32 
33 template <int Mode, typename MatrixType>
34 double benchBasic(const MatrixType& mat, int iterations, int tries) {
35  const int rows = mat.rows();
36  const int cols = mat.cols();
37 
40 
42 
44  for (uint t = 0; t < tries; ++t) {
46  timer.start();
47  benchBasic_loop<Mode>(I, m, iterations);
48  timer.stop();
49  cerr << m;
50  }
51  return timer.value();
52 };
53 
54 #endif // EIGEN_BENCH_BASICBENCH_H
void initMatrix_identity(MatrixType &mat) __attribute__((noinline))
Definition: BenchUtil.h:31
void initMatrix_random(MatrixType &mat) __attribute__((noinline))
Definition: BenchUtil.h:24
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
double benchBasic(const MatrixType &mat, int size, int tries) __attribute__((noinline))
Definition: basicbenchmark.h:34
void benchBasic_loop(const MatrixType &I, MatrixType &m, int iterations) __attribute__((noinline))
Definition: basicbenchmark.h:11
@ LazyEval
Definition: basicbenchmark.h:5
@ EarlyEval
Definition: basicbenchmark.h:5
@ OmpEval
Definition: basicbenchmark.h:5
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Definition: BenchTimer.h:55
Index cols() const
Definition: SparseMatrix.h:161
Index rows() const
Definition: SparseMatrix.h:159
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
#define I
Definition: main.h:127
svint32_t PacketXi __attribute__((arm_sve_vector_bits(EIGEN_ARM64_SVE_VL)))
Definition: SVE/PacketMath.h:34
const int Dynamic
Definition: Constants.h:25
t
Definition: plotPSD.py:36
double timer
Definition: oomph_metis_from_parmetis_3.1.1/struct.h:210