Skip to content

Commit c56ff64

Browse files
authored
Merge pull request #3354 from derbeyn/fix_yalla_v2.0.x
Fix yalla PML: MPI_Recv does not return MPI_ERR_TRUNCATE upon overflow
2 parents dcd7cf8 + 6092256 commit c56ff64

File tree

2 files changed

+36
-27
lines changed

2 files changed

+36
-27
lines changed

ompi/mca/pml/yalla/pml_yalla.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int s
368368
{
369369
mxm_recv_req_t rreq;
370370
mxm_error_t error;
371+
int rc;
371372

372373
PML_YALLA_INIT_MXM_RECV_REQ(&rreq, buf, count, datatype, src, tag, comm, recv);
373374
PML_YALLA_INIT_BLOCKING_MXM_RECV_REQ(&rreq);
@@ -386,10 +387,10 @@ int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int s
386387
rreq.completion.sender_imm, rreq.completion.sender_tag,
387388
rreq.tag, rreq.tag_mask,
388389
rreq.completion.actual_len);
389-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
390+
rc = PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
390391
PML_YALLA_FREE_BLOCKING_MXM_REQ(&rreq.base);
391392

392-
return OMPI_SUCCESS;
393+
return rc;
393394
}
394395

395396
int mca_pml_yalla_isend_init(const void *buf, size_t count, ompi_datatype_t *datatype,
@@ -677,8 +678,7 @@ int mca_pml_yalla_mrecv(void *buf, size_t count, ompi_datatype_t *datatype,
677678
rreq.completion.sender_imm, rreq.completion.sender_tag,
678679
rreq.tag, rreq.tag_mask,
679680
rreq.completion.actual_len);
680-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
681-
return OMPI_SUCCESS;
681+
return PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
682682
}
683683

684684
int mca_pml_yalla_start(size_t count, ompi_request_t** requests)

ompi/mca/pml/yalla/pml_yalla_request.h

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -176,30 +176,39 @@ void mca_pml_yalla_init_reqs(void);
176176
} \
177177
}
178178

179-
#define PML_YALLA_SET_RECV_STATUS(_rreq, _length, _mpi_status) \
180-
{ \
181-
if ((_mpi_status) != MPI_STATUS_IGNORE) { \
182-
switch ((_rreq)->base.error) { \
183-
case MXM_OK: \
184-
(_mpi_status)->MPI_ERROR = OMPI_SUCCESS; \
185-
break; \
186-
case MXM_ERR_CANCELED: \
187-
(_mpi_status)->MPI_ERROR = OMPI_SUCCESS; \
188-
(_mpi_status)->_cancelled = true; \
189-
break; \
190-
case MXM_ERR_MESSAGE_TRUNCATED: \
191-
(_mpi_status)->MPI_ERROR = MPI_ERR_TRUNCATE; \
192-
break; \
193-
default: \
194-
(_mpi_status)->MPI_ERROR = MPI_ERR_INTERN; \
195-
break; \
196-
} \
197-
\
198-
(_mpi_status)->MPI_TAG = (_rreq)->completion.sender_tag; \
199-
(_mpi_status)->MPI_SOURCE = (_rreq)->completion.sender_imm; \
200-
(_mpi_status)->_ucount = (_length); \
201-
} \
179+
static inline int PML_YALLA_SET_RECV_STATUS(mxm_recv_req_t *_rreq,
180+
size_t _length,
181+
ompi_status_public_t *_mpi_status)
182+
{
183+
int rc;
184+
185+
switch (_rreq->base.error) {
186+
case MXM_OK:
187+
rc = OMPI_SUCCESS;
188+
break;
189+
case MXM_ERR_CANCELED:
190+
rc = OMPI_SUCCESS;
191+
break;
192+
case MXM_ERR_MESSAGE_TRUNCATED:
193+
rc = MPI_ERR_TRUNCATE;
194+
break;
195+
default:
196+
rc = MPI_ERR_INTERN;
197+
break;
198+
}
199+
200+
/* If status is not ignored, fill what is needed */
201+
if (_mpi_status != MPI_STATUS_IGNORE) {
202+
_mpi_status->MPI_ERROR = rc;
203+
if (MXM_ERR_CANCELED == _rreq->base.error) {
204+
_mpi_status->_cancelled = true;
205+
}
206+
_mpi_status->MPI_TAG = _rreq->completion.sender_tag;
207+
_mpi_status->MPI_SOURCE = _rreq->completion.sender_imm;
208+
_mpi_status->_ucount = _length;
202209
}
210+
return rc;
211+
}
203212

204213
#define PML_YALLA_SET_MESSAGE(_rreq, _comm, _mxm_msg, _message) \
205214
{ \

0 commit comments

Comments
 (0)