diff --git a/ompi/mca/pml/base/pml_base_bsend.c b/ompi/mca/pml/base/pml_base_bsend.c index cd8538ed8a..874db04bd5 100644 --- a/ompi/mca/pml/base/pml_base_bsend.c +++ b/ompi/mca/pml/base/pml_base_bsend.c @@ -201,7 +201,7 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request) size_t max_data; int rc, freeAfter; - if(sendreq->req_count > 0) { + if(sendreq->req_bytes_packed > 0) { /* has a buffer been provided */ OPAL_THREAD_LOCK(&mca_pml_bsend_mutex); @@ -221,31 +221,13 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request) return OMPI_ERR_BUFFER; } - /* setup request to reflect the contigous buffer */ - sendreq->req_count = sendreq->req_bytes_packed; - -#if 0 - /* In case we reuse an old request recreate the correct convertor, the one - * using the user buffers. Otherwise at the end of this function we replace - * it with a convertor using the allocator buffer !!! - */ - ompi_convertor_prepare_for_send( &sendreq->req_convertor, sendreq->req_base.req_datatype, - sendreq->req_base.req_count, sendreq->req_base.req_addr ); - -#endif - /* increment count of pending requests */ - mca_pml_bsend_count++; - - sendreq->req_datatype = MPI_BYTE; - - OPAL_THREAD_UNLOCK(&mca_pml_bsend_mutex); /* The convertor is already initialized in the begining so we just have to * pack the data in the newly allocated buffer. */ iov.iov_base = sendreq->req_addr; - iov.iov_len = sendreq->req_count; + iov.iov_len = sendreq->req_bytes_packed; iov_count = 1; max_data = iov.iov_len; if((rc = ompi_convertor_pack( &sendreq->req_convertor, @@ -258,6 +240,8 @@ int mca_pml_base_bsend_request_start(ompi_request_t* request) /* setup convertor to point to packed buffer (at position zero) */ ompi_convertor_prepare_for_send( &sendreq->req_convertor, MPI_PACKED, max_data, sendreq->req_addr ); + /* increment count of pending requests */ + mca_pml_bsend_count++; } sendreq->req_base.req_ompi.req_complete = true; return OMPI_SUCCESS; @@ -272,7 +256,7 @@ int mca_pml_base_bsend_request_alloc(ompi_request_t* request) { mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)request; - if (sendreq->req_count == 0) return OMPI_SUCCESS; + assert( sendreq->req_bytes_packed > 0 ); /* has a buffer been provided */ OPAL_THREAD_LOCK(&mca_pml_bsend_mutex); @@ -296,9 +280,6 @@ int mca_pml_base_bsend_request_alloc(ompi_request_t* request) mca_pml_bsend_count++; OPAL_THREAD_UNLOCK(&mca_pml_bsend_mutex); - /* setup request to reflect the contigous buffer */ - sendreq->req_count = sendreq->req_bytes_packed; - sendreq->req_datatype = MPI_PACKED; return OMPI_SUCCESS; } @@ -309,7 +290,7 @@ int mca_pml_base_bsend_request_alloc(ompi_request_t* request) int mca_pml_base_bsend_request_fini(ompi_request_t* request) { mca_pml_base_send_request_t* sendreq = (mca_pml_base_send_request_t*)request; - if(sendreq->req_count == 0 || + if(sendreq->req_bytes_packed == 0 || sendreq->req_addr == NULL || sendreq->req_addr == sendreq->req_base.req_addr) return OMPI_SUCCESS; diff --git a/ompi/mca/pml/base/pml_base_sendreq.h b/ompi/mca/pml/base/pml_base_sendreq.h index 0867cd9b15..2a2369625d 100644 --- a/ompi/mca/pml/base/pml_base_sendreq.h +++ b/ompi/mca/pml/base/pml_base_sendreq.h @@ -39,9 +39,7 @@ OMPI_DECLSPEC extern opal_class_t mca_pml_base_send_request_t_class; */ struct mca_pml_base_send_request_t { mca_pml_base_request_t req_base; /** base request type - common data structure for use by wait/test */ - struct ompi_datatype_t* req_datatype; /**< pointer to datatype */ void *req_addr; /**< pointer to send buffer - may not be application buffer */ - size_t req_count; /**< number of elements in send buffer */ size_t req_bytes_packed; /**< packed size of a message given the datatype and count */ mca_pml_base_send_mode_t req_send_mode; /**< type of send */ ompi_convertor_t req_convertor; /**< convertor that describes this datatype */ @@ -83,8 +81,6 @@ typedef struct mca_pml_base_send_request_t mca_pml_base_send_request_t; \ OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent); \ (request)->req_addr = addr; \ - (request)->req_count = count; \ - (request)->req_datatype = datatype; \ (request)->req_send_mode = mode; \ (request)->req_base.req_addr = addr; \ (request)->req_base.req_count = count; \ diff --git a/ompi/mca/pml/dr/pml_dr_sendreq.c b/ompi/mca/pml/dr/pml_dr_sendreq.c index e0db397f6b..9ac13cf3ef 100644 --- a/ompi/mca/pml/dr/pml_dr_sendreq.c +++ b/ompi/mca/pml/dr/pml_dr_sendreq.c @@ -454,8 +454,8 @@ int mca_pml_dr_send_request_start_buffered( /* re-init convertor for packed data (it keep the flags) */ ompi_convertor_prepare_for_send( &sendreq->req_send.req_convertor, - sendreq->req_send.req_datatype, - sendreq->req_send.req_count, + MPI_BYTE, + sendreq->req_send.req_bytes_packed, sendreq->req_send.req_addr ); /* request is complete at mpi level */ diff --git a/ompi/mca/pml/dr/pml_dr_sendreq.h b/ompi/mca/pml/dr/pml_dr_sendreq.h index 515352d1e9..b72cb72871 100644 --- a/ompi/mca/pml/dr/pml_dr_sendreq.h +++ b/ompi/mca/pml/dr/pml_dr_sendreq.h @@ -110,8 +110,6 @@ do { \ OMPI_REQUEST_INIT(&(sendreq)->req_send.req_base.req_ompi, persistent); \ (sendreq)->req_send.req_addr = addr; \ - (sendreq)->req_send.req_count = count; \ - (sendreq)->req_send.req_datatype = datatype; \ (sendreq)->req_send.req_send_mode = sendmode; \ (sendreq)->req_send.req_base.req_addr = addr; \ (sendreq)->req_send.req_base.req_count = count; \ diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.c b/ompi/mca/pml/ob1/pml_ob1_sendreq.c index e58154b16b..b0b283f6e2 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.c @@ -377,8 +377,8 @@ int mca_pml_ob1_send_request_start_buffered( /* re-init convertor for packed data */ ompi_convertor_prepare_for_send( &sendreq->req_send.req_convertor, - sendreq->req_send.req_datatype, - sendreq->req_send.req_count, + MPI_BYTE, + sendreq->req_send.req_bytes_packed, sendreq->req_send.req_addr ); /* request is complete at mpi level */ OPAL_THREAD_LOCK(&ompi_request_lock);