Open
Conversation
This was referenced Mar 12, 2026
Merged
Fix BLAST-ImpactX#1348: Set AMReX `system::throw_exception` so that in interactive usage we can potentially catch an exception and handle it, instead of terminating the process (Python interpreter).
5 tasks
WeiqunZhang
pushed a commit
to AMReX-Codes/amrex
that referenced
this pull request
Mar 23, 2026
## Summary 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. ## 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: - [x] fix a bug or incorrect behavior in AMReX - [ ] add new capabilities to AMReX - [ ] changes answers in the test suite to more than roundoff level - [ ] are likely to significantly affect the results of downstream AMReX users - [ ] include documentation in the code and/or rst files, if appropriate
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.
Fix #1348: Set AMReX
system::throw_exceptionso that in interactive usage we can potentially catch an exception and handle it, instead of terminating the process (Python interpreter).To Do
.infiles)