-
Notifications
You must be signed in to change notification settings - Fork 15
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
Use proper exit codes #341
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts...
I like the idea of the macro that prints the error coordinates. Maybe it could also have a mandatory string argument that has to contain an error message that is logged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for clarity please update the initial PR description with an example of a new error message.
I have set the output now to |
Doesn't this mean that if an error occurs on a rank other than 0 we get no error at all? |
True… Before, the message was mainly only print by rank 0 (due to What do you suggest?
|
There are different types of errors: Those that happen on every rank (e.g. errors while parsing the input file), there it would probably be fine if only one rank prints the message, and those where only one rank is affected, e.g. when a particle can not be placed properly after an MPI rebalance. In the latter case, it is crucial that each rank prints their error message. For simplicity I think I'd just always print from each rank. But if you feel that is too spammy you could add a bool argument to |
The error messages are now printed with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error messages are now printed with Log::global_log->error_always_output() so that every rank prints it. I am not a big fan of an additional argument, since it makes it more complicated. This would probably cause some trouble/confusion in the future.
Ok then let's stick with the verbose version implemented right now in this PR and if the error messages become a problem we'll revisit this.
Description
For now, the exit codes are just randomly set.
This PR makes the exit message more meaningful by adding the file, function and line where the exit code was called.
In addition, it enforces an error message to be passed.
This was achieved by adding the wrapper
MARDYN_EXIT
tosrc/utils/mardyn_assert.h
and calling the wrapper when exiting instead of the functionmardyn_exit
.An example error output now looks like this (each rank prints the error messages, see comments below):
Resolved Issues
Questions
Should we replace the current codes with something else? If so, what? e.g. that one:--> We decided to drop all exit codes and just print a meaningful error message and exit with EXIT_FAILURE. See comments below and edit history of this comment for details.