-
Notifications
You must be signed in to change notification settings - Fork 525
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
Error behavior when used as a library #1778
Comments
This is something I'd like to help take on because error handling on GPU code is currently impossible. My current thinking is that we should add some new global variable like If we took this approach on GPU, it would be nice, because this error flag could be set by some thread on the device, then the appropriate handling be done on the CPU after the kernel is done. |
I think that approach sounds pretty nice. One of the nice things about storing the state in a global as opposed to returning the value is that you don't need to pass the return value through nested function calls. Exceptions also solve that problem, but of course they are no-go for GPUs. Note that we already have a global For simplicity, we might want to just have the error state be an |
One of OpenMC's "bad" behaviors right now is that when it encounters an error, it most circumstances it will call
std::exit
(orMPI_Abort
when using MPI). This is not a desirable behavior if OpenMC is used as a library (e.g., as part of a multiphysics application). It also sucks when you're using theopenmc.lib
Python bindings to the C/C++ API and an error takes down the whole executable rather than bubbling up as an exception. We should be following community guidelines with respect to error handling. For example, one of the recommendations in the xSDK community package policies (R3) is:What we have is currently a bit of a mess:
std::exit
orMPI_Abort
openmc.lib
Python bindings)The text was updated successfully, but these errors were encountered: