New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 714 - Dynamic size double matrix to matrix product problem when multithreading is on
Summary: Dynamic size double matrix to matrix product problem when multithreading is on
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - matrix products (show other bugs)
Version: unspecified
Hardware: x86 - general Linux
: High Wrong Result
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-13 20:32 UTC by Sobhan Naderi
Modified: 2015-02-18 15:27 UTC (History)
2 users (show)



Attachments
Test case for bug 714 (761 bytes, patch)
2014-07-15 18:30 UTC, Christoph Hertzberg
no flags Details | Diff

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.

Sobhan
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.

Note You need to log in before you can comment on or make changes to this bug.