static ssize_t mlxm_ep_cancel(fid_t fid, void *ctx) { struct mlxm_fid_ep *fid_ep; struct mlxm_req *req; struct fi_context *context = (struct fi_context*)ctx; int err; fid_ep = container_of(fid, struct mlxm_fid_ep, ep.fid); if (!fid_ep->domain) return -EBADF; if (!context) return -EINVAL; if (context->internal[1] == NULL) return -FI_EINVAL; req =(struct mlxm_req *)context->internal[1]; if (FI_RECV == (uint64_t)(context->internal[3])) { err = mxm_req_cancel_recv(&req->mxm_req.rreq); } else { err = mxm_req_cancel_send(&req->mxm_req.sreq); } if (err == MXM_OK) { mxm_req_wait(&req->mxm_req.rreq.base); } return mlxm_errno(err); }
int MPID_nem_mxm_anysource_matched(MPID_Request * req) { mxm_error_t ret = MXM_OK; MPID_nem_mxm_req_area *req_area = NULL; int matched = FALSE; /* This function is called when an anysource request in the posted * receive queue is matched and dequeued see MPIDI_POSTED_RECV_DEQUEUE_HOOK(). * It returns 0(FALSE) if the req was not matched by mxm and non-zero(TRUE) * otherwise. * This happens * when the channel supports shared-memory and network communication * with a network capable of matching, and the same request is matched * by the network and, e.g., shared-memory. */ MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_MXM_ANYSOURCE_MATCHED); MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_MXM_ANYSOURCE_MATCHED); _dbg_mxm_output(5, "Any Source ========> Matching req %p \n", req); req_area = REQ_BASE(req); ret = mxm_req_cancel_recv(&req_area->mxm_req->item.recv); mxm_req_wait(&req_area->mxm_req->item.base); if (req_area->mxm_req->item.base.error != MXM_ERR_CANCELED) { matched = TRUE; } _dbg_mxm_out_req(req); MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_MXM_ANYSOURCE_MATCHED); return matched; }
static int mca_pml_yalla_recv_request_cancel(ompi_request_t *request, int flag) { mca_pml_yalla_recv_request_t *rreq = (mca_pml_yalla_recv_request_t*)request; mxm_error_t error; error = mxm_req_cancel_recv(&rreq->mxm); if ((error != MXM_OK) && (error != MXM_ERR_NO_PROGRESS)) { PML_YALLA_ERROR("failed to cancel receive request %p: %s", (void *)request, mxm_error_string(error)); return OMPI_ERROR; } PML_YALLA_VERBOSE(9, "canceled receive request %p", (void *)request); return OMPI_SUCCESS; }
int ompi_mtl_mxm_cancel(struct mca_mtl_base_module_t* mtl, struct mca_mtl_request_t *mtl_request, int flag) { mca_mtl_mxm_request_t *mtl_mxm_request = (mca_mtl_mxm_request_t*) mtl_request; mxm_error_t err; #if MXM_API >= MXM_VERSION(2,0) if (mtl_mxm_request->is_send) { err = mxm_req_cancel_send(&mtl_mxm_request->mxm.send); } else { err = mxm_req_cancel_recv(&mtl_mxm_request->mxm.recv); } #else err = mxm_req_cancel(&mtl_mxm_request->mxm.base); #endif if ((err != MXM_OK) && (err != MXM_ERR_NO_PROGRESS)) { return OMPI_ERROR; } return OMPI_SUCCESS; }