Skip to content

Commit f918d88

Browse files
committed
Fix yalla PML: Update previous commit after Yossofe's review
Signed-off-by: Nadia Derbey <[email protected]>
1 parent b6de94e commit f918d88

File tree

3 files changed

+39
-40
lines changed

3 files changed

+39
-40
lines changed

ompi/mca/pml/yalla/pml_yalla.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int s
388388
rreq.completion.sender_imm, rreq.completion.sender_tag,
389389
rreq.tag, rreq.tag_mask,
390390
rreq.completion.actual_len);
391-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status, rc);
391+
rc = PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
392392
PML_YALLA_FREE_BLOCKING_MXM_REQ(&rreq.base);
393393

394394
return rc;
@@ -532,15 +532,14 @@ int mca_pml_yalla_iprobe(int src, int tag, struct ompi_communicator_t* comm,
532532
{
533533
mxm_recv_req_t rreq;
534534
mxm_error_t error;
535-
int rc;
536535

537536
PML_YALLA_INIT_MXM_PROBE_REQ(&rreq, src, tag, comm);
538537

539538
error = mxm_req_probe(&rreq);
540539
switch (error) {
541540
case MXM_OK:
542541
*matched = 1;
543-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status, rc);
542+
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status);
544543
return OMPI_SUCCESS;
545544
case MXM_ERR_NO_MESSAGE:
546545
*matched = 0;
@@ -557,14 +556,13 @@ int mca_pml_yalla_probe(int src, int tag, struct ompi_communicator_t* comm,
557556
{
558557
mxm_recv_req_t rreq;
559558
mxm_error_t error;
560-
int rc;
561559

562560
PML_YALLA_INIT_MXM_PROBE_REQ(&rreq, src, tag, comm);
563561
for (;;) {
564562
error = mxm_req_probe(&rreq);
565563
switch (error) {
566564
case MXM_OK:
567-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status, rc);
565+
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status);
568566
return OMPI_SUCCESS;
569567
case MXM_ERR_NO_MESSAGE:
570568
break;
@@ -583,15 +581,14 @@ int mca_pml_yalla_improbe(int src, int tag, struct ompi_communicator_t* comm,
583581
mxm_recv_req_t rreq;
584582
mxm_message_h mxm_msg;
585583
mxm_error_t error;
586-
int rc;
587584

588585
PML_YALLA_INIT_MXM_PROBE_REQ(&rreq, src, tag, comm);
589586

590587
error = mxm_req_mprobe(&rreq, &mxm_msg);
591588
switch (error) {
592589
case MXM_OK:
593590
*matched = 1;
594-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status, rc);
591+
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status);
595592
PML_YALLA_SET_MESSAGE(&rreq, comm, mxm_msg, message);
596593
return OMPI_SUCCESS;
597594
case MXM_ERR_NO_MESSAGE:
@@ -611,14 +608,13 @@ int mca_pml_yalla_mprobe(int src, int tag, struct ompi_communicator_t* comm,
611608
mxm_recv_req_t rreq;
612609
mxm_message_h mxm_msg;
613610
mxm_error_t error;
614-
int rc;
615611

616612
PML_YALLA_INIT_MXM_PROBE_REQ(&rreq, src, tag, comm);
617613
for (;;) {
618614
error = mxm_req_mprobe(&rreq, &mxm_msg);
619615
switch (error) {
620616
case MXM_OK:
621-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status, rc);
617+
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.sender_len, status);
622618
PML_YALLA_SET_MESSAGE(&rreq, comm, mxm_msg, message);
623619
return OMPI_SUCCESS;
624620
case MXM_ERR_NO_MESSAGE:
@@ -663,7 +659,6 @@ int mca_pml_yalla_mrecv(void *buf, size_t count, ompi_datatype_t *datatype,
663659
{
664660
mxm_recv_req_t rreq;
665661
mxm_error_t error;
666-
int rc;
667662

668663
PML_YALLA_INIT_MXM_RECV_REQ(&rreq, buf, count, datatype, -1, 0, (*message)->comm, recv);
669664
PML_YALLA_INIT_BLOCKING_MXM_RECV_REQ(&rreq);
@@ -684,8 +679,7 @@ int mca_pml_yalla_mrecv(void *buf, size_t count, ompi_datatype_t *datatype,
684679
rreq.completion.sender_imm, rreq.completion.sender_tag,
685680
rreq.tag, rreq.tag_mask,
686681
rreq.completion.actual_len);
687-
PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status, rc);
688-
return rc;
682+
return PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status);
689683
}
690684

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

ompi/mca/pml/yalla/pml_yalla_request.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,9 @@ static void mca_pml_yalla_bsend_completion_cb(void *context)
195195
static void mca_pml_yalla_recv_completion_cb(void *context)
196196
{
197197
mca_pml_yalla_recv_request_t* rreq = context;
198-
int rc;
199198

200199
PML_YALLA_SET_RECV_STATUS(&rreq->mxm, rreq->mxm.completion.actual_len,
201-
&rreq->super.ompi.req_status, rc);
200+
&rreq->super.ompi.req_status);
202201

203202
PML_YALLA_VERBOSE(8, "receive request %p completed with status %s source %d rtag %d(%d/0x%x) len %zu",
204203
(void *)rreq, mxm_error_string(rreq->mxm.base.error),

ompi/mca/pml/yalla/pml_yalla_request.h

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -175,33 +175,39 @@ 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, rc) \
179-
{ \
180-
switch ((_rreq)->base.error) { \
181-
case MXM_OK: \
182-
(rc) = OMPI_SUCCESS; \
183-
break; \
184-
case MXM_ERR_CANCELED: \
185-
(rc) = OMPI_SUCCESS; \
186-
break; \
187-
case MXM_ERR_MESSAGE_TRUNCATED: \
188-
(rc) = MPI_ERR_TRUNCATE; \
189-
break; \
190-
default: \
191-
(rc) = MPI_ERR_INTERN; \
192-
break; \
193-
} \
194-
\
195-
if ((_mpi_status) != MPI_STATUS_IGNORE) { \
196-
(_mpi_status)->MPI_ERROR = (rc); \
197-
if (MXM_ERR_CANCELED == (_rreq)->base.error) { \
198-
(_mpi_status)->_cancelled = true; \
199-
} \
200-
(_mpi_status)->MPI_TAG = (_rreq)->completion.sender_tag; \
201-
(_mpi_status)->MPI_SOURCE = (_rreq)->completion.sender_imm; \
202-
(_mpi_status)->_ucount = (_length); \
203-
} \
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;
197+
}
198+
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;
204208
}
209+
return rc;
210+
}
205211

206212
#define PML_YALLA_SET_MESSAGE(_rreq, _comm, _mxm_msg, _message) \
207213
{ \

0 commit comments

Comments
 (0)