Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable OpenMP in Eigen #345

Merged
merged 1 commit into from
May 4, 2021
Merged

Conversation

olemke
Copy link
Member

@olemke olemke commented May 4, 2021

Eigen's OpenMP parallization can lead to wrong results in certain cases likely
due to interference with our own parallelization as reported in #344. Seems to
also be compiler dependent since the problem was only reproducable in GCC 9.

See also:
https://eigen.tuxfamily.org/dox/TopicMultiThreading.html

Adding Eigen::initParallel() is not enough to solve the issue in #344.
Only setting the number of threads to 1 with Eigen::setNbThreads(1)
fixes it, therefore disabling OpenMP altogether in Eigen seems the safest
solution.

Turning OpenMP off in Eigen didn't show any negative performance impact for
the test provided in #344.

Eigen's OpenMP parallization can lead to wrong results in certain cases likely
due to interference with our own parallelization as reported in atmtools#344. Seems to
also be compiler dependent since the problem was only reproducable in GCC 9.

See also:
https://eigen.tuxfamily.org/dox/TopicMultiThreading.html

Adding `Eigen::initParallel()` is not enough to solve the issue in atmtools#344.
Only setting the number of threads to 1 with `Eigen::setNbThreads(1)`
fixes it, therefore disabling OpenMP altogether in Eigen seems the safest
solution.

Turning OpenMP off in Eigen didn't show any negative performance impact for
the test provided in atmtools#344.
@olemke olemke merged commit a2eb3e8 into atmtools:master May 4, 2021
@olemke olemke deleted the turn-off-eigen-openmp branch May 4, 2021 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant