Skip to content

Commit 4946911

Browse files
author
Alessandro Fanfarillo
committed
Fixes bug #160 about STOP
1 parent bb00154 commit 4946911

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/mpi/mpi_caf.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static void error_stop (int error) __attribute__ ((noreturn));
5656
static int caf_this_image;
5757
static int caf_num_images;
5858
static int caf_is_finalized;
59+
MPI_Request ibarrier_req;
5960

6061
#if MPI_VERSION >= 3
6162
MPI_Info mpi_info_same_size;
@@ -408,6 +409,7 @@ PREFIX (finalize) (void)
408409
{
409410
*img_status = STAT_STOPPED_IMAGE; /* GFC_STAT_STOPPED_IMAGE = 6000 */
410411
MPI_Win_sync(*stat_tok);
412+
411413
MPI_Barrier(CAF_COMM_WORLD);
412414

413415
while (caf_static_list != NULL)
@@ -445,6 +447,7 @@ PREFIX (finalize) (void)
445447
pthread_mutex_lock(&lock_am);
446448
caf_is_finalized = 1;
447449
pthread_mutex_unlock(&lock_am);
450+
exit(0);
448451
}
449452

450453

@@ -2482,6 +2485,25 @@ error_stop (int error)
24822485
exit (error);
24832486
}
24842487

2488+
/* STOP function for integer arguments. */
2489+
void
2490+
PREFIX (stop_numeric) (int32_t stop_code)
2491+
{
2492+
fprintf (stderr, "STOP %d\n", stop_code);
2493+
PREFIX (finalize) ();
2494+
}
2495+
2496+
/* STOP function for string arguments. */
2497+
void
2498+
PREFIX (stop_str) (const char *string, int32_t len)
2499+
{
2500+
fputs ("STOP ", stderr);
2501+
while (len--)
2502+
fputc (*(string++), stderr);
2503+
fputs ("\n", stderr);
2504+
2505+
PREFIX (finalize) ();
2506+
}
24852507

24862508
/* ERROR STOP function for string arguments. */
24872509

0 commit comments

Comments
 (0)