fix in case we don't know how to query the L1/L2 cache sizes

This commit is contained in:
Gael Guennebaud
2010-06-21 23:44:20 +02:00
parent 0212eec23f
commit 98686ab86c
3 changed files with 14 additions and 4 deletions

View File

@@ -65,8 +65,10 @@ 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::ptrdiff_t l1 = ei_queryL1CacheSize();
std::ptrdiff_t l2 = ei_queryTopLevelCacheSize();
std::cout << "L1 cache size = " << (l1>0 ? l1/1024 : -1) << " KB\n";
std::cout << "L2/L3 cache size = " << (l2>0 ? l2/1024 : -1) << " KB\n";
setCpuCacheSizes(ei_queryL1CacheSize()/1,ei_queryTopLevelCacheSize()/2);