Functions and macros for error handling.
More...
#include <stdio.h>
Go to the source code of this file.
|
| #define | CHECK_MPI(call) |
| | Check MPI call and log error message on failure.
|
| |
|
| void | error (int test, int no, const char *name, const char *text,...) |
| | Print message to error file defined on startup.
|
| |
|
void | print_trace (void) |
| |
|
void | register_sighandlers (void) |
| |
Functions and macros for error handling.
Headerfile for:
◆ CHECK_MPI
| #define CHECK_MPI |
( |
| call | ) |
|
Value: do { \
const int mpireturn = call; \
if (mpireturn != MPI_SUCCESS) { \
char message[MPI_MAX_ERROR_STRING]; \
int message_length; \
MPI_Error_string(mpireturn, message, &message_length); \
char errmsg[500]; \
sprintf(errmsg, "Error in: %s:%d, function: %s\n \ Communications call exited with code %d: %s\n", \
__FILE__, __LINE__, __func__, mpireturn, message); \
error(1, 1, __func__, errmsg); \
} \
} while (0)
Check MPI call and log error message on failure.
- Parameters
-
| call | Function call that should be checked. |
◆ error()
| void error |
( |
int | test, |
|
|
int | no, |
|
|
const char * | name, |
|
|
const char * | text, |
|
|
| ... ) |
Print message to error file defined on startup.
- Parameters
-
| test | Condition on whether an error should be raised. 0 for no error and continue 1 for error, stop and print error message |
| no | Exit Code Value smaller than zero exits immediately with code 0. Value larger or equal then zero exits with code given after finalizing. |
| name | Function name, where the error was raised |
| text | Error message text |