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

Loop upper bound implicitly shared by GCC causes error in ComputerResidual.cpp:60 #82

Open
luszczek opened this issue Oct 1, 2023 · 0 comments

Comments

@luszczek
Copy link
Collaborator

luszczek commented Oct 1, 2023

Commit 114602d (responding to issue #81) broke compilation with many versions of GCC. Here's the list of GCC versions that don't work any more:

gcc (Spack GCC) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
_OPENMP=201107

gcc (Spack GCC) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
_OPENMP=201307

gcc (Spack GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
_OPENMP=201307

gcc (Spack GCC) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
_OPENMP=201511

gcc (GCC) 7.1.0
Copyright (C) 2017 Free Software Foundation, Inc.
_OPENMP=201511

gcc (Spack GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
_OPENMP=201511

 gcc (Spack GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
_OPENMP=201511

gcc (Spack GCC) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
_OPENMP=201511

the error with these versions is:

ComputeResidual.cpp: In function 'int ComputeResidual(local_int_t, const Vector&, const Vector&, double&)':
ComputeResidual.cpp:56:59: error: 'n' is predetermined 'shared' for 'shared'
   #pragma omp parallel shared(local_residual, v1v, v2v, n)
                                                           ^

That's because the loop upper bound is implicitly shared so it doesn't need explicit designation as shared.

The newer GCC versions do not complain about explicit designation as shared for loop upper bound. These are the versions that I tested:

gcc (Spack GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
_OPENMP=201511

gcc (Spack GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
_OPENMP=201511

gcc (Spack GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
_OPENMP=201511

gcc (Spack GCC) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
_OPENMP=201511

I tested Clang versions 11.1.0, 14.0.6, and 16.0.6, that report _OPENMP=201811 and they don't need a fix reported in issue #81. This leads me to believe that the reported compiler version was not accurate. The commercial compilers from Intel and NVIDIA also don't report the problem.

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

No branches or pull requests

1 participant