@@ -1601,30 +1601,8 @@ PREFIX (sync_images) (int count, int images[], int *stat, char *errmsg,
1601
1601
int errmsg_len )
1602
1602
{
1603
1603
int ierr = 0 , i = 0 , remote_stat = 0 ;
1604
-
1605
1604
MPI_Status s ;
1606
1605
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
-
1628
1606
if (count == 0 || (count == 1 && images [0 ] == caf_this_image ))
1629
1607
{
1630
1608
if (stat )
@@ -1668,6 +1646,27 @@ PREFIX (sync_images) (int count, int images[], int *stat, char *errmsg,
1668
1646
for (i = 0 ; i < count ; i ++ )
1669
1647
ierr = MPI_Irecv (& arrived [images [i ]- 1 ], 1 , MPI_INT , images [i ]- 1 , 0 , CAF_COMM_WORLD , & handlers [images [i ]- 1 ]);
1670
1648
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
+
1671
1670
for (i = 0 ; i < count ; i ++ )
1672
1671
ierr = MPI_Send (& caf_this_image , 1 , MPI_INT , images [i ]- 1 , 0 , CAF_COMM_WORLD );
1673
1672
0 commit comments