cb-geo / mpm

CB-Geo High-Performance Material Point Method
https://www.cb-geo.com/research/mpm
Other
238 stars 82 forks source link

:construction: OpenMP compilation with set #668

Closed kks32 closed 4 years ago

kks32 commented 4 years ago

Describe the PR Add appropriate flags in OpenMP to enable parallelization on C++ sets

Related Issues/PRs https://cb-geo.discourse.group/t/openmp-compilation-issue/185/2

Additional context

OpenMP fails with:

error: invalid controlling predicate
     for (auto sitr = set.begin(); sitr != set.cend(); ++sitr) {
     ^~~

However, this error does not occur on newer versions of OpenMP/GCC or in Fedora. The error seems to be specific to older versions of Ubuntu.

kks32 commented 4 years ago

@jgiven100 and @ezrayst could you please compile on your Ubuntu machines and let me know if this problem is resolved?

codecov[bot] commented 4 years ago

Codecov Report

Merging #668 into develop will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #668   +/-   ##
========================================
  Coverage    96.56%   96.56%           
========================================
  Files          122      122           
  Lines        25265    25265           
========================================
  Hits         24395    24395           
  Misses         870      870           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e0de3ce...cb026bd. Read the comment docs.

jgiven100 commented 4 years ago

I am unsure about @ezrayst but my initial error: invalid controlling predicate issue occured for most (if not all) instances of the following language in mesh.tcc:

#pragma omp parallel for
  for (auto...

Although I no longer get error: invalid controlling predicate associated with the lines in this commit in mesh.tcc, it is still occirng for lines:

kks32 commented 4 years ago

@jgiven100 Thanks, looks like OpenMP 2015 standard in Ubuntu 18.04. Please try the following to update gcc and recompile:

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
jgiven100 commented 4 years ago

:+1: I can successfully build & run mpmtest Thanks, @kks32!

ezrayst commented 4 years ago

I could compile and passed all tests too! Thanks @kks32