2012-04-24 01:11:57 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2015-01-06 02:03:15 +03:00
|
|
|
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
|
2012-04-24 01:11:57 +04:00
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(MCA_BTL_UGNI_PREPARE_H)
|
|
|
|
#define MCA_BTL_UGNI_PREPARE_H
|
|
|
|
|
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 04:47:28 +04:00
|
|
|
#include "opal_config.h"
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
#include "btl_ugni.h"
|
|
|
|
#include "btl_ugni_frag.h"
|
|
|
|
|
2014-01-22 00:53:35 +04:00
|
|
|
static inline struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_ugni_prepare_src_send_nodata (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
uint8_t order, size_t reserve,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
mca_btl_ugni_base_frag_t *frag = NULL;
|
|
|
|
|
|
|
|
(void) MCA_BTL_UGNI_FRAG_ALLOC_RDMA(endpoint, frag);
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-01-22 01:02:28 +04:00
|
|
|
BTL_VERBOSE(("preparing src for send fragment. size = %u", (unsigned int) reserve));
|
2014-01-22 00:53:35 +04:00
|
|
|
|
|
|
|
frag->hdr_size = reserve + sizeof (frag->hdr.send);
|
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_addr.pval = frag->hdr.send_ex.pml_header;
|
|
|
|
frag->segments[0].seg_len = reserve;
|
2014-01-22 00:53:35 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[1].seg_addr.pval = NULL;
|
|
|
|
frag->segments[1].seg_len = 0;
|
2014-01-22 00:53:35 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->base.des_segments = frag->segments;
|
|
|
|
frag->base.des_segment_count = 1;
|
2014-07-10 20:31:15 +04:00
|
|
|
frag->base.order = order;
|
|
|
|
frag->base.des_flags = flags;
|
2014-01-22 00:53:35 +04:00
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
2012-04-24 01:11:57 +04:00
|
|
|
static inline struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_ugni_prepare_src_send_inplace (struct mca_btl_base_module_t *btl,
|
2012-06-21 21:09:12 +04:00
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags)
|
2012-04-24 01:11:57 +04:00
|
|
|
{
|
|
|
|
bool use_eager_get = (*size + reserve) > mca_btl_ugni_component.smsg_max_data;
|
|
|
|
mca_btl_ugni_base_frag_t *frag = NULL;
|
|
|
|
mca_btl_ugni_reg_t *registration = NULL;
|
|
|
|
void *data_ptr;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
|
|
|
|
|
|
|
(void) MCA_BTL_UGNI_FRAG_ALLOC_RDMA(endpoint, frag);
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BTL_VERBOSE(("preparing src for send fragment. size = %u",
|
|
|
|
(unsigned int)(*size + reserve)));
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(true == use_eager_get)) {
|
|
|
|
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, data_ptr, *size, 0,
|
|
|
|
(mca_mpool_base_registration_t **)®istration);
|
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 04:47:28 +04:00
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
2012-04-24 01:11:57 +04:00
|
|
|
mca_btl_ugni_frag_return (frag);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
frag->flags = MCA_BTL_UGNI_FRAG_EAGER | MCA_BTL_UGNI_FRAG_IGNORE;
|
2012-05-07 21:23:06 +04:00
|
|
|
|
2012-04-24 01:11:57 +04:00
|
|
|
frag->registration = registration;
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->hdr.eager.memory_handle = registration->handle;;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
frag->hdr_size = reserve + sizeof (frag->hdr.eager);
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_addr.pval = frag->hdr.eager_ex.pml_header;
|
2012-04-24 01:11:57 +04:00
|
|
|
} else {
|
|
|
|
frag->hdr_size = reserve + sizeof (frag->hdr.send);
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_addr.pval = frag->hdr.send_ex.pml_header;
|
2012-04-24 01:11:57 +04:00
|
|
|
}
|
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_len = reserve;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[1].seg_addr.pval = data_ptr;
|
|
|
|
frag->segments[1].seg_len = *size;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->base.des_segments = frag->segments;
|
|
|
|
frag->base.des_segment_count = 2;
|
2014-07-10 20:31:15 +04:00
|
|
|
frag->base.order = order;
|
|
|
|
frag->base.des_flags = flags;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_ugni_prepare_src_send_buffered (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
bool use_eager_get = (*size + reserve) > mca_btl_ugni_component.smsg_max_data;
|
|
|
|
mca_btl_ugni_reg_t *registration = NULL;
|
|
|
|
mca_btl_ugni_base_frag_t *frag = NULL;
|
|
|
|
uint32_t iov_count = 1;
|
|
|
|
struct iovec iov;
|
|
|
|
int rc;
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
if (OPAL_UNLIKELY(true == use_eager_get)) {
|
2012-04-24 01:11:57 +04:00
|
|
|
(void) MCA_BTL_UGNI_FRAG_ALLOC_EAGER_SEND(endpoint, frag);
|
2012-05-07 21:23:06 +04:00
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
frag->flags = MCA_BTL_UGNI_FRAG_EAGER | MCA_BTL_UGNI_FRAG_IGNORE;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
registration = (mca_btl_ugni_reg_t *) frag->base.super.registration;
|
2012-05-07 21:23:06 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->hdr.eager.memory_handle = registration->handle;
|
2012-04-24 01:11:57 +04:00
|
|
|
frag->hdr_size = reserve + sizeof (frag->hdr.eager);
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_addr.pval = frag->hdr.eager_ex.pml_header;
|
2012-04-24 01:11:57 +04:00
|
|
|
} else {
|
2012-05-07 21:23:06 +04:00
|
|
|
(void) MCA_BTL_UGNI_FRAG_ALLOC_SMSG(endpoint, frag);
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-04-24 01:11:57 +04:00
|
|
|
frag->hdr_size = reserve + sizeof (frag->hdr.send);
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_addr.pval = frag->hdr.send_ex.pml_header;
|
2012-04-24 01:11:57 +04:00
|
|
|
}
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
frag->flags |= MCA_BTL_UGNI_FRAG_BUFFERED;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2014-01-22 00:53:35 +04:00
|
|
|
iov.iov_len = *size;
|
|
|
|
iov.iov_base = (IOVBASE_TYPE *) frag->base.super.ptr;
|
2012-06-21 03:01:37 +04:00
|
|
|
|
2014-01-22 00:53:35 +04:00
|
|
|
rc = opal_convertor_pack (convertor, &iov, &iov_count, size);
|
|
|
|
if (OPAL_UNLIKELY(rc < 0)) {
|
|
|
|
mca_btl_ugni_frag_return (frag);
|
|
|
|
return NULL;
|
2012-05-07 21:23:06 +04:00
|
|
|
}
|
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[0].seg_len = reserve;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->segments[1].seg_addr.pval = frag->base.super.ptr;
|
|
|
|
frag->segments[1].seg_len = *size;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
2015-01-06 02:03:15 +03:00
|
|
|
frag->base.des_segments = frag->segments;
|
|
|
|
frag->base.des_segment_count = 2;
|
2014-07-10 20:31:15 +04:00
|
|
|
frag->base.order = order;
|
|
|
|
frag->base.des_flags = flags;
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_ugni_prepare_src_send (struct mca_btl_base_module_t *btl,
|
2012-06-21 21:09:12 +04:00
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags)
|
2012-04-24 01:11:57 +04:00
|
|
|
{
|
|
|
|
bool use_eager_get = (*size + reserve) > mca_btl_ugni_component.smsg_max_data;
|
|
|
|
bool send_in_place;
|
|
|
|
void *data_ptr;
|
|
|
|
|
2014-01-22 00:53:35 +04:00
|
|
|
if (!(*size)) {
|
|
|
|
return mca_btl_ugni_prepare_src_send_nodata (btl, endpoint, order, reserve, flags);
|
|
|
|
}
|
|
|
|
|
2012-04-24 01:11:57 +04:00
|
|
|
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
|
|
|
|
2012-06-29 19:43:29 +04:00
|
|
|
send_in_place = !(opal_convertor_need_buffers(convertor) ||
|
2012-04-24 01:11:57 +04:00
|
|
|
(use_eager_get && ((uintptr_t)data_ptr & 3)));
|
|
|
|
|
|
|
|
if (send_in_place) {
|
|
|
|
return mca_btl_ugni_prepare_src_send_inplace (btl, endpoint, convertor, order,
|
|
|
|
reserve, size, flags);
|
|
|
|
} else {
|
|
|
|
return mca_btl_ugni_prepare_src_send_buffered (btl, endpoint, convertor, order,
|
|
|
|
reserve, size, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|