Skip to content

Commit 9ebcafd

Browse files
authored
Merge pull request #3260 from derbeyn/fix_yalla
Fix yalla PML: MPI_Recv does not return MPI_ERR_TRUNCATE upon overflow
2 parents 518cdd1 + f918d88 commit 9ebcafd

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
@@ -369,6 +369,7 @@ int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int s
369369
{
370370
mxm_recv_req_t rreq;
371371
mxm_error_t error;
372+
int rc;
372373

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

393-
return OMPI_SUCCESS;
394+
return rc;
394395
}
395396

396397
int mca_pml_yalla_isend_init(const void *buf, size_t count, ompi_datatype_t *datatype,
@@ -678,8 +679,7 @@ int mca_pml_yalla_mrecv(void *buf, size_t count, ompi_datatype_t *datatype,
678679
rreq.completion.sender_imm, rreq.completion.sender_tag,
679680
rreq.tag, rreq.tag_mask,
680681
rreq.completion.actual_len);
681-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
682-
return OMPI_SUCCESS;
682+
return PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
683683
}
684684

685685
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
@@ -175,31 +175,40 @@ static inline mca_pml_yalla_send_request_t* MCA_PML_YALLA_SREQ_INIT(void *_buf,
175175
} \
176176
}
177177

178-
#define PML_YALLA_SET_RECV_STATUS(_rreq, _length, _mpi_status) \
179-
{ \
180-
if ((_mpi_status) != MPI_STATUS_IGNORE) { \
181-
switch ((_rreq)->base.error) { \
182-
case MXM_OK: \
183-
(_mpi_status)->MPI_ERROR = OMPI_SUCCESS; \
184-
break; \
185-
case MXM_ERR_CANCELED: \
186-
(_mpi_status)->MPI_ERROR = OMPI_SUCCESS; \
187-
(_mpi_status)->_cancelled = true; \
188-
break; \
189-
case MXM_ERR_MESSAGE_TRUNCATED: \
190-
(_mpi_status)->MPI_ERROR = MPI_ERR_TRUNCATE; \
191-
break; \
192-
default: \
193-
(_mpi_status)->MPI_ERROR = MPI_ERR_INTERN; \
194-
break; \
195-
} \
196-
\
197-
(_mpi_status)->MPI_TAG = (_rreq)->completion.sender_tag; \
198-
(_mpi_status)->MPI_SOURCE = (_rreq)->completion.sender_imm; \
199-
(_mpi_status)->_ucount = (_length); \
200-
} \
178+
static inline int PML_YALLA_SET_RECV_STATUS(mxm_recv_req_t *_rreq,
179+
size_t _length,
180+
ompi_status_public_t *_mpi_status)
181+
{
182+
int rc;
183+
184+
switch (_rreq->base.error) {
185+
case MXM_OK:
186+
rc = OMPI_SUCCESS;
187+
break;
188+
case MXM_ERR_CANCELED:
189+
rc = OMPI_SUCCESS;
190+
break;
191+
case MXM_ERR_MESSAGE_TRUNCATED:
192+
rc = MPI_ERR_TRUNCATE;
193+
break;
194+
default:
195+
rc = MPI_ERR_INTERN;
196+
break;
201197
}
202198

199+
/* If status is not ignored, fill what is needed */
200+
if (_mpi_status != MPI_STATUS_IGNORE) {
201+
_mpi_status->MPI_ERROR = rc;
202+
if (MXM_ERR_CANCELED == _rreq->base.error) {
203+
_mpi_status->_cancelled = true;
204+
}
205+
_mpi_status->MPI_TAG = _rreq->completion.sender_tag;
206+
_mpi_status->MPI_SOURCE = _rreq->completion.sender_imm;
207+
_mpi_status->_ucount = _length;
208+
}
209+
return rc;
210+
}
211+
203212
#define PML_YALLA_SET_MESSAGE(_rreq, _comm, _mxm_msg, _message) \
204213
{ \
205214
*(_message) = ompi_message_alloc(); \

0 commit comments

Comments
 (0)