product_threshold.cpp File Reference
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>

Classes

struct  map_size< S >
 
struct  map_size< 10 >
 
struct  map_size< 11 >
 
struct  map_size< 12 >
 
struct  map_size< 13 >
 
struct  alt_prod< M, N, K >
 
struct  loop_on_k< M, N, K >
 
struct  loop_on_k< M, N, END >
 
struct  loop_on_m< M, N, K >
 
struct  loop_on_m< END, N, K >
 
struct  loop_on_n< M, N, K, Scalar, Mode >
 
struct  loop_on_n< M, END, K, Scalar, Mode >
 
struct  print_n< N >
 
struct  print_n< END >
 

Macros

#define END   9
 

Functions

void print_mode (int mode)
 
template<int Mode, typename Lhs , typename Rhs , typename Res >
EIGEN_DONT_INLINE void prod (const Lhs &a, const Rhs &b, Res &c)
 
template<int M, int N, int K, typename Scalar , int Mode>
EIGEN_DONT_INLINE void bench_prod ()
 
int main ()
 

Macro Definition Documentation

◆ END

#define END   9

Function Documentation

◆ bench_prod()

template<int M, int N, int K, typename Scalar , int Mode>
EIGEN_DONT_INLINE void bench_prod ( )
58  {
59  typedef Matrix<Scalar, M, K> Lhs;
60  Lhs a;
61  a.setRandom();
62  typedef Matrix<Scalar, K, N> Rhs;
63  Rhs b;
64  b.setRandom();
65  typedef Matrix<Scalar, M, N> Res;
66  Res c;
67  c.setRandom();
68 
69  BenchTimer t;
70  double n = 2. * double(M) * double(N) * double(K);
71  int rep = 100000. / n;
72  rep /= 2;
73  if (rep < 1) rep = 1;
74  do {
75  rep *= 2;
76  t.reset();
77  BENCH(t, 1, rep, prod<CoeffBasedProductMode>(a, b, c));
78  } while (t.best() < 0.1);
79 
80  t.reset();
81  BENCH(t, 5, rep, prod<Mode>(a, b, c));
82 
83  print_mode(Mode);
84  std::cout << int(1e-6 * n * rep / t.best()) << "\t";
85 }
#define BENCH(TIMER, TRIES, REP, CODE)
Definition: BenchTimer.h:150
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: BenchTimer.h:55
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
@ N
Definition: constructor.cpp:22
return int(ret)+1
const Scalar * a
Definition: level2_cplx_impl.h:32
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
double K
Wave number.
Definition: sphere_scattering.cc:115
int c
Definition: calibrate.py:100
t
Definition: plotPSD.py:36
void print_mode(int mode)
Definition: product_threshold.cpp:43

References a, b, BENCH, calibrate::c, e(), int(), PlanarWave::K, Eigen::internal::Lhs, n, N, print_mode(), Eigen::internal::Rhs, and plotPSD::t.

Referenced by loop_on_n< M, N, K, Scalar, Mode >::run().

◆ main()

int main ( )
160  {
162 
163  return 0;
164 }
static void run()
Definition: product_threshold.cpp:96

References loop_on_k< M, N, K >::run().

◆ print_mode()

void print_mode ( int  mode)
43  {
44  if (mode == InnerProduct) std::cout << "i";
45  if (mode == OuterProduct) std::cout << "o";
46  if (mode == CoeffBasedProductMode) std::cout << "c";
47  if (mode == LazyCoeffBasedProductMode) std::cout << "l";
48  if (mode == GemvProduct) std::cout << "v";
49  if (mode == GemmProduct) std::cout << "m";
50 }
@ GemvProduct
Definition: Constants.h:510
@ InnerProduct
Definition: Constants.h:509
@ CoeffBasedProductMode
Definition: Constants.h:506
@ OuterProduct
Definition: Constants.h:508
@ GemmProduct
Definition: Constants.h:511
@ LazyCoeffBasedProductMode
Definition: Constants.h:507

References Eigen::CoeffBasedProductMode, Eigen::GemmProduct, Eigen::GemvProduct, Eigen::InnerProduct, Eigen::LazyCoeffBasedProductMode, and Eigen::OuterProduct.

Referenced by bench_prod().

◆ prod()

template<int Mode, typename Lhs , typename Rhs , typename Res >
EIGEN_DONT_INLINE void prod ( const Lhs &  a,
const Rhs &  b,
Res &  c 
)
53  {
54  c.noalias() += typename ProductReturnType<Lhs, Rhs, Mode>::Type(a, b);
55 }
Type
Type of JSON value.
Definition: rapidjson.h:513

References a, b, and calibrate::c.

Referenced by EIGEN_DECLARE_TEST(), main(), test_simple_reductions(), vectorwiseop_matrix(), and zeroSizedMatrix().