Skip to content

Commit 5448ec5

Browse files
author
Alessandro Fanfarillo
committed
Fixed bug in sync_all
1 parent 01b75ce commit 5448ec5

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/mpi/mpi_caf.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ void *
678678
MPI_Win_flush(caf_this_image-1, *p);
679679
# endif // CAF_MPI_LOCK_UNLOCK
680680
free(init_array);
681-
PREFIX(sync_all) (NULL,NULL,0);
681+
MPI_Barrier(CAF_COMM_WORLD);
682+
/* PREFIX(sync_all) (NULL,NULL,0); */
682683
}
683684

684685
caf_static_t *tmp = malloc (sizeof (caf_static_t));
@@ -754,7 +755,8 @@ PREFIX (deregister) (caf_token_t *token, int *stat, char *errmsg, int errmsg_len
754755
caf_runtime_error (msg);
755756
}
756757

757-
PREFIX (sync_all) (NULL, NULL, 0);
758+
/* PREFIX (sync_all) (NULL, NULL, 0); */
759+
MPI_Barrier(CAF_COMM_WORLD);
758760

759761
caf_static_t *tmp = caf_tot, *prev = caf_tot, *next=caf_tot;
760762
MPI_Win *p = *token;
@@ -811,6 +813,13 @@ PREFIX (sync_all) (int *stat, char *errmsg, int errmsg_len)
811813
{
812814
int ierr=0;
813815

816+
/* if(error_called == 1) */
817+
/* { */
818+
/* communicator_shrink(&CAF_COMM_WORLD); */
819+
/* error_called = 0; */
820+
/* ierr = STAT_FAILED_IMAGE; */
821+
/* } */
822+
814823
if (unlikely (caf_is_finalized))
815824
ierr = STAT_STOPPED_IMAGE;
816825
else if(ierr != STAT_FAILED_IMAGE)
@@ -819,7 +828,6 @@ PREFIX (sync_all) (int *stat, char *errmsg, int errmsg_len)
819828
explicit_flush();
820829
#endif
821830
MPI_Barrier(CAF_COMM_WORLD);
822-
ierr = 0;
823831
}
824832

825833
if(error_called == 1)
@@ -833,8 +841,8 @@ PREFIX (sync_all) (int *stat, char *errmsg, int errmsg_len)
833841
*stat = ierr;
834842
else if(ierr == STAT_FAILED_IMAGE)
835843
error_stop (ierr);
836-
837-
if (ierr != STAT_FAILED_IMAGE)
844+
845+
if (ierr != 0 && ierr != STAT_FAILED_IMAGE)
838846
{
839847
char *msg;
840848
if (caf_is_finalized)

0 commit comments

Comments
 (0)