ugni: use hash table to keep track of smsg frag completion
This commit was SVN r26153.
Этот коммит содержится в:
родитель
deddf0b33e
Коммит
fca42347e3
@ -27,6 +27,7 @@
|
||||
#include "ompi/runtime/ompi_module_exchange.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal_stdint.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
|
||||
#include "ompi/mca/btl/btl.h"
|
||||
#include "ompi/mca/btl/base/base.h"
|
||||
@ -69,6 +70,17 @@ typedef struct mca_btl_ugni_module_t {
|
||||
/* eager (registered) fragment list */
|
||||
ompi_free_list_t eager_frags_send;
|
||||
ompi_free_list_t eager_frags_recv;
|
||||
|
||||
/* SMSG fragment list (unregistered) */
|
||||
ompi_free_list_t smsg_frags;
|
||||
|
||||
/* RDMA fragment list */
|
||||
ompi_free_list_t rdma_frags;
|
||||
ompi_free_list_t rdma_int_frags;
|
||||
|
||||
/* fragment buffer (for message if lookup) */
|
||||
opal_hash_table_t pending_smsg_frags;
|
||||
int32_t next_frag_id;
|
||||
} mca_btl_ugni_module_t;
|
||||
|
||||
typedef struct mca_btl_ugni_component_t {
|
||||
@ -94,11 +106,6 @@ typedef struct mca_btl_ugni_component_t {
|
||||
/* Switch to get when sending above this size */
|
||||
size_t ugni_smsg_limit;
|
||||
|
||||
/* SMSG fragment list (unregistered) */
|
||||
ompi_free_list_t ugni_frags_smsg;
|
||||
/* RDMA fragment list */
|
||||
ompi_free_list_t ugni_frags_rdma;
|
||||
|
||||
/* RDMA/SMSG free list settings */
|
||||
int ugni_free_list_num;
|
||||
int ugni_free_list_max;
|
||||
|
@ -113,18 +113,15 @@ int mca_btl_ugni_del_procs (struct mca_btl_base_module_t *btl,
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
static int ugni_reg_mem (void *reg_data, void *base, size_t size,
|
||||
mca_mpool_base_registration_t *reg)
|
||||
static inline int ugni_reg_mem (mca_btl_ugni_module_t *btl, void *base,
|
||||
size_t size, mca_mpool_base_registration_t *reg,
|
||||
gni_cq_handle_t cq, uint32_t flags)
|
||||
{
|
||||
mca_btl_ugni_module_t *btl = (mca_btl_ugni_module_t *) reg_data;
|
||||
mca_btl_ugni_reg_t *ugni_reg = (mca_btl_ugni_reg_t *) reg;
|
||||
int rc;
|
||||
|
||||
gni_return_t rc;
|
||||
|
||||
rc = GNI_MemRegister (btl->device->dev_handle, (uint64_t) base,
|
||||
size, NULL, GNI_MEM_READWRITE |
|
||||
GNI_MEM_RELAXED_PI_ORDERING, -1,
|
||||
&(ugni_reg->memory_hdl));
|
||||
|
||||
size, cq, flags, -1, &(ugni_reg->memory_hdl));
|
||||
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != rc)) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
@ -132,22 +129,21 @@ static int ugni_reg_mem (void *reg_data, void *base, size_t size,
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
static int ugni_reg_rdma_mem (void *reg_data, void *base, size_t size,
|
||||
mca_mpool_base_registration_t *reg)
|
||||
{
|
||||
return ugni_reg_mem ((mca_btl_ugni_module_t *) reg_data, base, size, reg,
|
||||
NULL, GNI_MEM_READWRITE | GNI_MEM_RELAXED_PI_ORDERING);
|
||||
}
|
||||
|
||||
|
||||
static int ugni_reg_smsg_mem (void *reg_data, void *base, size_t size,
|
||||
mca_mpool_base_registration_t *reg)
|
||||
{
|
||||
mca_btl_ugni_module_t *btl = (mca_btl_ugni_module_t *) reg_data;
|
||||
mca_btl_ugni_reg_t *ugni_reg = (mca_btl_ugni_reg_t *) reg;
|
||||
int rc;
|
||||
|
||||
rc = GNI_MemRegister (btl->device->dev_handle, (uint64_t)base,
|
||||
size, btl->smsg_remote_cq, GNI_MEM_READWRITE,
|
||||
-1, &(ugni_reg->memory_hdl));
|
||||
|
||||
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != rc)) {
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
return ugni_reg_mem (btl, base, size, reg, btl->smsg_remote_cq,
|
||||
GNI_MEM_READWRITE);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -155,7 +151,7 @@ ugni_dereg_mem (void *reg_data, mca_mpool_base_registration_t *reg)
|
||||
{
|
||||
mca_btl_ugni_module_t *btl = (mca_btl_ugni_module_t *) reg_data;
|
||||
mca_btl_ugni_reg_t *ugni_reg = (mca_btl_ugni_reg_t *)reg;
|
||||
int rc;
|
||||
gni_return_t rc;
|
||||
|
||||
rc = GNI_MemDeregister (btl->device->dev_handle, &ugni_reg->memory_hdl);
|
||||
if (GNI_RC_SUCCESS != rc) {
|
||||
@ -172,42 +168,60 @@ mca_btl_ugni_setup_mpools (mca_btl_ugni_module_t *ugni_module)
|
||||
int mbox_increment, rc;
|
||||
size_t nprocs;
|
||||
|
||||
rc = opal_hash_table_init (&ugni_module->pending_smsg_frags, 1024);
|
||||
if (OPAL_SUCCESS != rc) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
(void) ompi_proc_world (&nprocs);
|
||||
|
||||
rc = ompi_free_list_init_new (&mca_btl_ugni_component.ugni_frags_smsg,
|
||||
sizeof (mca_btl_ugni_smsg_frag_t),
|
||||
opal_cache_line_size, OBJ_CLASS(mca_btl_ugni_smsg_frag_t),
|
||||
mca_btl_ugni_component.ugni_smsg_limit,
|
||||
opal_cache_line_size,
|
||||
mca_btl_ugni_component.ugni_free_list_num,
|
||||
mca_btl_ugni_component.ugni_free_list_max,
|
||||
mca_btl_ugni_component.ugni_free_list_inc,
|
||||
NULL);
|
||||
rc = ompi_free_list_init_ex_new (&ugni_module->smsg_frags,
|
||||
sizeof (mca_btl_ugni_smsg_frag_t),
|
||||
opal_cache_line_size, OBJ_CLASS(mca_btl_ugni_smsg_frag_t),
|
||||
mca_btl_ugni_component.ugni_smsg_limit,
|
||||
opal_cache_line_size,
|
||||
mca_btl_ugni_component.ugni_free_list_num,
|
||||
mca_btl_ugni_component.ugni_free_list_max,
|
||||
mca_btl_ugni_component.ugni_free_list_inc,
|
||||
NULL, (ompi_free_list_item_init_fn_t) mca_btl_ugni_frag_init,
|
||||
(void *) ugni_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
BTL_ERROR(("error creating smsg fragment free list"));
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ompi_free_list_init_ex_new (&ugni_module->rdma_frags,
|
||||
sizeof (mca_btl_ugni_rdma_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_rdma_frag_t),
|
||||
0, opal_cache_line_size,
|
||||
mca_btl_ugni_component.ugni_free_list_num,
|
||||
mca_btl_ugni_component.ugni_free_list_max,
|
||||
mca_btl_ugni_component.ugni_free_list_inc,
|
||||
NULL, (ompi_free_list_item_init_fn_t) mca_btl_ugni_frag_init,
|
||||
(void *) ugni_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ompi_free_list_init_new (&mca_btl_ugni_component.ugni_frags_rdma,
|
||||
sizeof (mca_btl_ugni_rdma_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_rdma_frag_t),
|
||||
0, opal_cache_line_size,
|
||||
mca_btl_ugni_component.ugni_free_list_num,
|
||||
mca_btl_ugni_component.ugni_free_list_max,
|
||||
mca_btl_ugni_component.ugni_free_list_inc,
|
||||
NULL);
|
||||
rc = ompi_free_list_init_ex_new (&ugni_module->rdma_int_frags,
|
||||
sizeof (mca_btl_ugni_rdma_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_rdma_frag_t),
|
||||
0, opal_cache_line_size, 0, -1, 64,
|
||||
NULL, (ompi_free_list_item_init_fn_t) mca_btl_ugni_frag_init,
|
||||
(void *) ugni_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
mpool_resources.reg_data = (void *) ugni_module;
|
||||
mpool_resources.sizeof_reg = sizeof (mca_btl_ugni_reg_t);
|
||||
mpool_resources.register_mem = ugni_reg_mem;
|
||||
mpool_resources.register_mem = ugni_reg_rdma_mem;
|
||||
mpool_resources.deregister_mem = ugni_dereg_mem;
|
||||
ugni_module->super.btl_mpool =
|
||||
mca_mpool_base_module_create("rdma", ugni_module->device,
|
||||
&mpool_resources);
|
||||
if (NULL == ugni_module->super.btl_mpool) {
|
||||
BTL_ERROR(("error creating mpool"));
|
||||
BTL_ERROR(("error creating rdma mpool"));
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
@ -217,31 +231,33 @@ mca_btl_ugni_setup_mpools (mca_btl_ugni_module_t *ugni_module)
|
||||
mca_mpool_base_module_create("rdma", ugni_module->device,
|
||||
&mpool_resources);
|
||||
|
||||
OBJ_CONSTRUCT(&ugni_module->eager_frags_send, ompi_free_list_t);
|
||||
|
||||
rc = ompi_free_list_init_new (&ugni_module->eager_frags_send,
|
||||
sizeof (mca_btl_ugni_eager_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_eager_frag_t),
|
||||
ugni_module->super.btl_eager_limit, 64,
|
||||
mca_btl_ugni_component.ugni_eager_num,
|
||||
mca_btl_ugni_component.ugni_eager_max,
|
||||
mca_btl_ugni_component.ugni_eager_inc,
|
||||
ugni_module->super.btl_mpool);
|
||||
rc = ompi_free_list_init_ex_new (&ugni_module->eager_frags_send,
|
||||
sizeof (mca_btl_ugni_eager_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_eager_frag_t),
|
||||
ugni_module->super.btl_eager_limit, 64,
|
||||
mca_btl_ugni_component.ugni_eager_num,
|
||||
mca_btl_ugni_component.ugni_eager_max,
|
||||
mca_btl_ugni_component.ugni_eager_inc,
|
||||
ugni_module->super.btl_mpool,
|
||||
(ompi_free_list_item_init_fn_t) mca_btl_ugni_frag_init,
|
||||
(void *) ugni_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
BTL_ERROR(("error creating eager send fragment free list"));
|
||||
return rc;
|
||||
}
|
||||
|
||||
OBJ_CONSTRUCT(&ugni_module->eager_frags_recv, ompi_free_list_t);
|
||||
|
||||
rc = ompi_free_list_init_new (&ugni_module->eager_frags_recv,
|
||||
sizeof (mca_btl_ugni_eager_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_eager_frag_t),
|
||||
ugni_module->super.btl_eager_limit, 64,
|
||||
mca_btl_ugni_component.ugni_eager_num,
|
||||
mca_btl_ugni_component.ugni_eager_max,
|
||||
mca_btl_ugni_component.ugni_eager_inc,
|
||||
ugni_module->super.btl_mpool);
|
||||
rc = ompi_free_list_init_ex_new (&ugni_module->eager_frags_recv,
|
||||
sizeof (mca_btl_ugni_eager_frag_t), 8,
|
||||
OBJ_CLASS(mca_btl_ugni_eager_frag_t),
|
||||
ugni_module->super.btl_eager_limit, 64,
|
||||
mca_btl_ugni_component.ugni_eager_num,
|
||||
mca_btl_ugni_component.ugni_eager_max,
|
||||
mca_btl_ugni_component.ugni_eager_inc,
|
||||
ugni_module->super.btl_mpool,
|
||||
(ompi_free_list_item_init_fn_t) mca_btl_ugni_frag_init,
|
||||
(void *) ugni_module);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
BTL_ERROR(("error creating eager receive fragment free list"));
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -134,9 +134,6 @@ btl_ugni_component_open(void)
|
||||
mca_btl_ugni_component.ugni_num_btls = 0;
|
||||
mca_btl_ugni_component.modules = NULL;
|
||||
|
||||
OBJ_CONSTRUCT(&mca_btl_ugni_component.ugni_frags_smsg, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&mca_btl_ugni_component.ugni_frags_rdma, ompi_free_list_t);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -148,9 +145,6 @@ btl_ugni_component_close(void)
|
||||
{
|
||||
ompi_common_ugni_fini ();
|
||||
|
||||
OBJ_DESTRUCT(&mca_btl_ugni_component.ugni_frags_smsg);
|
||||
OBJ_DESTRUCT(&mca_btl_ugni_component.ugni_frags_rdma);
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -303,16 +297,18 @@ mca_btl_ugni_component_init (int *num_btl_modules,
|
||||
return base_modules;
|
||||
}
|
||||
|
||||
static void mca_btl_ugni_callback_reverse_get (ompi_common_ugni_post_desc_t *desc, int rc)
|
||||
static void mca_btl_ugni_callback_rdma_complete (ompi_common_ugni_post_desc_t *desc, int rc)
|
||||
{
|
||||
mca_btl_ugni_base_frag_t *frag = MCA_BTL_UGNI_DESC_TO_FRAG(desc);
|
||||
|
||||
BTL_VERBOSE(("reverse get (put) for rem_ctx %p complete", frag->hdr.rdma.ctx));
|
||||
BTL_VERBOSE(("rdma operation for rem_ctx %p complete", frag->hdr.rdma.ctx));
|
||||
|
||||
/* tell peer the put is complete */
|
||||
rc = ompi_mca_btl_ugni_smsg_send (frag, false, &frag->hdr.rdma, sizeof (frag->hdr.rdma),
|
||||
NULL, 0, MCA_BTL_UGNI_TAG_PUT_COMPLETE);
|
||||
NULL, 0, MCA_BTL_UGNI_TAG_RDMA_COMPLETE);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
/* call this callback again later */
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_rdma_complete;
|
||||
opal_list_append (&frag->endpoint->btl->failed_frags, (opal_list_item_t *) frag);
|
||||
}
|
||||
}
|
||||
@ -329,26 +325,38 @@ static void mca_btl_ugni_callback_eager_get (ompi_common_ugni_post_desc_t *desc,
|
||||
reg = mca_btl_base_active_message_trigger + frag->hdr.eager.tag;
|
||||
reg->cbfunc(&frag->endpoint->btl->super, frag->hdr.eager.tag, &(frag->base), reg->cbdata);
|
||||
|
||||
/* tell peer the get is complete */
|
||||
rc = ompi_mca_btl_ugni_smsg_send (frag, false, &frag->hdr.eager, sizeof (frag->hdr.eager),
|
||||
NULL, 0, MCA_BTL_UGNI_TAG_GET_COMPLETE);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
opal_list_append (&frag->endpoint->btl->failed_frags, (opal_list_item_t *) frag);
|
||||
}
|
||||
frag->hdr.rdma.ctx = frag->hdr.eager.ctx;
|
||||
|
||||
/* tell the remote peer the operation is complete */
|
||||
mca_btl_ugni_callback_rdma_complete (desc, rc);
|
||||
}
|
||||
|
||||
static inline int mca_btl_ugni_start_reverse_get (mca_btl_base_endpoint_t *ep,
|
||||
mca_btl_ugni_rdma_frag_hdr_t hdr)
|
||||
mca_btl_ugni_rdma_frag_hdr_t hdr,
|
||||
mca_btl_ugni_base_frag_t *frag);
|
||||
|
||||
static void mca_btl_ugni_callback_reverse_get_retry (ompi_common_ugni_post_desc_t *desc, int rc)
|
||||
{
|
||||
mca_btl_ugni_base_frag_t *frag = MCA_BTL_UGNI_DESC_TO_FRAG(desc);
|
||||
|
||||
(void) mca_btl_ugni_start_reverse_get(frag->endpoint, frag->hdr.rdma, frag);
|
||||
}
|
||||
|
||||
static inline int mca_btl_ugni_start_reverse_get (mca_btl_base_endpoint_t *ep,
|
||||
mca_btl_ugni_rdma_frag_hdr_t hdr,
|
||||
mca_btl_ugni_base_frag_t *frag)
|
||||
{
|
||||
mca_btl_ugni_base_frag_t *frag;
|
||||
int rc;
|
||||
|
||||
BTL_VERBOSE(("starting reverse get (put) for remote ctx: %p", hdr.ctx));
|
||||
|
||||
rc = MCA_BTL_UGNI_FRAG_ALLOC_RDMA(ep, frag);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
BTL_ERROR(("error allocating rdma frag for reverse get"));
|
||||
return rc;
|
||||
if (NULL == frag) {
|
||||
rc = MCA_BTL_UGNI_FRAG_ALLOC_RDMA_INT(ep, frag);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
BTL_ERROR(("error allocating rdma frag for reverse get. rc = %d. fl_num_allocated = %d", rc,
|
||||
ep->btl->rdma_int_frags.fl_num_allocated));
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
frag->hdr.rdma = hdr;
|
||||
@ -365,70 +373,82 @@ static inline int mca_btl_ugni_start_reverse_get (mca_btl_base_endpoint_t *ep,
|
||||
frag->base.des_dst_cnt = 1;
|
||||
|
||||
rc = mca_btl_ugni_put (&ep->btl->super, ep, &frag->base);
|
||||
assert (OMPI_SUCCESS == rc);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_reverse_get_retry;
|
||||
opal_list_append (&ep->btl->failed_frags, (opal_list_item_t *) frag);
|
||||
return rc;
|
||||
}
|
||||
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_reverse_get;
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_rdma_complete;
|
||||
|
||||
return rc;
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
static inline int mca_btl_ugni_start_eager_get (mca_btl_base_endpoint_t *ep,
|
||||
mca_btl_ugni_eager_frag_hdr_t hdr);
|
||||
mca_btl_ugni_eager_frag_hdr_t hdr,
|
||||
mca_btl_ugni_base_frag_t *frag);
|
||||
|
||||
static void mca_btl_ugni_callback_eager_get_retry (ompi_common_ugni_post_desc_t *desc, int rc)
|
||||
{
|
||||
mca_btl_ugni_base_frag_t *frag = MCA_BTL_UGNI_DESC_TO_FRAG(desc);
|
||||
|
||||
(void) mca_btl_ugni_start_eager_get(frag->endpoint, frag->hdr.eager);
|
||||
|
||||
mca_btl_ugni_frag_return (frag);
|
||||
(void) mca_btl_ugni_start_eager_get(frag->endpoint, frag->hdr.eager, frag);
|
||||
}
|
||||
|
||||
|
||||
static inline int mca_btl_ugni_start_eager_get (mca_btl_base_endpoint_t *ep,
|
||||
mca_btl_ugni_eager_frag_hdr_t hdr)
|
||||
mca_btl_ugni_eager_frag_hdr_t hdr,
|
||||
mca_btl_ugni_base_frag_t *frag)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
BTL_VERBOSE(("starting eager get for remote ctx: %p", hdr.ctx));
|
||||
|
||||
rc = MCA_BTL_UGNI_FRAG_ALLOC_EAGER_RECV(ep, frag);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
(void) MCA_BTL_UGNI_FRAG_ALLOC_RDMA(ep, frag);
|
||||
assert (NULL != frag);
|
||||
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 = hdr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
frag->hdr.eager = hdr;
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_eager_get_retry;
|
||||
|
||||
opal_list_append (&ep->btl->failed_frags, (opal_list_item_t *) frag);
|
||||
return rc;
|
||||
}
|
||||
frag->base.des_cbfunc = NULL;
|
||||
frag->base.des_flags = MCA_BTL_DES_FLAGS_BTL_OWNERSHIP;
|
||||
|
||||
frag->hdr.eager = hdr;
|
||||
frag->base.des_dst = frag->segments;
|
||||
frag->base.des_dst_cnt = 1;
|
||||
|
||||
frag->base.des_cbfunc = NULL;
|
||||
frag->base.des_flags = MCA_BTL_DES_FLAGS_BTL_OWNERSHIP;
|
||||
frag->segments[1] = hdr.src_seg;
|
||||
frag->base.des_src = frag->segments + 1;
|
||||
frag->base.des_src_cnt = 1;
|
||||
|
||||
frag->base.des_dst = frag->segments;
|
||||
frag->base.des_dst_cnt = 1;
|
||||
/* increase size to a multiple of 4 bytes (required for get) */
|
||||
frag->segments[0].seg_len = (hdr.len + 3) & ~3;
|
||||
frag->segments[1].seg_len = (hdr.len + 3) & ~3;
|
||||
|
||||
frag->segments[1] = hdr.src_seg;
|
||||
frag->base.des_src = frag->segments + 1;
|
||||
frag->base.des_src_cnt = 1;
|
||||
|
||||
/* increase size to a multiple of 4 bytes (required for get) */
|
||||
frag->segments[0].seg_len = (hdr.len + 3) & ~3;
|
||||
frag->segments[1].seg_len = (hdr.len + 3) & ~3;
|
||||
|
||||
if (frag->segments[0].seg_len <= mca_btl_ugni_component.ugni_fma_limit) {
|
||||
rc = mca_btl_ugni_post_fma (frag, GNI_POST_FMA_GET, frag->base.des_dst, frag->base.des_src);
|
||||
} else {
|
||||
rc = mca_btl_ugni_post_bte (frag, GNI_POST_RDMA_GET, frag->base.des_dst, frag->base.des_src);
|
||||
}
|
||||
assert (OMPI_SUCCESS == rc);
|
||||
if (OPAL_UNLIKELY(OMPI_SUCCESS != rc)) {
|
||||
break;
|
||||
}
|
||||
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_eager_get;
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_eager_get;
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
} while (0);
|
||||
|
||||
frag->post_desc.cbfunc = mca_btl_ugni_callback_eager_get_retry;
|
||||
|
||||
opal_list_append (&ep->btl->failed_frags, (opal_list_item_t *) frag);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -484,28 +504,25 @@ mca_btl_ugni_smsg_process (mca_btl_base_endpoint_t *ep)
|
||||
frag.segments[0].seg_addr.pval = (void *)((uintptr_t)data_ptr + sizeof (mca_btl_ugni_send_frag_hdr_t));
|
||||
frag.segments[0].seg_len = frag.hdr.send.len;
|
||||
|
||||
assert (NULL != reg->cbfunc);
|
||||
|
||||
reg->cbfunc(&ep->btl->super, frag.hdr.send.tag, &(frag.base), reg->cbdata);
|
||||
|
||||
break;
|
||||
case MCA_BTL_UGNI_TAG_PUT_INIT:
|
||||
frag.hdr.rdma = ((mca_btl_ugni_rdma_frag_hdr_t *) data_ptr)[0];
|
||||
|
||||
mca_btl_ugni_start_reverse_get (ep, frag.hdr.rdma);
|
||||
break;
|
||||
case MCA_BTL_UGNI_TAG_PUT_COMPLETE:
|
||||
frag.hdr.rdma = ((mca_btl_ugni_rdma_frag_hdr_t *) data_ptr)[0];
|
||||
|
||||
mca_btl_ugni_post_frag_complete (frag.hdr.rdma.ctx, OMPI_SUCCESS);
|
||||
mca_btl_ugni_start_reverse_get (ep, frag.hdr.rdma, NULL);
|
||||
break;
|
||||
case MCA_BTL_UGNI_TAG_GET_INIT:
|
||||
frag.hdr.eager = ((mca_btl_ugni_eager_frag_hdr_t *) data_ptr)[0];
|
||||
|
||||
mca_btl_ugni_start_eager_get (ep, frag.hdr.eager);
|
||||
mca_btl_ugni_start_eager_get (ep, frag.hdr.eager, NULL);
|
||||
break;
|
||||
case MCA_BTL_UGNI_TAG_GET_COMPLETE:
|
||||
frag.hdr.eager = ((mca_btl_ugni_eager_frag_hdr_t *) data_ptr)[0];
|
||||
case MCA_BTL_UGNI_TAG_RDMA_COMPLETE:
|
||||
frag.hdr.rdma = ((mca_btl_ugni_rdma_frag_hdr_t *) data_ptr)[0];
|
||||
|
||||
mca_btl_ugni_post_frag_complete (frag.hdr.eager.ctx, OMPI_SUCCESS);
|
||||
mca_btl_ugni_post_frag_complete (frag.hdr.rdma.ctx, OMPI_SUCCESS);
|
||||
break;
|
||||
case MCA_BTL_UGNI_TAG_DISCONNECT:
|
||||
/* remote endpoint has disconnected */
|
||||
|
@ -48,3 +48,8 @@ OBJ_CLASS_INSTANCE(mca_btl_ugni_rdma_frag_t, mca_btl_base_descriptor_t,
|
||||
|
||||
OBJ_CLASS_INSTANCE(mca_btl_ugni_eager_frag_t, mca_btl_base_descriptor_t,
|
||||
mca_btl_ugni_eager_frag_constructor, mca_btl_ugni_frag_destructor);
|
||||
|
||||
void mca_btl_ugni_frag_init (mca_btl_ugni_base_frag_t *frag, mca_btl_ugni_module_t *ugni_module)
|
||||
{
|
||||
frag->msg_id = opal_atomic_add_32 (&ugni_module->next_frag_id, 1);
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ OBJ_CLASS_DECLARATION(mca_btl_ugni_smsg_frag_t);
|
||||
OBJ_CLASS_DECLARATION(mca_btl_ugni_rdma_frag_t);
|
||||
OBJ_CLASS_DECLARATION(mca_btl_ugni_eager_frag_t);
|
||||
|
||||
void mca_btl_ugni_frag_init (mca_btl_ugni_base_frag_t *frag, mca_btl_ugni_module_t *ugni_module);
|
||||
|
||||
static inline int mca_btl_ugni_frag_alloc (mca_btl_base_endpoint_t *ep,
|
||||
ompi_free_list_t *list,
|
||||
mca_btl_ugni_base_frag_t **frag)
|
||||
@ -91,9 +93,11 @@ static inline void mca_btl_ugni_frag_return (mca_btl_ugni_base_frag_t *frag)
|
||||
}
|
||||
|
||||
#define MCA_BTL_UGNI_FRAG_ALLOC_SMSG(ep, frag) \
|
||||
mca_btl_ugni_frag_alloc((ep), &mca_btl_ugni_component.ugni_frags_smsg, &(frag))
|
||||
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->smsg_frags, &(frag))
|
||||
#define MCA_BTL_UGNI_FRAG_ALLOC_RDMA(ep, frag) \
|
||||
mca_btl_ugni_frag_alloc((ep), &mca_btl_ugni_component.ugni_frags_rdma, &(frag))
|
||||
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_frags, &(frag))
|
||||
#define MCA_BTL_UGNI_FRAG_ALLOC_RDMA_INT(ep, frag) \
|
||||
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_int_frags, &(frag))
|
||||
#define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_SEND(ep, frag) \
|
||||
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->eager_frags_send, &(frag))
|
||||
#define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_RECV(ep, frag) \
|
||||
|
@ -104,9 +104,16 @@ mca_btl_ugni_module_init (mca_btl_ugni_module_t *ugni_module,
|
||||
memmove (ugni_module, &mca_btl_ugni_module, sizeof (mca_btl_ugni_module));
|
||||
|
||||
OBJ_CONSTRUCT(&ugni_module->failed_frags, opal_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->eager_frags_send, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->eager_frags_recv, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->smsg_frags, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->rdma_frags, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->rdma_int_frags, ompi_free_list_t);
|
||||
OBJ_CONSTRUCT(&ugni_module->pending_smsg_frags, opal_hash_table_t);
|
||||
|
||||
ugni_module->device = dev;
|
||||
ugni_module->endpoints = NULL;
|
||||
dev->btl_ctx = (void *) ugni_module;
|
||||
|
||||
/* create wildcard endpoint to listen for connections.
|
||||
* there is no need to bind this endpoint. */
|
||||
@ -138,6 +145,8 @@ mca_btl_ugni_module_init (mca_btl_ugni_module_t *ugni_module,
|
||||
return ompi_common_rc_ugni_to_ompi (rc);
|
||||
}
|
||||
|
||||
ugni_module->next_frag_id = 0;
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -150,6 +159,10 @@ mca_btl_ugni_module_finalize (struct mca_btl_base_module_t *btl)
|
||||
|
||||
OBJ_DESTRUCT(&ugni_module->eager_frags_send);
|
||||
OBJ_DESTRUCT(&ugni_module->eager_frags_recv);
|
||||
OBJ_DESTRUCT(&ugni_module->smsg_frags);
|
||||
OBJ_DESTRUCT(&ugni_module->rdma_frags);
|
||||
OBJ_DESTRUCT(&ugni_module->rdma_int_frags);
|
||||
OBJ_DESTRUCT(&ugni_module->pending_smsg_frags);
|
||||
|
||||
/* close all open connections and release endpoints */
|
||||
if (NULL != ugni_module->endpoints) {
|
||||
|
@ -16,28 +16,24 @@
|
||||
|
||||
void mca_btl_ugni_local_smsg_complete (void *btl_ctx, uint32_t msg_id, int rc)
|
||||
{
|
||||
mca_btl_base_endpoint_t *btl_peer = (mca_btl_base_endpoint_t *) btl_ctx;
|
||||
mca_btl_ugni_module_t *btl = (mca_btl_ugni_module_t *) btl_ctx;
|
||||
mca_btl_ugni_base_frag_t *frag;
|
||||
opal_list_item_t *item;
|
||||
int lrc;
|
||||
|
||||
for (item = opal_list_get_first (&btl_peer->pending_smsg_sends) ;
|
||||
item != opal_list_get_end (&btl_peer->pending_smsg_sends) ;
|
||||
item = opal_list_get_next (item)) {
|
||||
frag = (mca_btl_ugni_base_frag_t *) item;
|
||||
if (frag->msg_id == msg_id) {
|
||||
opal_list_remove_item (&btl_peer->pending_smsg_sends, item);
|
||||
break;
|
||||
}
|
||||
frag = NULL;
|
||||
}
|
||||
|
||||
if (!frag) {
|
||||
lrc = opal_hash_table_get_value_uint32 (&btl->pending_smsg_frags,
|
||||
msg_id, (void **) &frag);
|
||||
if (OPAL_UNLIKELY(OPAL_SUCCESS != lrc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
opal_hash_table_remove_value_uint32 (&btl->pending_smsg_frags,
|
||||
msg_id);
|
||||
|
||||
assert (NULL != frag);
|
||||
|
||||
/* completion callback */
|
||||
if (NULL != frag->base.des_cbfunc) {
|
||||
frag->base.des_cbfunc(&btl_peer->btl->super, btl_peer, &frag->base, rc);
|
||||
frag->base.des_cbfunc(&btl->super, frag->endpoint, &frag->base, rc);
|
||||
}
|
||||
|
||||
if (frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP) {
|
||||
|
@ -20,9 +20,8 @@ typedef enum {
|
||||
MCA_BTL_UGNI_TAG_SEND,
|
||||
MCA_BTL_UGNI_TAG_DISCONNECT,
|
||||
MCA_BTL_UGNI_TAG_PUT_INIT,
|
||||
MCA_BTL_UGNI_TAG_PUT_COMPLETE,
|
||||
MCA_BTL_UGNI_TAG_GET_INIT,
|
||||
MCA_BTL_UGNI_TAG_GET_COMPLETE
|
||||
MCA_BTL_UGNI_TAG_RDMA_COMPLETE
|
||||
} mca_btl_ugni_smsg_tag_t;
|
||||
|
||||
static inline int ompi_mca_btl_ugni_smsg_send (mca_btl_ugni_base_frag_t *frag,
|
||||
@ -30,18 +29,26 @@ static inline int ompi_mca_btl_ugni_smsg_send (mca_btl_ugni_base_frag_t *frag,
|
||||
void *hdr, size_t hdr_len,
|
||||
void *payload, size_t payload_len,
|
||||
mca_btl_ugni_smsg_tag_t tag) {
|
||||
static uint8_t msg_num = 0;
|
||||
gni_return_t rc;
|
||||
gni_return_t grc;
|
||||
int rc;
|
||||
|
||||
frag->msg_id = ignore_local_comp ? (uint32_t) -1 :
|
||||
(frag->endpoint->common->ep_rem_id & 0x00ffffff) | ((uint32_t)msg_num++ << 24);
|
||||
if (!ignore_local_comp) {
|
||||
rc = opal_hash_table_set_value_uint32 (&frag->endpoint->btl->pending_smsg_frags,
|
||||
frag->msg_id, (void *) frag);
|
||||
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = GNI_SmsgSendWTag (frag->endpoint->common->ep_handle, hdr, hdr_len, payload, payload_len,
|
||||
frag->msg_id, tag);
|
||||
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != rc)) {
|
||||
grc = GNI_SmsgSendWTag (frag->endpoint->common->ep_handle, hdr, hdr_len, payload, payload_len,
|
||||
ignore_local_comp ? (uint32_t)-1 : frag->msg_id, tag);
|
||||
if (OPAL_UNLIKELY(GNI_RC_SUCCESS != grc)) {
|
||||
BTL_VERBOSE(("GNI_SmsgSendWTag failed with rc = %d", rc));
|
||||
|
||||
if (OPAL_LIKELY(GNI_RC_NOT_DONE == rc)) {
|
||||
opal_hash_table_remove_value_uint32 (&frag->endpoint->btl->pending_smsg_frags,
|
||||
frag->msg_id);
|
||||
|
||||
if (OPAL_LIKELY(GNI_RC_NOT_DONE == grc)) {
|
||||
BTL_VERBOSE(("out of credits"));
|
||||
|
||||
return OMPI_ERR_OUT_OF_RESOURCE;
|
||||
@ -50,10 +57,6 @@ static inline int ompi_mca_btl_ugni_smsg_send (mca_btl_ugni_base_frag_t *frag,
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
if (false == ignore_local_comp) {
|
||||
opal_list_append (&frag->endpoint->pending_smsg_sends, (opal_list_item_t *) frag);
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user