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

Do not enable OpenMP by default for gcc 9.x with CMake #1483

merged 1 commit into from May 31, 2019


Copy link

commented May 31, 2019


Temporary workaround for the incompatibility of OpenMP support in gcc 9.x and the OpenMP directives in LAMMPS. To avoid unexpected failure to compile with CMake, we don't automatically enable the 'BUILD_OMP' flag in that case. This way people that just run cmake to compile LAMMPS will by default get a working executable and no rather cryptic error messages. Manually enabling OpenMP will still cause compilation failures unless the script in src/USER-OMP/ is used to convert all affected sources to not use the default(none) directive, but default(shared) instead.

This is primarily intended for the upcoming stable release to avoid frequent reports of "LAMMPS broken with gcc 9" by people that are not aware, that OpenMP would be enabled by default, even if they are not using it. It needs a more permanent solution that re-enables OpenMP support for the affected compilers, but it is not clear at the moment, what a good approach would be.

Related Issues

closes #1482


Axel Kohlmeyer (Temple U)


By submitting this pull request, I agree, that my contribution will be included in LAMMPS and redistributed under either the GNU General Public License version 2 (GPL v2) or the GNU Lesser General Public License version 2.1 (LGPL v2.1).

Backward Compatibility


Implementation Notes

Please see the discussion of issues #1482 and #1326 for more details.

Post Submission Checklist

  • The feature or features in this pull request is complete
  • Licensing information is complete
  • Corresponding author information is complete
  • The source code follows the LAMMPS formatting guidelines
  • The feature has been verified to work with the CMake based build system
change the default for gcc 9.x and beyond to not enable OpenMP by def…
…ault even if it is found to be supported

this is so that using CMake by default will compile LAMMPS, since gcc 9.x
expects different sharing semantics for constants than previous versions.

@akohlmey akohlmey added this to the Stable Release Spring 2019 milestone May 31, 2019

@akohlmey akohlmey self-assigned this May 31, 2019

Copy link

left a comment

ok by me

@akohlmey akohlmey merged commit 3e05b98 into lammps:master May 31, 2019

6 checks passed

lammps/pull-requests/build-docs-pr head run ended
lammps/pull-requests/cmake/cmake-serial-pr head run ended
lammps/pull-requests/kokkos-omp-pr head run ended
lammps/pull-requests/openmpi-pr head run ended
lammps/pull-requests/serial-pr head run ended
lammps/pull-requests/shlib-pr head run ended

@akohlmey akohlmey deleted the akohlmey:cmake-workaround-for-gcc-9 branch May 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.