Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
e66cca07
Commit
e66cca07
authored
Oct 14, 2015
by
Matthieu Schaller
Browse files
Assertion macro compatible with MPI
parent
3dfd578d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/error.h
View file @
e66cca07
...
...
@@ -61,4 +61,30 @@ extern int engine_rank;
#define message(s, ...) printf("%s: " s "\n", __FUNCTION__, ##__VA_ARGS__)
#endif
/**
* @brief Assertion macro compatible with MPI
*
*/
#ifdef WITH_MPI
extern
int
engine_rank
;
#define assert(expr) \
{ \
if (!(expr)) { \
fprintf(stderr, "[%03i] %s:%s():%i: FAILED ASSERTION: " #expr " \n", \
engine_rank, __FILE__, __FUNCTION__, __LINE__); \
MPI_Abort(MPI_COMM_WORLD, -1); \
} \
}
#else
#define assert(expr) \
{ \
if (!(expr)) { \
fprintf(stderr, "%s:%s():%i: FAILED ASSERTION: " #expr " \n", __FILE__, \
__FUNCTION__, __LINE__); \
fflush(stderr); \
abort(); \
} \
}
#endif
#endif
/* SWIFT_ERROR_H */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment