Skip to content

Commit 0dd833e

Browse files
author
Alessandro Fanfarillo
committed
Fixed bug in sync images
Signed-off-by: Alessandro Fanfarillo <[email protected]>
1 parent db4e0cd commit 0dd833e

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

src/mpi/mpi_caf.c

+21-22
Original file line numberDiff line numberDiff line change
@@ -1601,30 +1601,8 @@ PREFIX (sync_images) (int count, int images[], int *stat, char *errmsg,
16011601
int errmsg_len)
16021602
{
16031603
int ierr = 0, i=0, remote_stat = 0;
1604-
16051604
MPI_Status s;
16061605

1607-
for(i=0;i<caf_num_images-1;i++)
1608-
{
1609-
# ifdef CAF_MPI_LOCK_UNLOCK
1610-
MPI_Win_lock (MPI_LOCK_SHARED, i, 0, *stat_tok);
1611-
# endif // CAF_MPI_LOCK_UNLOCK
1612-
ierr = MPI_Get (&remote_stat, 1, MPI_INT,
1613-
i, 0, 1, MPI_INT, *stat_tok);
1614-
# ifdef CAF_MPI_LOCK_UNLOCK
1615-
MPI_Win_unlock (i, *stat_tok);
1616-
# else // CAF_MPI_LOCK_UNLOCK
1617-
MPI_Win_flush (i, *stat_tok);
1618-
# endif // CAF_MPI_LOCK_UNLOCK
1619-
if(remote_stat != 0)
1620-
{
1621-
ierr = STAT_STOPPED_IMAGE;
1622-
if(stat != NULL)
1623-
*stat = ierr;
1624-
goto sync_images_err_chk;
1625-
}
1626-
}
1627-
16281606
if (count == 0 || (count == 1 && images[0] == caf_this_image))
16291607
{
16301608
if (stat)
@@ -1668,6 +1646,27 @@ PREFIX (sync_images) (int count, int images[], int *stat, char *errmsg,
16681646
for(i = 0; i < count; i++)
16691647
ierr = MPI_Irecv(&arrived[images[i]-1], 1, MPI_INT, images[i]-1, 0, CAF_COMM_WORLD, &handlers[images[i]-1]);
16701648

1649+
for(i=0;i<count;i++)
1650+
{
1651+
# ifdef CAF_MPI_LOCK_UNLOCK
1652+
MPI_Win_lock (MPI_LOCK_SHARED, images[i]-1, 0, *stat_tok);
1653+
# endif // CAF_MPI_LOCK_UNLOCK
1654+
ierr = MPI_Get (&remote_stat, 1, MPI_INT,
1655+
images[i]-1, 0, 1, MPI_INT, *stat_tok);
1656+
# ifdef CAF_MPI_LOCK_UNLOCK
1657+
MPI_Win_unlock (images[i]-1, *stat_tok);
1658+
# else // CAF_MPI_LOCK_UNLOCK
1659+
MPI_Win_flush (images[i]-1, *stat_tok);
1660+
# endif // CAF_MPI_LOCK_UNLOCK
1661+
if(remote_stat != 0)
1662+
{
1663+
ierr = STAT_STOPPED_IMAGE;
1664+
if(stat != NULL)
1665+
*stat = ierr;
1666+
goto sync_images_err_chk;
1667+
}
1668+
}
1669+
16711670
for(i=0; i < count; i++)
16721671
ierr = MPI_Send(&caf_this_image, 1, MPI_INT, images[i]-1, 0, CAF_COMM_WORLD);
16731672

0 commit comments

Comments
 (0)