aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/bench_gemm.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-06-21 23:28:50 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-06-21 23:28:50 +0200
commit0212eec23f4cb64e8426bf32568156df302f8fcf (patch)
tree02f8d62946e254b2a85fd2253de9c81343823666 /bench/bench_gemm.cpp
parent4bac6fbe1ea9414f009d8dcb3d98cab7fdf109d1 (diff)
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.
Diffstat (limited to 'bench/bench_gemm.cpp')
-rw-r--r--bench/bench_gemm.cpp10
1 files changed, 6 insertions, 4 deletions
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<Scalar>(ck, cm, cn);
+ std::ptrdiff_t cm(m), cn(n), ck(p);
+ computeProductBlockingSizes<Scalar,Scalar>(ck, cm, cn);
std::cout << "blocking size = " << cm << " x " << ck << "\n";
M r = c;