This bugzilla service is closed. All entries have been migrated to

Bug 714

Summary: Dynamic size double matrix to matrix product problem when multithreading is on
Product: Eigen Reporter: Sobhan Naderi <sobhan.naderi.p>
Component: Core - matrix productsAssignee: Nobody <eigen.nobody>
Severity: Wrong Result CC: chtz, gael.guennebaud
Priority: High    
Version: unspecified   
Hardware: x86 - general   
OS: Linux   
Description Flags
Test case for bug 714 none

Description Sobhan Naderi 2013-12-13 20:32:47 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.

Comment 1 Christoph Hertzberg 2014-07-15 18:30:46 UTC
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.
Comment 2 Christoph Hertzberg 2014-07-16 15:43:59 UTC
I pushed the test case into the repository. This might help us to isolate failing compiler versions.
Comment 4 Nobody 2019-12-04 12:51:56 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: