int mca_pml_yalla_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src, int tag, struct ompi_communicator_t* comm, ompi_status_public_t* status) { mxm_recv_req_t rreq; mxm_error_t error; PML_YALLA_INIT_MXM_RECV_REQ(&rreq, buf, count, datatype, src, tag, comm, recv); PML_YALLA_INIT_BLOCKING_MXM_RECV_REQ(&rreq); PML_YALLA_VERBOSE(8, "receive from %d tag %d dtype %s count %zu", src, tag, datatype->name, count); error = mxm_req_recv(&rreq); if (MXM_OK != error) { return OMPI_ERROR; } PML_YALLA_WAIT_MXM_REQ(&rreq.base); PML_YALLA_VERBOSE(8, "receive completed with status %s source %d rtag %d(%d/0x%x) len %zu", mxm_error_string(rreq.base.error), rreq.completion.sender_imm, rreq.completion.sender_tag, rreq.tag, rreq.tag_mask, rreq.completion.actual_len); PML_YALLA_SET_RECV_STATUS(&rreq, rreq.completion.actual_len, status); PML_YALLA_FREE_BLOCKING_MXM_REQ(&rreq.base); return OMPI_SUCCESS; }
int ompi_mtl_mxm_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request) { int ret; mxm_error_t err; mxm_recv_req_t *mxm_recv_req; mca_mtl_mxm_request_t * mtl_mxm_request; mtl_mxm_request = (mca_mtl_mxm_request_t*) mtl_request; mxm_recv_req = &mtl_mxm_request->mxm.recv; ompi_mtl_mxm_set_recv_envelope(mxm_recv_req, comm, src, tag); /* prepare a receive request embedded in the MTL request */ ret = ompi_mtl_mxm_recv_init(mtl_mxm_request, convertor, mxm_recv_req); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { return ret; } /* post-recv */ err = mxm_req_recv(mxm_recv_req); if (OPAL_UNLIKELY(MXM_OK != err)) { orte_show_help("help-mtl-mxm.txt", "error posting receive", true, mxm_error_string(err), mtl_mxm_request->buf, mtl_mxm_request->length); return OMPI_ERROR; } return OMPI_SUCCESS; }
int ompi_mtl_mxm_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request) { mca_mtl_mxm_request_t * mtl_mxm_request; mxm_error_t err; mxm_recv_req_t *mxm_recv_req; int ret; mtl_mxm_request = (mca_mtl_mxm_request_t*) mtl_request; mtl_mxm_request->convertor = convertor; ret = ompi_mtl_datatype_recv_buf(mtl_mxm_request->convertor, &mtl_mxm_request->buf, &mtl_mxm_request->length, &mtl_mxm_request->free_after); if (OMPI_SUCCESS != ret) { return ret; } /* prepare a receive request embedded in the MTL request */ mxm_recv_req = &mtl_mxm_request->mxm.recv; #if MXM_API >= MXM_VERSION(2,0) mtl_mxm_request->is_send = 0; #endif mxm_recv_req->base.state = MXM_REQ_NEW; ompi_mtl_mxm_set_recv_envelope(mxm_recv_req, comm, src, tag); #if MXM_API < MXM_VERSION(2,0) mxm_recv_req->base.flags = 0; #endif mxm_recv_req->base.data_type = MXM_REQ_DATA_BUFFER; mxm_recv_req->base.data.buffer.ptr = mtl_mxm_request->buf; mxm_recv_req->base.data.buffer.length = mtl_mxm_request->length; #if MXM_API < MXM_VERSION(1,5) mxm_recv_req->base.data.buffer.mkey = MXM_MKEY_NONE; #else mxm_recv_req->base.data.buffer.memh = MXM_INVALID_MEM_HANDLE; #endif mxm_recv_req->base.context = mtl_mxm_request; mxm_recv_req->base.completed_cb = ompi_mtl_mxm_recv_completion_cb; /* post-recv */ err = mxm_req_recv(mxm_recv_req); if (MXM_OK != err) { orte_show_help("help-mtl-mxm.txt", "error posting receive", true, mxm_error_string(err), mtl_mxm_request->buf, mtl_mxm_request->length); return OMPI_ERROR; } return OMPI_SUCCESS; }
static int _mxm_irecv(MPID_nem_mxm_ep_t * ep, MPID_nem_mxm_req_area * req, int id, mxm_mq_h mxm_mq, mxm_tag_t mxm_tag) { int mpi_errno = MPI_SUCCESS; mxm_error_t ret = MXM_OK; mxm_recv_req_t *mxm_rreq; list_head_t *free_queue = NULL; MPIU_Assert(req); free_queue = (ep ? &ep->free_queue : &mxm_obj->free_queue); req->mxm_req = list_dequeue_mxm_req(free_queue); if (!req->mxm_req) { list_grow_mxm_req(free_queue); req->mxm_req = list_dequeue_mxm_req(free_queue); if (!req->mxm_req) { MPIU_DBG_MSG(CH3_CHANNEL, VERBOSE, "empty free queue"); mpi_errno = MPI_ERR_OTHER; goto fn_fail; } } mxm_rreq = &(req->mxm_req->item.recv); mxm_rreq->base.state = MXM_REQ_NEW; mxm_rreq->base.mq = mxm_mq; mxm_rreq->base.conn = (ep ? ep->mxm_conn : 0); mxm_rreq->base.completed_cb = _mxm_recv_completion_cb; mxm_rreq->base.context = req->ctx; mxm_rreq->tag = mxm_tag; mxm_rreq->tag_mask = _mxm_tag_mask(id); if (likely(req->iov_count == 1)) { mxm_rreq->base.data_type = MXM_REQ_DATA_BUFFER; mxm_rreq->base.data.buffer.ptr = req->iov_buf[0].ptr; mxm_rreq->base.data.buffer.length = req->iov_buf[0].length; } else { mxm_rreq->base.data_type = MXM_REQ_DATA_IOV; mxm_rreq->base.data.iov.vector = req->iov_buf; mxm_rreq->base.data.iov.count = req->iov_count; } ret = mxm_req_recv(mxm_rreq); if (MXM_OK != ret) { list_enqueue(free_queue, &req->mxm_req->queue); mpi_errno = MPI_ERR_OTHER; goto fn_fail; } fn_exit: return mpi_errno; fn_fail: goto fn_exit; }
int mca_pml_yalla_start(size_t count, ompi_request_t** requests) { mca_pml_yalla_base_request_t *req; mxm_error_t error; size_t i; int rc; for (i = 0; i < count; ++i) { req = (mca_pml_yalla_base_request_t *)requests[i]; if ((req == NULL) || (OMPI_REQUEST_PML != req->ompi.req_type)) { /* Skip irrelevant requests */ continue; } PML_YALLA_ASSERT(req->ompi.req_state != OMPI_REQUEST_INVALID); PML_YALLA_RESET_OMPI_REQ(&req->ompi, OMPI_REQUEST_ACTIVE); if (req->flags & MCA_PML_YALLA_REQUEST_FLAG_SEND) { mca_pml_yalla_send_request_t *sreq; sreq = (mca_pml_yalla_send_request_t *)req; PML_YALLA_RESET_PML_REQ(req, PML_YALLA_MXM_REQBASE(sreq)); if (req->flags & MCA_PML_YALLA_REQUEST_FLAG_BSEND) { PML_YALLA_VERBOSE(8, "start bsend request %p", (void *)sreq); rc = mca_pml_yalla_bsend(&sreq->mxm); sreq->super.ompi.req_status.MPI_ERROR = rc; ompi_request_complete(&sreq->super.ompi, true); if (OMPI_SUCCESS != rc) { return rc; } } else { PML_YALLA_VERBOSE(8, "start send request %p", (void *)sreq); error = mxm_req_send(&sreq->mxm); if (MXM_OK != error) { return OMPI_ERROR; } } } else { mca_pml_yalla_recv_request_t *rreq; rreq = (mca_pml_yalla_recv_request_t *)req; PML_YALLA_RESET_PML_REQ(req, PML_YALLA_MXM_REQBASE(rreq)); PML_YALLA_VERBOSE(8, "start recv request %p", (void *)req); error = mxm_req_recv(&rreq->mxm); if (MXM_OK != error) { return OMPI_ERROR; } } } return OMPI_SUCCESS; }
int ompi_mtl_mxm_irecv(struct mca_mtl_base_module_t* mtl, struct ompi_communicator_t *comm, int src, int tag, struct opal_convertor_t *convertor, struct mca_mtl_request_t *mtl_request) { mca_mtl_mxm_request_t * mtl_mxm_request; mxm_error_t err; mxm_recv_req_t *mxm_recv_req; int ret; mtl_mxm_request = (mca_mtl_mxm_request_t*) mtl_request; mtl_mxm_request->convertor = convertor; ret = ompi_mtl_datatype_recv_buf(mtl_mxm_request->convertor, &mtl_mxm_request->buf, &mtl_mxm_request->length, &mtl_mxm_request->free_after); if (OMPI_SUCCESS != ret) { return ret; } /* prepare a receive request embedded in the MTL request */ mxm_recv_req = &mtl_mxm_request->mxm.recv; mxm_recv_req->base.state = MXM_REQ_NEW; mxm_recv_req->base.mq = ompi_mtl_mxm_mq_lookup(comm); mxm_recv_req->base.conn = (src == MPI_ANY_SOURCE) ? NULL : ompi_mtl_mxm_conn_lookup(comm, src); mxm_recv_req->base.flags = 0; mxm_recv_req->base.data_type = MXM_REQ_DATA_BUFFER; mxm_recv_req->base.data.buffer.ptr = mtl_mxm_request->buf; mxm_recv_req->base.data.buffer.length = mtl_mxm_request->length; mxm_recv_req->base.data.buffer.mkey = MXM_MKEY_NONE; mxm_recv_req->base.context = mtl_mxm_request; mxm_recv_req->base.completed_cb = ompi_mtl_mxm_recv_completion_cb; mxm_recv_req->tag = tag; mxm_recv_req->tag_mask = (tag == MPI_ANY_TAG) ? 0 : 0xffffffffU; /* post-recv */ err = mxm_req_recv(mxm_recv_req); if (MXM_OK != err) { orte_show_help("help-mtl-mxm.txt", "error posting receive", true, mxm_error_string(err), mtl_mxm_request->buf, mtl_mxm_request->length); return OMPI_ERROR; } return OMPI_SUCCESS; }
/* blocking receive */ int mca_spml_ikrit_recv(void* buf, size_t size, int src) { mxm_error_t ret = MXM_OK; mxm_recv_req_t req; char dummy_buf[1]; /* tag mask 0 matches any tag */ SPML_VERBOSE(100, "want to recv from src %d, size %d buf %p", src, (int)size, buf); req.tag = src == SHMEM_ANY_SOURCE ? 0 : src; req.tag_mask = src == SHMEM_ANY_SOURCE ? 0 : 0xFFFFFFFF; req.base.state = MXM_REQ_NEW; req.base.mq = mca_spml_ikrit.mxm_mq; req.base.conn = NULL; #if MXM_API < MXM_VERSION(2,0) req.base.flags = MXM_REQ_FLAG_BLOCKING; #endif req.base.completed_cb = NULL; req.base.data_type = MXM_REQ_DATA_BUFFER; req.base.data.buffer.ptr = buf == NULL ? dummy_buf : buf; req.base.data.buffer.length = size == 0 ? sizeof(dummy_buf) : size; req.base.data.buffer.memh = NULL; ret = mxm_req_recv(&req); if (MXM_OK != ret) { return OSHMEM_ERROR; } mca_spml_irkit_req_wait(&req.base); if (MXM_OK != req.base.error) { return OSHMEM_ERROR; } SPML_VERBOSE(100, "recvd from tag %d len %d", req.completion.sender_tag, (int)req.completion.actual_len); return OSHMEM_SUCCESS; }
int mca_pml_yalla_irecv(void *buf, size_t count, ompi_datatype_t *datatype, int src, int tag, struct ompi_communicator_t* comm, struct ompi_request_t **request) { mca_pml_yalla_recv_request_t *rreq; mxm_error_t error; rreq = MCA_PML_YALLA_RREQ_INIT(buf, count, datatype, src, tag, comm, OMPI_REQUEST_ACTIVE); rreq->super.ompi.req_persistent = false; rreq->super.flags = 0; PML_YALLA_VERBOSE(8, "receive request *%p=%p from %d tag %d dtype %s count %zu", (void *)request, (void *)rreq, src, tag, datatype->name, count); error = mxm_req_recv(&rreq->mxm); if (MXM_OK != error) { return OMPI_ERROR; } *request = &rreq->super.ompi; return OMPI_SUCCESS; }