Geometry: Exceptions#5219
Merged
WeiqunZhang merged 1 commit intoAMReX-Codes:developmentfrom Mar 23, 2026
Merged
Conversation
We use AMReX interactively with `amrex.throw_exception = true` to be able to handle user errors or convergence issues and act on them. In Geometry, some methods are defined `noexcept` which breaks exception propagation in ImpactX BLAST-ImpactX/impactx#1348 and still aborts the process as a consequence. This removes the `noexcept` where they are not guaranteed to be true at runtime. First seen in `computeRoundoffDomain` which is called from a couple of places. Performance impact for this host-side code should be minimal / not a problem.
5 tasks
Member
|
I also find the assert in computeRoundoffDomain particularly annoying, as it has a very nondescript message, and I think it even sometimes triggers for perfectly valid geometries if one of the sides is at exactly zero. Annoyingly, the roundoff domain is not even used in our code. |
Member
Author
|
I agree, documented and moved to #5221 to improve. |
Member
Author
|
After this PR is merged, I will send another large LLM-assisted PR #5222 after that one is merged that will try to fix the pattern in the whole codebase of AMReX. Relevant Checks we could add in Clang-Tidy
How to Fix the WarningIf clang-tidy flags a function marked
|
WeiqunZhang
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We use AMReX interactively with
amrex.throw_exception = trueto be able to handle user errors or convergence issues and act on them.In Geometry, some methods are defined
noexceptwhich breaks exception propagation in ImpactXBLAST-ImpactX/impactx#1348 and still aborts the process as a consequence.
This removes the
noexceptwhere they are not guaranteed to be true at runtime. First seen incomputeRoundoffDomainwhich is called from a couple of places.Performance impact for this host-side code should be minimal / not a problem.
Additional background
Throwing an actual abort in a Python script will abort the whole interpreter, resetting all its state, terminating the process. That is a big problem in interactive usage, e.g., Jupyter Notebooks, but also for general C++ - Python and back error handling logic.
BLAST-ImpactX/impactx#1350
Checklist
The proposed changes: