diff --git a/ompi/mca/btl/portals/btl_portals_component.c b/ompi/mca/btl/portals/btl_portals_component.c index 70f03b72f3..e639d786bb 100644 --- a/ompi/mca/btl/portals/btl_portals_component.c +++ b/ompi/mca/btl/portals/btl_portals_component.c @@ -400,15 +400,19 @@ mca_btl_portals_component_progress(void) case PTL_EVENT_GET_START: /* generated on source (target) when a get from memory starts */ - /* BWB - FIX ME - need to fill in for btl get() */ - abort(); + OPAL_OUTPUT_VERBOSE((900, mca_btl_portals_component.portals_output, + "PTL_EVENT_GET_START for 0x%x, %d", + frag, (int) ev.hdr_data)); + break; case PTL_EVENT_GET_END: /* generated on source (target) when a get from memory ends */ - /* BWB - FIX ME - need to fill in for btl get() */ - abort(); + OPAL_OUTPUT_VERBOSE((900, mca_btl_portals_component.portals_output, + "PTL_EVENT_GET_END for 0x%x, %d", + frag, (int) ev.hdr_data)); + break; case PTL_EVENT_PUT_START: @@ -485,16 +489,26 @@ mca_btl_portals_component_progress(void) /* generated on destination (origin) when a get starts returning data */ - /* BWB - FIX ME - need to fill in for get */ - abort(); + OPAL_OUTPUT_VERBOSE((900, mca_btl_portals_component.portals_output, + "PTL_EVENT_REPLY_START for 0x%x, %d, %d", + frag, (int) frag->type, (int) ev.hdr_data)); + break; case PTL_EVENT_REPLY_END: /* generated on destination (origin) when a get is done returning data */ - /* BWB - FIX ME - need to fill in for get */ - abort(); + OPAL_OUTPUT_VERBOSE((90, mca_btl_portals_component.portals_output, + "PTL_EVENT_REPLY_END for 0x%x, %d", + frag, (int) frag->type)); + + /* let the PML know we're done */ + frag->base.des_cbfunc(&mca_btl_portals_module.super, + frag->endpoint, + &frag->base, + OMPI_SUCCESS); + break; case PTL_EVENT_SEND_START: diff --git a/ompi/mca/btl/portals/btl_portals_rdma.c b/ompi/mca/btl/portals/btl_portals_rdma.c index 3985bc858c..d287b35029 100644 --- a/ompi/mca/btl/portals/btl_portals_rdma.c +++ b/ompi/mca/btl/portals/btl_portals_rdma.c @@ -80,9 +80,51 @@ mca_btl_portals_put(struct mca_btl_base_module_t* btl_base, int mca_btl_portals_get(struct mca_btl_base_module_t* btl_base, struct mca_btl_base_endpoint_t* btl_peer, - struct mca_btl_base_descriptor_t* decriptor) + struct mca_btl_base_descriptor_t* descriptor) { - opal_output(mca_btl_portals_component.portals_output, - "Warning: call to unimplemented function get()"); - return OMPI_ERR_NOT_IMPLEMENTED; + mca_btl_portals_frag_t *frag = (mca_btl_portals_frag_t*) descriptor; + ptl_md_t md; + ptl_handle_md_t md_h; + int ret; + + assert(&mca_btl_portals_module == (mca_btl_portals_module_t*) btl_base); + + frag->endpoint = btl_peer; + frag->hdr.tag = MCA_BTL_TAG_MAX; + frag->type = mca_btl_portals_frag_type_rdma; + + /* setup the send */ + md.start = frag->segment.seg_addr.pval; + md.length = frag->segment.seg_len; + md.threshold = 2; /* unlink after send & ack */ + md.max_size = 0; + md.options = PTL_MD_EVENT_START_DISABLE; + md.user_ptr = frag; /* keep a pointer to ourselves */ + md.eq_handle = mca_btl_portals_module.portals_eq_handles[OMPI_BTL_PORTALS_EQ]; + + /* make a free-floater */ + ret = PtlMDBind(mca_btl_portals_module.portals_ni_h, + md, + PTL_UNLINK, + &md_h); + if (ret != PTL_OK) { + opal_output(mca_btl_portals_component.portals_output, + "PtlMDBind failed with error %d", ret); + return OMPI_ERROR; + } + + ret = PtlGet(md_h, + *((mca_btl_base_endpoint_t*) btl_peer), + OMPI_BTL_PORTALS_RDMA_TABLE_ID, + 0, /* ac_index - not used*/ + frag->base.des_dst[0].seg_key.key64, /* match bits */ + 0); /* remote offset - not used */ + if (ret != PTL_OK) { + opal_output(mca_btl_portals_component.portals_output, + "PtlGet failed with error %d", ret); + PtlMDUnlink(md_h); + return OMPI_ERROR; + } + + return OMPI_SUCCESS; }