Skip to content

Commit ae6ed63

Browse files
author
Alessandro Fanfarillo
committed
Get and put stat variable
1 parent f0a24c8 commit ae6ed63

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

src/mpi/mpi_caf.c

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ PREFIX (send) (caf_token_t token, size_t offset, int image_index,
11181118
gfc_descriptor_t *dest,
11191119
caf_vector_t *dst_vector __attribute__ ((unused)),
11201120
gfc_descriptor_t *src, int dst_kind, int src_kind,
1121-
bool mrt)
1121+
int *stat, bool mrt)
11221122
{
11231123
/* FIXME: Implement vector subscripts, type conversion and check whether
11241124
string-kind conversions are permitted.
@@ -1505,11 +1505,10 @@ PREFIX (get) (caf_token_t token, size_t offset,
15051505
gfc_descriptor_t *src,
15061506
caf_vector_t *src_vector __attribute__ ((unused)),
15071507
gfc_descriptor_t *dest, int src_kind, int dst_kind,
1508-
bool mrt)
1508+
int *stat, bool mrt)
15091509
{
15101510
size_t i, size;
1511-
int ierr = 0;
1512-
int j;
1511+
int ierr = 0, j, flag;
15131512
MPI_Win *p = token;
15141513
int rank = GFC_DESCRIPTOR_RANK (src);
15151514
size_t src_size = GFC_DESCRIPTOR_SIZE (src);
@@ -1572,9 +1571,18 @@ PREFIX (get) (caf_token_t token, size_t offset,
15721571
# else // CAF_MPI_LOCK_UNLOCK
15731572
MPI_Win_flush (image_index-1, *p);
15741573
# endif // CAF_MPI_LOCK_UNLOCK
1574+
MPI_Test(&lock_req,&flag,MPI_STATUS_IGNORE);
1575+
1576+
if(error_called == 1)
1577+
{
1578+
communicator_shrink(&CAF_COMM_WORLD);
1579+
error_called = 0;
1580+
ierr = STAT_FAILED_IMAGE;
1581+
}
1582+
1583+
if(!stat && ierr == STAT_FAILED_IMAGE)
1584+
error_stop (ierr);
15751585
}
1576-
if (ierr != 0)
1577-
error_stop (ierr);
15781586
return;
15791587
}
15801588

@@ -1663,6 +1671,22 @@ PREFIX (get) (caf_token_t token, size_t offset,
16631671

16641672
//sr_off = offset;
16651673

1674+
MPI_Test(&lock_req,&flag,MPI_STATUS_IGNORE);
1675+
1676+
if(error_called == 1)
1677+
{
1678+
communicator_shrink(&CAF_COMM_WORLD);
1679+
error_called = 0;
1680+
ierr = STAT_FAILED_IMAGE;
1681+
printf("In error_called\n");
1682+
}
1683+
1684+
if(!stat && ierr == STAT_FAILED_IMAGE)
1685+
{
1686+
printf("error\n");
1687+
error_stop (ierr);
1688+
}
1689+
16661690
# ifdef CAF_MPI_LOCK_UNLOCK
16671691
MPI_Win_lock (MPI_LOCK_SHARED, image_index-1, 0, *p);
16681692
# endif // CAF_MPI_LOCK_UNLOCK
@@ -1675,8 +1699,8 @@ PREFIX (get) (caf_token_t token, size_t offset,
16751699
MPI_Win_flush (image_index-1, *p);
16761700
# endif // CAF_MPI_LOCK_UNLOCK
16771701

1678-
if (ierr != 0)
1679-
error_stop (ierr);
1702+
/* if (ierr != 0) */
1703+
/* error_stop (ierr); */
16801704

16811705
MPI_Type_free(&dt_s);
16821706
MPI_Type_free(&dt_d);

0 commit comments

Comments
 (0)