Re: [eigen] Bug in matrix product with OpenMP? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Bug in matrix product with OpenMP?
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 2 Nov 2010 20:20:01 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=0/bWXqyMsnmZvCW1Gaxdodga4CE9vB6SIIlb034LsW4=; b=MNpPIPsrbK5uzHj8qU+c+CsWwwFwnBK9TkcQB8qvymmrd+AvKJ2ZMkgMabq7uk5Zgc lwpQ0N3xUMnujvujf4fB3fPGQUF9xjj6b2l1Y6yHMIceo4EhpnaRQTFt8rU4w01xSro0 4445o1W62vjgqei3tT7+j1Z7X83iT8/TbS7QU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=uZn/kBTEo+6MS2Ta9V6ihbLBFftWZ50mjaku84qT9chkFocSqFMPzah5/0ehsWX96B GXtntewXfoP2WeNIlVi+05DYb/zBzlqfmXq0QVTKeeM0Ng0nY7RQrrowFk6YNYbG9ptT iww2S3So/gYaGbDWiSlPLGcYECeRlAwHEq4Ng=
sorry but I cannot reproduce on my core2 duo, gcc 4.5.0, I've also
added the following line:
std::cerr << (c-d).cwiseAbs().maxCoeff() << "\n";
and I got 0.
Could you add the following lines at the beginning of your main() :
std::ptrdiff_t l1 = internal::queryL1CacheSize();
std::ptrdiff_t l2 = internal::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";
typedef internal::gebp_traits<float,float> Traits;
std::cout << "Register blocking = " << Traits::mr << " x " <<
Traits::nr << "\n";
and paste the result, please.
gael
2010/11/2 Björn Piltz <bjornpiltz@xxxxxxxxxxxxxx>:
> Hi all,
> I think I just ran into a bug with matrix product and OpenMP. I'm on a
> MacBook with GCC 4.5.1 and using latest eigen r3481:cb8a3bc8c32b (tip).
> The following code fails. Seems like the last half row is filled with
> garbage.
>
> #include <Eigen/Core>
>
> #include <omp.h>
>
> #include <iostream>
>
> using namespace Eigen;
>
> int main(int argc, char*argv[])
>
> {
>
> int size = 1529;//Good:1528, Bad:1529
>
> MatrixXf a = MatrixXf::Random(size, size);
>
> MatrixXf b = MatrixXf::Random(size, size);
>
> omp_set_num_threads(1);
>
> MatrixXf c = a*b;
>
> omp_set_num_threads(2);
>
> MatrixXf d = a*b;
>
> if(!c.isApprox(d))
>
> std::cerr<<size<<" Error!"<<std::endl;
>
> return 0;
>
> }
>
> g++ -I /path/to/eigen -fopenmp -O3 -DNDEBUG product_bug.cpp -o product_bug
>