From 0212eec23f4cb64e8426bf32568156df302f8fcf Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 21 Jun 2010 23:28:50 +0200 Subject: simplify and optimize block sizes computation for matrix products. They are now automatically computed from the L1 and L2 cache sizes which are themselves automatically determined at runtime. --- bench/bench_gemm.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bench/bench_gemm.cpp') diff --git a/bench/bench_gemm.cpp b/bench/bench_gemm.cpp index ee34e6ddc..ca1e05c8d 100644 --- a/bench/bench_gemm.cpp +++ b/bench/bench_gemm.cpp @@ -66,10 +66,12 @@ void gemm(const M& a, const M& b, M& c) int main(int argc, char ** argv) { std::cout << "L1 cache size = " << ei_queryL1CacheSize()/1024 << " KB\n"; - std::cout << "L2/L3 cache size = " << ei_queryTopLevelCacheSize()/1024 << " KB\n"; + std::cout << "L2/L3 cache size = " << ei_queryTopLevelCacheSize()/1024 << " KB\n"; + + setCpuCacheSizes(ei_queryL1CacheSize()/1,ei_queryTopLevelCacheSize()/2); int rep = 1; // number of repetitions per try - int tries = 5; // number of tries, we keep the best + int tries = 2; // number of tries, we keep the best int s = 2048; int cache_size = -1; @@ -102,8 +104,8 @@ int main(int argc, char ** argv) M c(m,p); c.setOnes(); std::cout << "Matrix sizes = " << m << "x" << p << " * " << p << "x" << n << "\n"; - std::ptrdiff_t cm, cn, ck; - getBlockingSizes(ck, cm, cn); + std::ptrdiff_t cm(m), cn(n), ck(p); + computeProductBlockingSizes(ck, cm, cn); std::cout << "blocking size = " << cm << " x " << ck << "\n"; M r = c; -- cgit v1.2.3