5 #include "eigen_src/Eigen/Core" 6 #include "../BenchTimer.h" 10 #error SCALAR must be defined 17 template<
typename Func>
19 double bench(
long m,
long n,
long k,
const Func&
f)
30 double up = 1e8*4/
sizeof(
Scalar);
31 double tm0 = 4, tm1 = 10;
39 double flops = 2. * m * n * k;
43 BENCH(t, tries, rep,
f(A,B,C));
45 return 1
e-9 * rep * flops / t.
best();
48 template<
typename Func>
53 std::string
filename = std::string(
"gemm_settings.txt");
55 filename = std::string(argv[1]);
56 std::ifstream settings(filename);
58 while(settings >> m >> n >> k)
61 results.push_back(
bench(m, n, k, f) );
64 std::cout << RowVectorXd::Map(results.data(), results.size());
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
EIGEN_DONT_INLINE double bench(long m, long n, long k, const Func &f)
#define EIGEN_DONT_INLINE
int main_gemm(int argc, char **argv, const Func &f)
double best(int TIMER=CPU_TIMER) const
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
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
Matrix< Scalar, Dynamic, Dynamic > Mat
#define BENCH(TIMER, TRIES, REP, CODE)
Derived & setRandom(Index size)