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

Temporary workaround for gcc 14 libstdc++ incompatibility with HIP #857

Merged
merged 13 commits into from
Jan 21, 2025

Conversation

BenWibking
Copy link
Collaborator

@BenWibking BenWibking commented Jan 21, 2025

Description

Temporarily workaround incompatibilities between the C++ standard library headers shipped with GCC 14 and HIP by switching to using the C++ standard library headers shipped with Clang (an independent implementation).

This may not be viable in production, since (in principle) any third-party libraries that use C++ should be complied against the same C++ standard library in order to ensure compatibility, but it will at least allow the CI to pass again and unblock several PRs. Currently, the only C++ library dependency that is not built simultaneously alongside Quokka is ADIOS2, which is optional.

Related issues

Fixes #856.

Checklist

Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an x inside the square brackets [ ] in the Markdown source below:

  • I have added a description (see above).
  • I have added a link to any related issues (if applicable; see above).
  • I have read the Contributing Guide.
  • I have added tests for any new physics that this PR adds to the code.
  • (For quokka-astro org members) I have manually triggered the GPU tests with the magic comment /azp run.

@BenWibking
Copy link
Collaborator Author

BenWibking commented Jan 21, 2025

Weiqun suggests adding -D_GLIBCXX_NO_ASSERTIONS to the compile flags:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html

Strangely, adding -DCMAKE_CXX_FLAGS=-D_GLIBCXX_NO_ASSERTIONS does not appear to work.

@BenWibking
Copy link
Collaborator Author

BenWibking commented Jan 21, 2025

See also: ROCm/composable_kernel#1405 (comment)

Edit: this doesn't really work for us, since we have templated everything, almost every file includes everything else.

@BenWibking
Copy link
Collaborator Author

BenWibking commented Jan 21, 2025

Adding -DCMAKE_CXX_FLAGS=-stdlib=libc++ to the CMake build flags is another verified workaround.

@BenWibking BenWibking changed the title Update HIP flags to workaround gcc 14 libstdc++ incompatibility Workaround gcc 14 libstdc++ incompatibility with HIP Jan 21, 2025
.github/workflows/hip.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/problems/PrimordialChem/test_primordial_chem.cpp Outdated Show resolved Hide resolved
src/problems/PrimordialChem/test_primordial_chem.cpp Outdated Show resolved Hide resolved
src/problems/PrimordialChem/test_primordial_chem.cpp Outdated Show resolved Hide resolved
src/problems/PrimordialChem/test_primordial_chem.cpp Outdated Show resolved Hide resolved
@BenWibking BenWibking changed the title Workaround gcc 14 libstdc++ incompatibility with HIP Temporary workaround for gcc 14 libstdc++ incompatibility with HIP Jan 21, 2025
@BenWibking BenWibking marked this pull request as ready for review January 21, 2025 18:35
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. CI labels Jan 21, 2025
@BenWibking BenWibking enabled auto-merge January 21, 2025 18:37
@BenWibking BenWibking added this pull request to the merge queue Jan 21, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 21, 2025
Merged via the queue into development with commit b533540 Jan 21, 2025
21 checks passed
@BenWibking BenWibking deleted the BenWibking/workaround-hip-libstdc++ branch January 21, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gcc 14 C++ headers have unresolved incompatibilities with HIP
2 participants