5 #include "../../BenchTimer.h" 9 #error SCALAR must be defined 14 template<
typename MatA,
typename MatB,
typename MatC>
20 C.noalias() += A.lazyProduct(B);
24 template<
int m,
int n,
int k,
int TA>
41 double up = 1e7*4/
sizeof(
Scalar);
42 double tm0 = 10, tm1 = 20;
44 double flops = 2. *
m *
n * k;
50 return 1
e-9 * rep * flops / t.
best();
53 template<
int m,
int n,
int k>
57 return bench<m,n,k,RowMajor>();
59 return bench<m,n,k,0>();
65 int id = m*10000 + n*100 + k;
67 case 10101 :
return bench_t< 1, 1, 1>(
t);
break;
68 case 20202 :
return bench_t< 2, 2, 2>(
t);
break;
69 case 30303 :
return bench_t< 3, 3, 3>(
t);
break;
70 case 40404 :
return bench_t< 4, 4, 4>(
t);
break;
71 case 50505 :
return bench_t< 5, 5, 5>(
t);
break;
72 case 60606 :
return bench_t< 6, 6, 6>(
t);
break;
73 case 70707 :
return bench_t< 7, 7, 7>(
t);
break;
74 case 80808 :
return bench_t< 8, 8, 8>(
t);
break;
75 case 90909 :
return bench_t< 9, 9, 9>(
t);
break;
76 case 101010 :
return bench_t<10,10,10>(
t);
break;
77 case 111111 :
return bench_t<11,11,11>(
t);
break;
78 case 121212 :
return bench_t<12,12,12>(
t);
break;
83 int main(
int argc,
char **argv)
87 std::string
filename = std::string(
"lazy_gemm_settings.txt");
89 filename = std::string(argv[1]);
90 std::ifstream settings(filename);
92 while(settings >> m >> n >> k >> t)
95 results.push_back(
bench_mnk(m, n, k, t) );
98 std::cout << RowVectorXd::Map(results.data(), results.size());
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
EIGEN_DONT_INLINE double bench()
Namespace containing all symbols from the Eigen library.
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
int main(int argc, char **argv)
EIGEN_DONT_INLINE double bench_mnk(int m, int n, int k, int t)
#define EIGEN_DONT_INLINE
EIGEN_DONT_INLINE void lazy_gemm(const MatA &A, const MatB &B, MatC &C)
double best(int TIMER=CPU_TIMER) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Matrix< Scalar, Dynamic, Dynamic > C
std::map< std::string, Array< float, 1, 8, DontAlign|RowMajor > > results
#define BENCH(TIMER, TRIES, REP, CODE)
The matrix class, also used for vectors and row-vectors.