Bugzilla – Bug 714
Dynamic size double matrix to matrix product problem when multithreading is on
Last modified: 2015-02-18 15:27:51 UTC
I was working with dynamic size double matrices and I was compiling with openMP. I set the matrices by mapping their data array as follows:
Map<Matrix<double, Dynamic, Dynamic, RowMajor> > feature_matrix(ht, cnt_features, cnt_feature_dim);
Map<Matrix<double, Dynamic, Dynamic, ColMajor> > filter_matrix(filters + offset, cnt_feature_dim, cnt_filters);
Then I computed the product of the two matrices as follows:
MatrixXd* response = new MatrixXd(cnt_features, cnt_filters);
response->noalias() = feature_matrix * filter_matrix;
It sometimes happened so that the value of the entry (i, j) in the "response" matrix did not match with the dot product of the i-th row of feature_matrix and j-th column of filter_matrix. Weird!
Then I realized that the problem stems from a call to "omp_set_dynamic(1)" that I had in my code. If I remove that line the code seems to run just fine.
Created attachment 477 [details]
Test case for bug 714
I'm able to reproduce this issue with gcc-4.7.1 (32bit), but not with 4.7.3, 4.6.3 or 4.8.2 (the latter are all 64bit).
This could be a bug in that gcc version. As you experienced it on 64bit, bitness does not seem to matter.
I pushed the test case into the repository. This might help us to isolate failing compiler versions.