1
1

pml_ob1: ensure to have enough space for send/recvreq on stack

r30343 introduced the optimization of putting the OB1 sendreq and
recvreq on the stack for blocking sends and receives.  However, the
requests did not contain enough storage for the data that is normally
immediately ''after'' the request (e.g., BTL data).

This commit changes these requests to be pointers and to use alloca()
to get enough total space for the OB1 request and all the associated
data.

The change is smaller than it looks; most of it is just changing from
"foo.bar" to "foo->bar" notation (etc.).

Submitted by Jeff, reviewed by Nathan.  But we want George to look at
this (and get a little soak time on the trunk) before moving to v1.8.

cmr=v1.8.2:reviewer=bosilca

This commit was SVN r31806.

The following SVN revision numbers were found above:
  r30343 --> open-mpi/ompi@2b57f4227e
Этот коммит содержится в:
Jeff Squyres 2014-05-17 01:05:59 +00:00
родитель 750c6c7861
Коммит 025e4a852b
2 изменённых файлов: 29 добавлений и 21 удалений

Просмотреть файл

@ -14,6 +14,7 @@
* reserved.
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -88,28 +89,31 @@ int mca_pml_ob1_recv(void *addr,
struct ompi_communicator_t *comm,
ompi_status_public_t * status)
{
mca_pml_ob1_recv_request_t recvreq;
mca_pml_ob1_recv_request_t *recvreq =
alloca(sizeof(mca_pml_ob1_recv_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t));
int rc;
OBJ_CONSTRUCT(&recvreq, mca_pml_ob1_recv_request_t);
OBJ_CONSTRUCT(recvreq, mca_pml_ob1_recv_request_t);
MCA_PML_OB1_RECV_REQUEST_INIT(&recvreq, addr, count, datatype,
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, addr, count, datatype,
src, tag, comm, false);
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
&(recvreq.req_recv.req_base),
&(recvreq->req_recv.req_base),
PERUSE_RECV);
MCA_PML_OB1_RECV_REQUEST_START(&recvreq);
ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi);
MCA_PML_OB1_RECV_REQUEST_START(recvreq);
ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi);
if (NULL != status) { /* return status */
*status = recvreq.req_recv.req_base.req_ompi.req_status;
*status = recvreq->req_recv.req_base.req_ompi.req_status;
}
rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR;
MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq.req_recv);
OBJ_DESTRUCT(&recvreq);
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq->req_recv);
OBJ_DESTRUCT(recvreq);
return rc;
}

Просмотреть файл

@ -12,6 +12,7 @@
* All rights reserved.
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -162,7 +163,10 @@ int mca_pml_ob1_send(void *buf,
ompi_proc_t *dst_proc = ompi_comm_peer_lookup (comm, dst);
mca_bml_base_endpoint_t* endpoint = (mca_bml_base_endpoint_t*)
dst_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML];
mca_pml_ob1_send_request_t sendreq;
mca_pml_ob1_send_request_t *sendreq =
alloca(sizeof(mca_pml_ob1_send_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t));
int16_t seqn;
int rc;
@ -194,11 +198,11 @@ int mca_pml_ob1_send(void *buf,
}
}
OBJ_CONSTRUCT(&sendreq, mca_pml_ob1_send_request_t);
sendreq.req_send.req_base.req_proc = dst_proc;
sendreq.src_des = NULL;
OBJ_CONSTRUCT(sendreq, mca_pml_ob1_send_request_t);
sendreq->req_send.req_base.req_proc = dst_proc;
sendreq->src_des = NULL;
MCA_PML_OB1_SEND_REQUEST_INIT(&sendreq,
MCA_PML_OB1_SEND_REQUEST_INIT(sendreq,
buf,
count,
datatype,
@ -206,19 +210,19 @@ int mca_pml_ob1_send(void *buf,
comm, sendmode, false);
PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE,
&sendreq.req_send.req_base,
&sendreq->req_send.req_base,
PERUSE_SEND);
MCA_PML_OB1_SEND_REQUEST_START_W_SEQ(&sendreq, endpoint, seqn, rc);
MCA_PML_OB1_SEND_REQUEST_START_W_SEQ(sendreq, endpoint, seqn, rc);
if (rc != OMPI_SUCCESS) {
return rc;
}
ompi_request_wait_completion(&sendreq.req_send.req_base.req_ompi);
ompi_request_wait_completion(&sendreq->req_send.req_base.req_ompi);
rc = sendreq.req_send.req_base.req_ompi.req_status.MPI_ERROR;
MCA_PML_BASE_SEND_REQUEST_FINI(&sendreq.req_send);
OBJ_DESTRUCT(&sendreq);
rc = sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR;
MCA_PML_BASE_SEND_REQUEST_FINI(&sendreq->req_send);
OBJ_DESTRUCT(sendreq);
return rc;
}