2011-12-09 21:24:07 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2012-02-10 00:47:29 +00:00
|
|
|
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
|
2011-12-09 21:24:07 +00:00
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "btl_ugni_rdma.h"
|
2012-02-10 00:47:29 +00:00
|
|
|
#include "btl_ugni_smsg.h"
|
|
|
|
|
2011-12-09 21:24:07 +00:00
|
|
|
/**
|
|
|
|
* Initiate a get operation.
|
|
|
|
*
|
|
|
|
* @param btl (IN) BTL module
|
|
|
|
* @param endpoint (IN) BTL addressing information
|
|
|
|
* @param descriptor (IN) Description of the data to be transferred
|
|
|
|
*/
|
|
|
|
int mca_btl_ugni_get (struct mca_btl_base_module_t *btl,
|
|
|
|
struct mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct mca_btl_base_descriptor_t *des) {
|
|
|
|
mca_btl_ugni_base_frag_t *frag = (mca_btl_ugni_base_frag_t *) des;
|
2014-07-10 16:31:15 +00:00
|
|
|
mca_btl_ugni_segment_t *src_seg = (mca_btl_ugni_segment_t *) des->des_remote;
|
|
|
|
mca_btl_ugni_segment_t *dst_seg = (mca_btl_ugni_segment_t *) des->des_local;
|
2012-06-21 17:09:12 +00:00
|
|
|
size_t size = src_seg->base.seg_len - src_seg->extra_byte_count;
|
2012-02-10 00:47:29 +00:00
|
|
|
bool check;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-02-10 00:47:29 +00:00
|
|
|
BTL_VERBOSE(("Using RDMA/FMA Get"));
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-05-31 20:02:41 +00:00
|
|
|
/* cause endpoint to bind if it isn't already (bind is sufficient for rdma) */
|
|
|
|
(void) mca_btl_ugni_check_endpoint_state(endpoint);
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-02-10 00:47:29 +00:00
|
|
|
/* Check if the get is aligned/sized on a multiple of 4 */
|
2014-07-10 16:31:15 +00:00
|
|
|
check = !!((des->des_remote->seg_addr.lval | des->des_local->seg_addr.lval | size) & 3);
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-02-10 00:47:29 +00:00
|
|
|
if (OPAL_UNLIKELY(check || size > mca_btl_ugni_component.ugni_get_limit)) {
|
2011-12-09 21:24:07 +00:00
|
|
|
/* switch to put */
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERR_NOT_AVAILABLE;
|
2012-04-19 21:51:55 +00:00
|
|
|
}
|
|
|
|
|
2012-06-21 17:09:12 +00:00
|
|
|
if (src_seg->extra_byte_count) {
|
2012-06-29 15:43:29 +00:00
|
|
|
memmove ((char *) dst_seg->base.seg_addr.pval + size, src_seg->extra_bytes, src_seg->extra_byte_count);
|
2012-06-21 17:09:12 +00:00
|
|
|
src_seg->base.seg_len = size;
|
|
|
|
dst_seg->base.seg_len = size;
|
|
|
|
}
|
|
|
|
|
2012-05-31 20:02:41 +00:00
|
|
|
des->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-06-21 17:09:12 +00:00
|
|
|
return mca_btl_ugni_post (frag, true, dst_seg, src_seg);
|
2012-05-31 20:02:41 +00:00
|
|
|
}
|
2011-12-09 21:24:07 +00:00
|
|
|
|
2012-04-24 20:18:56 +00:00
|
|
|
static void mca_btl_ugni_callback_rdma_complete (mca_btl_ugni_base_frag_t *frag, int rc)
|
2012-04-19 21:51:55 +00:00
|
|
|
{
|
|
|
|
BTL_VERBOSE(("rdma operation for rem_ctx %p complete", frag->hdr.rdma.ctx));
|
|
|
|
|
2012-06-29 15:43:29 +00:00
|
|
|
/* tell peer the get is complete */
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
rc = opal_mca_btl_ugni_smsg_send (frag, &frag->hdr.rdma, sizeof (frag->hdr.rdma),
|
2012-04-19 21:51:55 +00:00
|
|
|
NULL, 0, MCA_BTL_UGNI_TAG_RDMA_COMPLETE);
|
|
|
|
if (OPAL_UNLIKELY(0 > rc)) {
|
|
|
|
/* call this callback again later */
|
|
|
|
frag->cbfunc = mca_btl_ugni_callback_rdma_complete;
|
|
|
|
opal_list_append (&frag->endpoint->btl->failed_frags, (opal_list_item_t *) frag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* eager get */
|
|
|
|
static void mca_btl_ugni_callback_eager_get_retry (mca_btl_ugni_base_frag_t *frag, int rc)
|
|
|
|
{
|
|
|
|
(void) mca_btl_ugni_start_eager_get(frag->endpoint, frag->hdr.eager_ex, frag);
|
|
|
|
}
|
|
|
|
|
2012-06-29 15:43:29 +00:00
|
|
|
static void mca_btl_ugni_callback_eager_get (mca_btl_ugni_base_frag_t *frag, int rc)
|
2012-04-19 21:51:55 +00:00
|
|
|
{
|
|
|
|
uint32_t len = frag->hdr.eager.send.lag & 0x00ffffff;
|
|
|
|
uint8_t tag = frag->hdr.eager.send.lag >> 24;
|
2012-06-29 15:43:29 +00:00
|
|
|
size_t payload_len = frag->hdr.eager.src_seg.base.seg_len;
|
2012-04-19 21:51:55 +00:00
|
|
|
size_t hdr_len = len - payload_len;
|
|
|
|
mca_btl_active_message_callback_t *reg;
|
2012-06-21 17:09:12 +00:00
|
|
|
mca_btl_base_segment_t segs[2];
|
2012-04-19 21:51:55 +00:00
|
|
|
mca_btl_ugni_base_frag_t tmp;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("eager get for rem_ctx %p complete", frag->hdr.eager.ctx));
|
|
|
|
|
2014-07-10 16:31:15 +00:00
|
|
|
tmp.base.des_local = segs;
|
2012-05-07 17:23:06 +00:00
|
|
|
if (hdr_len) {
|
2014-07-10 16:31:15 +00:00
|
|
|
tmp.base.des_local_count = 2;
|
2012-05-07 17:23:06 +00:00
|
|
|
|
2012-06-21 17:09:12 +00:00
|
|
|
segs[0].seg_addr.pval = frag->hdr.eager_ex.pml_header;
|
|
|
|
segs[0].seg_len = hdr_len;
|
|
|
|
segs[1].seg_addr.pval = frag->segments[0].base.seg_addr.pval;
|
|
|
|
segs[1].seg_len = payload_len;
|
2012-05-07 17:23:06 +00:00
|
|
|
} else {
|
2014-07-10 16:31:15 +00:00
|
|
|
tmp.base.des_local_count = 1;
|
2012-05-07 17:23:06 +00:00
|
|
|
|
2012-06-21 17:09:12 +00:00
|
|
|
segs[0].seg_addr.pval = frag->segments[0].base.seg_addr.pval;
|
|
|
|
segs[0].seg_len = payload_len;
|
2012-05-07 17:23:06 +00:00
|
|
|
}
|
2012-04-19 21:51:55 +00:00
|
|
|
|
|
|
|
reg = mca_btl_base_active_message_trigger + tag;
|
|
|
|
reg->cbfunc(&frag->endpoint->btl->super, tag, &(tmp.base), reg->cbdata);
|
|
|
|
|
|
|
|
frag->hdr.rdma.ctx = frag->hdr.eager.ctx;
|
|
|
|
|
|
|
|
/* tell the remote peer the operation is complete */
|
|
|
|
mca_btl_ugni_callback_rdma_complete (frag, rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_btl_ugni_start_eager_get (mca_btl_base_endpoint_t *ep,
|
|
|
|
mca_btl_ugni_eager_ex_frag_hdr_t hdr,
|
|
|
|
mca_btl_ugni_base_frag_t *frag)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(frag && frag->my_list == &ep->btl->rdma_int_frags)) {
|
|
|
|
mca_btl_ugni_frag_return (frag);
|
|
|
|
frag = NULL;
|
|
|
|
}
|
|
|
|
|
2012-04-25 14:24:48 +00:00
|
|
|
BTL_VERBOSE(("starting eager get for remote ctx: %p", hdr.eager.ctx));
|
2012-04-19 21:51:55 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
if (NULL == frag) {
|
|
|
|
rc = MCA_BTL_UGNI_FRAG_ALLOC_EAGER_RECV(ep, frag);
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
(void) MCA_BTL_UGNI_FRAG_ALLOC_RDMA_INT(ep, frag);
|
|
|
|
assert (NULL != frag);
|
|
|
|
frag->hdr.eager_ex = hdr;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
frag->hdr.eager_ex = hdr;
|
2012-06-29 15:43:29 +00:00
|
|
|
frag->flags = 0;
|
2012-04-19 21:51:55 +00:00
|
|
|
|
2012-06-29 15:43:29 +00:00
|
|
|
frag->base.des_flags = MCA_BTL_DES_FLAGS_BTL_OWNERSHIP;
|
2012-04-19 21:51:55 +00:00
|
|
|
|
2012-06-29 15:43:29 +00:00
|
|
|
frag->segments[1] = hdr.eager.src_seg;
|
2012-04-19 21:51:55 +00:00
|
|
|
|
|
|
|
/* increase size to a multiple of 4 bytes (required for get) */
|
2012-06-21 17:09:12 +00:00
|
|
|
frag->segments[0].base.seg_len = frag->segments[1].base.seg_len =
|
2012-06-29 15:43:29 +00:00
|
|
|
(hdr.eager.src_seg.base.seg_len + 3) & ~3;
|
2012-04-19 21:51:55 +00:00
|
|
|
|
2014-07-22 15:42:11 +00:00
|
|
|
frag->base.des_local = &frag->segments[1].base;
|
2012-06-29 15:43:29 +00:00
|
|
|
|
|
|
|
rc = mca_btl_ugni_post_wcb (frag, GNI_POST_RDMA_GET, frag->segments, frag->segments + 1,
|
|
|
|
mca_btl_ugni_callback_eager_get);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS == rc)) {
|
|
|
|
return OPAL_SUCCESS;
|
2012-04-19 21:51:55 +00:00
|
|
|
}
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
frag->cbfunc = mca_btl_ugni_callback_eager_get_retry;
|
|
|
|
opal_list_append (&ep->btl->failed_frags, (opal_list_item_t *) frag);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|