-
Notifications
You must be signed in to change notification settings - Fork 120
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
Recovery kernel loop #122
Recovery kernel loop #122
Conversation
All kernel loops are adaptive theses days.
The whole thing is now moved into it's own sub-module `kernels.error`.
Also slightly re-writes the special-casing in the Python kernel loop and enables the timed failure test for JIT.
This now handles explicit out-of-bounds errors thrown by the field sampling routines and sets the according error code. In the recovery part we then propagate the caught exceptions to the user via the default recovery kernels.
For this we separate the low-level execution routines for JIT and Python, check if we have failing kernels after the first execution and repeatedly apply recovery kernels before attempting the main timestepping loop again in a while loop. Note, that this can cause infinite looping!
We also now explicitly test the size of the final ParticleSet and that the right error has been thrown during the execution loop.
This is necessary to propagate the error to the Python recovery loop.
Code looks great @mlange05, glad you got it all to work after what looks like Herculean coding! I'm really glad we now have this error framework sorted, and I like the syntax of A few general comments/caveats that we may (or may not) want to think about right now, or defer for later versions
|
Ok, thanks for the review. Regarding the comments:
|
This new feature enables user-level customisation of the error handling procedures in the main kernel loop through JIT and SciPy mode. The core idea is that kernels can now throw different types of errors, eg.
ErrorCode.OutOfBounds
and that the user can specify custom kernels to override the default behaviour to create model-specific recovery behaviour. The recovery kernels themselves are always run in Python and can be injected via therecovery={Error.MyErrorCode: MyRecoveryKernel}
argument.Caveats:
OutOfBounds
errors do not propagate the exact sampling location that created the error as SciPy mode does, but the location of the particle at the time. Adding that would require dynamically allocating memory for meta-information, which is left for another PR.