Don't keep multiples copies of the datatype and count. The only one we really need
is the one provided by the user. For the buffered send the real datatype used for the communication is always MPI_BYTE and the count can be retrieved from the req_bytes_packed field. This will decrease the size of the request by one pointer and one size_t (8 bytes or 16 bytes depending on the architecture). This commit was SVN r10680.
Этот коммит содержится в:
родитель
b7b93e48f5
Коммит
476c9e64df
@ -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;
|
||||
|
@ -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; \
|
||||
|
@ -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 */
|
||||
|
@ -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; \
|
||||
|
@ -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);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user