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

Some fixes for compiling with the -D_GLIBCXX_DEBUG flag. #1176

Merged
merged 17 commits into from
Apr 4, 2024

Conversation

pratikvn
Copy link
Member

@pratikvn pratikvn commented Nov 3, 2022

This PR adds some recommended fixes needed to compile by adding the -D_GLIBCXX_DEBUG flag to all the source files. More details about the flag and its purpose can be found here

Some issues:

  1. It seems like this significantly increases the runtime of some of the tests (due to the explicit bound checks ?).
  2. When using stdlib containers in device code, workarounds are needed, for example in accessors.

Not sure if we want to have this for 1.5.0.

Fixes #1143

@pratikvn pratikvn added the 1:ST:WIP This PR is a work in progress. Not ready for review. label Nov 3, 2022
@pratikvn pratikvn self-assigned this Nov 3, 2022
@ginkgo-bot ginkgo-bot added mod:all This touches all Ginkgo modules. reg:benchmarking This is related to benchmarking. reg:build This is related to the build system. reg:ci-cd This is related to the continuous integration system. reg:testing This is related to testing. type:matrix-format This is related to the Matrix formats type:reordering This is related to the matrix(LinOp) reordering type:solver This is related to the solvers labels Nov 3, 2022
@pratikvn pratikvn changed the title Some fixes for the -D_GLIBCXX_DEBUG=1 flag. Some fixes for compiling with the -D_GLIBCXX_DEBUG=1 flag. Nov 3, 2022
@pratikvn pratikvn changed the title Some fixes for compiling with the -D_GLIBCXX_DEBUG=1 flag. Some fixes for compiling with the -D_GLIBCXX_DEBUG flag. Nov 3, 2022
@upsj upsj requested review from thoasm and a team November 3, 2022 16:15
Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

I dislike the reinterpret_cast on std:;arrays and it must be addressed before I change my review.
We also need to discuss where we set the compiler options. I am fine with your approach, but there could be a reason why we opted for our own compiler flags.

Edit: I just checked your link, and they state that std::array should work fine for GCC >= 11. Maybe we can add an alias to __gnu_debug::array for older GCC?

Prior to GCC 11 a debug version of std::array was available as __gnu_debug::array in the header <debug/array>. Because array::iterator is just a pointer, the debug array can't check iterator operations, it can only check direct accesses to the container. Starting with GCC 11 all the debug capabilities are available in std::array, without needing a separate type, so __gnu_debug::array is just an alias for std::array. That alias is deprecated and may be removed in a future release.

--- GCC debug mode

CMakeLists.txt Outdated Show resolved Hide resolved
accessor/accessor_helper.hpp Outdated Show resolved Hide resolved
@upsj upsj force-pushed the glibcxx-debug-fixes branch 2 times, most recently from 3a3c752 to e787900 Compare April 4, 2024 08:59
@upsj upsj added 1:ST:ready-for-review This PR is ready for review and removed 1:ST:WIP This PR is a work in progress. Not ready for review. labels Apr 4, 2024
@upsj upsj requested review from thoasm and upsj April 4, 2024 09:01
Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

LGTM!

@pratikvn
Copy link
Member Author

pratikvn commented Apr 4, 2024

LGTM too. Feel free to approve and merge when you are ready.

@upsj
Copy link
Member

upsj commented Apr 4, 2024

We had three small bugs that need to be fixed, and I'll try to reduce the test runtime, but otherwise it's ready, yes

@upsj upsj added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review labels Apr 4, 2024
@upsj upsj merged commit 2be2d78 into develop Apr 4, 2024
10 of 15 checks passed
@upsj upsj deleted the glibcxx-debug-fixes branch April 4, 2024 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-to-merge This PR is ready to merge. mod:all This touches all Ginkgo modules. reg:benchmarking This is related to benchmarking. reg:build This is related to the build system. reg:ci-cd This is related to the continuous integration system. reg:testing This is related to testing. type:matrix-format This is related to the Matrix formats type:reordering This is related to the matrix(LinOp) reordering type:solver This is related to the solvers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libstdc++ assertion failures in debug mode
6 participants