[eigen] Bug in matrix product with OpenMP?

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


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 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/