ucs_status_t ucp_wireup_msg_progress(uct_pending_req_t *self) { ucp_request_t *req = ucs_container_of(self, ucp_request_t, send.uct); ucp_ep_h ep = req->send.ep; ssize_t packed_len; if (req->send.wireup.type == UCP_WIREUP_MSG_REQUEST) { if (ep->flags & UCP_EP_FLAG_REMOTE_CONNECTED) { ucs_trace("ep %p: not sending wireup message - remote already connected", ep); goto out; } } /* send the active message */ if (req->send.wireup.type == UCP_WIREUP_MSG_ACK) { req->send.lane = ucp_ep_get_am_lane(ep); } else { req->send.lane = ucp_ep_get_wireup_msg_lane(ep); } packed_len = uct_ep_am_bcopy(ep->uct_eps[req->send.lane], UCP_AM_ID_WIREUP, ucp_wireup_msg_pack, req); if (packed_len < 0) { if (packed_len != UCS_ERR_NO_RESOURCE) { ucs_error("failed to send wireup: %s", ucs_status_string(packed_len)); } return (ucs_status_t)packed_len; } out: ucp_request_complete_send(req, UCS_OK); return UCS_OK; }
static ucs_status_t ucp_tag_req_start_contig(ucp_request_t *req, size_t count, ssize_t max_short, size_t zcopy_thresh, size_t rndv_thresh, const ucp_proto_t *proto) { ucp_ep_config_t *config = ucp_ep_config(req->send.ep); size_t only_hdr_size = proto->only_hdr_size; ucs_status_t status; size_t max_zcopy; ssize_t length; length = ucp_contig_dt_length(req->send.datatype, count); req->send.length = length; if (length <= max_short) { /* short */ req->send.uct.func = proto->contig_short; } else if (length >= rndv_thresh) { /* rendezvous */ status = ucp_tag_send_start_rndv(req); if (status != UCS_OK) { return status; } } else if (length < zcopy_thresh) { /* bcopy */ if (req->send.length <= config->max_am_bcopy - only_hdr_size) { req->send.uct.func = proto->bcopy_single; } else { req->send.uct.func = proto->bcopy_multi; } } else { /* eager zcopy */ status = ucp_request_send_buffer_reg(req, ucp_ep_get_am_lane(req->send.ep)); if (status != UCS_OK) { return status; } req->send.uct_comp.func = proto->contig_zcopy_completion; max_zcopy = config->max_am_zcopy; if (req->send.length <= max_zcopy - only_hdr_size) { req->send.uct_comp.count = 1; req->send.uct.func = proto->contig_zcopy_single; } else { /* calculate number of zcopy fragments */ req->send.uct_comp.count = 1 + (length + proto->first_hdr_size - proto->mid_hdr_size - 1) / (max_zcopy - proto->mid_hdr_size); req->send.uct.func = proto->contig_zcopy_multi; } } return UCS_OK; }
static ucs_status_t ucp_tag_eager_contig_short(uct_pending_req_t *self) { ucp_request_t *req = ucs_container_of(self, ucp_request_t, send.uct); ucp_ep_t *ep = req->send.ep; ucs_status_t status; req->send.lane = ucp_ep_get_am_lane(ep); status = uct_ep_am_short(ep->uct_eps[req->send.lane], UCP_AM_ID_EAGER_ONLY, req->send.tag.tag, req->send.buffer, req->send.length); if (status != UCS_OK) { return status; } ucp_request_complete_send(req, UCS_OK); return UCS_OK; }
static size_t ucp_tag_pack_eager_first_dt(void *dest, void *arg) { ucp_eager_first_hdr_t *hdr = dest; ucp_request_t *req = arg; size_t length; ucs_assert(req->send.lane == ucp_ep_get_am_lane(req->send.ep)); length = ucp_ep_get_max_bcopy(req->send.ep, req->send.lane) - sizeof(*hdr); hdr->super.super.tag = req->send.tag.tag; hdr->total_len = req->send.length; hdr->msg_id = req->send.tag.message_id; ucs_assert(req->send.state.dt.offset == 0); ucs_assert(req->send.length > length); return sizeof(*hdr) + ucp_dt_pack(req->send.datatype, hdr + 1, req->send.buffer, &req->send.state.dt, length); }