Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions ompi/mca/pml/ob1/pml_ob1_sendreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef enum {
struct mca_pml_ob1_send_request_t {
mca_pml_base_send_request_t req_send;
mca_bml_base_endpoint_t* req_endpoint;
mca_pml_base_request_t* req_parent;
opal_ptr_t req_recv;
opal_atomic_int32_t req_state;
opal_atomic_int32_t req_lock;
Expand Down Expand Up @@ -155,6 +156,7 @@ get_request_from_send_pending(mca_pml_ob1_send_pending_t *type)
sendmode, \
persistent, \
0); /* convertor_flags */ \
(sendreq)->req_parent = NULL; \
(sendreq)->req_recv.pval = NULL; \
}

Expand Down Expand Up @@ -198,18 +200,27 @@ static inline void mca_pml_ob1_free_rdma_resources (mca_pml_ob1_send_request_t*
* Mark a send request as completed at the MPI level.
*/

#define MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, with_signal) \
do { \
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \
(sendreq)->req_send.req_base.req_comm->c_my_rank; \
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \
(sendreq)->req_send.req_base.req_tag; \
(sendreq)->req_send.req_base.req_ompi.req_status._ucount = \
(sendreq)->req_send.req_bytes_packed; \
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
&(sendreq->req_send.req_base), PERUSE_SEND); \
\
ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), (with_signal) ); \
#define MCA_PML_OB1_SEND_REQUEST_MPI_COMPLETE(sendreq, with_signal) \
do { \
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \
(sendreq)->req_send.req_base.req_comm->c_my_rank; \
(sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \
(sendreq)->req_send.req_base.req_tag; \
(sendreq)->req_send.req_base.req_ompi.req_status._ucount = \
(sendreq)->req_send.req_bytes_packed; \
if(NULL != (sendreq)->req_parent) { \
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
&(sendreq->req_parent->req_base), PERUSE_SEND); \
\
ompi_request_complete( &(sendreq)->req_parent->req_ompi, (with_signal) ); \
ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), false ); \
(sendreq)->req_parent = NULL; /* dissociate from parent */ \
} else { \
PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \
&(sendreq->req_send.req_base), PERUSE_SEND); \
\
ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), (with_signal) ); \
} \
} while(0)

static inline void mca_pml_ob1_send_request_fini (mca_pml_ob1_send_request_t *sendreq)
Expand Down
50 changes: 15 additions & 35 deletions ompi/mca/pml/ob1/pml_ob1_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,51 +50,31 @@ int mca_pml_ob1_start(size_t count, ompi_request_t** requests)
switch(pml_request->req_type) {
case MCA_PML_REQUEST_SEND:
{
mca_pml_ob1_send_request_t* sendreq = (mca_pml_ob1_send_request_t*)pml_request;
mca_pml_ob1_send_request_t* parentreq = (mca_pml_ob1_send_request_t*)pml_request;
mca_pml_ob1_send_request_t* sendreq = NULL;
MEMCHECKER(
memchecker_call(&opal_memchecker_base_isdefined,
pml_request->req_addr, pml_request->req_count,
pml_request->req_datatype);
);

if (!pml_request->req_pml_complete) {
ompi_request_t *request;

/* buffered sends can be mpi complete and pml incomplete. to support this
* case we need to allocate a new request. */
rc = mca_pml_ob1_isend_init (pml_request->req_addr,
pml_request->req_count,
pml_request->req_datatype,
pml_request->req_peer,
pml_request->req_tag,
sendreq->req_send.req_send_mode,
pml_request->req_comm,
&request);
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
return rc;
}

/* copy the callback and callback data to the new requests */
request->req_complete_cb = pml_request->req_ompi.req_complete_cb;
request->req_complete_cb_data = pml_request->req_ompi.req_complete_cb_data;

/* ensure the old request gets released */
pml_request->req_free_called = true;

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.
*/
opal_convertor_set_position (&sendreq->req_send.req_base.req_convertor,
&offset);
/* buffered sends can be mpi complete and pml incomplete. to support this
* case we need to allocate a new request. */
rc = mca_pml_ob1_isend_init (pml_request->req_addr,
pml_request->req_count,
pml_request->req_datatype,
pml_request->req_peer,
pml_request->req_tag,
parentreq->req_send.req_send_mode,
pml_request->req_comm,
(ompi_request_t**)&(sendreq));
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
return rc;
}

/* reset the completion flag */
pml_request->req_pml_complete = false;
sendreq->req_parent = pml_request;

MCA_PML_OB1_SEND_REQUEST_START(sendreq, rc);
if(rc != OMPI_SUCCESS)
Expand Down
2 changes: 1 addition & 1 deletion ompi/request/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct ompi_request_t {
ompi_status_public_t req_status; /**< Completion status */
volatile void *req_complete; /**< Flag indicating wether request has completed */
volatile ompi_request_state_t req_state; /**< enum indicate state of the request */
bool req_persistent; /**< flag indicating if the this is a persistent request */
bool req_persistent; /**< flag indicating if this is a persistent request */
int req_f_to_c_index; /**< Index in Fortran <-> C translation array */
ompi_request_start_fn_t req_start; /**< Called by MPI_START and MPI_STARTALL */
ompi_request_free_fn_t req_free; /**< Called by free */
Expand Down