summaryrefslogtreecommitdiff
path: root/src/comm
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-09 12:25:48 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2003-10-09 12:25:48 +0000
commitdcbabde6d5bcb1bc5f5f1116d7117b02a111d369 (patch)
tree3a82b0eb3941d0fc9838e95888bd4cbe81987c13 /src/comm
parenta2defd76d182227208f94b4de811888a53a9e161 (diff)
/* flush stdout/stderr and then wait a few seconds before calling
MPI_Abort() This cures a problem where processor 0 is slightly behind, eg. with activating thorns, and would print an error message (to stdout!!) about a thorn missing only a few milliseconds later. If other processors call CCTK_Abort() before that those messages wouldn't be seen. */ git-svn-id: http://svn.cactuscode.org/flesh/trunk@3428 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/comm')
-rw-r--r--src/comm/CactusDefaultComm.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c
index 90d0b624..b8afeecf 100644
--- a/src/comm/CactusDefaultComm.c
+++ b/src/comm/CactusDefaultComm.c
@@ -9,9 +9,6 @@
@@*/
-#include <stdio.h>
-#include <stdlib.h>
-
#include "cctk_Flesh.h"
#include "cctk_Groups.h"
#include "cctk_Constants.h"
@@ -24,6 +21,12 @@
#include "CactusMainDefaults.h"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#ifdef CCTK_MPI
#include "mpi.h"
#endif
@@ -407,10 +410,15 @@ int CactusDefaultAbort (cGH *GH, int retval)
#ifdef CCTK_MPI
if (MPI_Active)
{
- /* flush stdout and stderr before calling MPI_Abort() because
- some MPI implementations simply kill other MPI processes */
+ /* flush stdout/stderr and then wait a few seconds before calling
+ MPI_Abort()
+ This cures a problem where processor 0 is slightly behind, eg. with
+ activating thorns, and would print an error message (to stdout!!)
+ about a thorn missing only a few milliseconds later. If other processors
+ call CCTK_Abort() before that those messages wouldn't be seen. */
fflush (stdout);
fflush (stderr);
+ sleep (5);
CACTUS_MPI_ERROR (MPI_Abort (MPI_COMM_WORLD, retval));
}
#else