From 3226c6c8f69d37a719c27d53840db93bbb0ff4d1 Mon Sep 17 00:00:00 2001 From: Wenduo Wang Date: Thu, 5 Sep 2024 21:11:21 +0000 Subject: [PATCH 1/2] pml/cm: pack data from application buffer in successive MPI_Start calls This patch fixes a bug exposed by MTT MPI_Bsend_init_overtake_c, where - MPI_Bsend_init(buf, ..., req) - MPI_Start(req) - MPI_Wait(req, stat) - modify(buf) - MPI_Start(req) // this does not send the updated data - MPI_Wait(buf) This is because PML/CM uses a bounce buffer send_req.req_buff to pack data from the application buffer in MPI_Bsend_int but not MPI_Start. This patch adds a step to pack data from the application buffer in each MPI_Start call. Signed-off-by: Wenduo Wang --- ompi/mca/pml/cm/pml_cm_sendreq.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ompi/mca/pml/cm/pml_cm_sendreq.h b/ompi/mca/pml/cm/pml_cm_sendreq.h index a9613057c48..4bda5d1e42c 100644 --- a/ompi/mca/pml/cm/pml_cm_sendreq.h +++ b/ompi/mca/pml/cm/pml_cm_sendreq.h @@ -375,6 +375,10 @@ do { \ iov.iov_base = (IOVBASE_TYPE*)sendreq->req_buff; \ max_data = iov.iov_len = sendreq->req_count; \ iov_count = 1; \ + opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, \ + sendreq->req_send.req_base.req_datatype, \ + max_data, \ + sendreq->req_addr); \ opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, \ &iov, \ &iov_count, \ From 429c7b7e61b6d3ef2d1022f5066a169fcb27a3d0 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 9 Sep 2024 18:22:44 -0400 Subject: [PATCH 2/2] Fix buffered sends for OB1 as well. Signed-off-by: George Bosilca --- ompi/mca/pml/cm/pml_cm_sendreq.h | 2 +- ompi/mca/pml/ob1/pml_ob1_start.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ompi/mca/pml/cm/pml_cm_sendreq.h b/ompi/mca/pml/cm/pml_cm_sendreq.h index 4bda5d1e42c..4872943c05a 100644 --- a/ompi/mca/pml/cm/pml_cm_sendreq.h +++ b/ompi/mca/pml/cm/pml_cm_sendreq.h @@ -376,7 +376,7 @@ do { \ max_data = iov.iov_len = sendreq->req_count; \ iov_count = 1; \ opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, \ - sendreq->req_send.req_base.req_datatype, \ + &sendreq->req_send.req_base.req_datatype->super, \ max_data, \ sendreq->req_addr); \ opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, \ diff --git a/ompi/mca/pml/ob1/pml_ob1_start.c b/ompi/mca/pml/ob1/pml_ob1_start.c index 41795e007e5..311866e4014 100644 --- a/ompi/mca/pml/ob1/pml_ob1_start.c +++ b/ompi/mca/pml/ob1/pml_ob1_start.c @@ -84,13 +84,16 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests) sendreq = (mca_pml_ob1_send_request_t *) request; requests[i] = request; } else if (sendreq->req_send.req_bytes_packed != 0) { - size_t offset = 0; /** * Reset the convertor in case we're dealing with the original - * request, which when completed do not reset the convertor. + * request, which when completed do not reset the convertor but + * leaves it pointing to the buffered send location, with the + * packed datatype and count. */ - opal_convertor_set_position (&sendreq->req_send.req_base.req_convertor, - &offset); + opal_convertor_prepare_for_send(&sendreq->req_send.req_base.req_convertor, + &sendreq->req_send.req_base.req_datatype->super, + sendreq->req_send.req_base.req_count, + sendreq->req_send.req_base.req_addr); } /* reset the completion flag */