fixed bug in frag initialization
This commit was SVN r25373.
Этот коммит содержится в:
родитель
6fdb040eef
Коммит
033179d6ac
@ -145,7 +145,7 @@ static void vader_init_maffinity (int *my_mem_node)
|
||||
/* no topology info available */
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
asprintf(&myslot, "slot%d", socket);
|
||||
|
||||
slot_node = opal_carto_base_find_node(topo, myslot);
|
||||
@ -569,13 +569,22 @@ static mca_btl_base_descriptor_t *vader_alloc(struct mca_btl_base_module_t *btl,
|
||||
mca_btl_vader_frag_t *frag = NULL;
|
||||
int rc;
|
||||
|
||||
if(size <= mca_btl_vader_component.eager_limit) {
|
||||
if (size <= mca_btl_vader_max_inline_send) {
|
||||
MCA_BTL_VADER_FRAG_ALLOC_USER(frag, rc);
|
||||
} else if (size <= mca_btl_vader_component.eager_limit) {
|
||||
MCA_BTL_VADER_FRAG_ALLOC_EAGER(frag, rc);
|
||||
}
|
||||
|
||||
if (OPAL_LIKELY(frag != NULL)) {
|
||||
frag->segment.seg_len = size;
|
||||
frag->base.des_flags = flags;
|
||||
frag->endpoint = endpoint;
|
||||
|
||||
frag->base.des_flags = flags;
|
||||
frag->base.order = order;
|
||||
frag->base.des_src = &frag->segment;
|
||||
frag->base.des_src_cnt = 1;
|
||||
frag->base.des_dst = &frag->segment;
|
||||
frag->base.des_src_cnt = 1;
|
||||
}
|
||||
|
||||
return (mca_btl_base_descriptor_t *) frag;
|
||||
@ -602,6 +611,7 @@ struct mca_btl_base_descriptor_t *vader_prepare_dst(struct mca_btl_base_module_t
|
||||
uint32_t flags)
|
||||
{
|
||||
mca_btl_vader_frag_t *frag;
|
||||
void *data_ptr;
|
||||
int rc;
|
||||
|
||||
MCA_BTL_VADER_FRAG_ALLOC_USER(frag, rc);
|
||||
@ -609,15 +619,17 @@ struct mca_btl_base_descriptor_t *vader_prepare_dst(struct mca_btl_base_module_t
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opal_convertor_get_current_pointer (convertor, (void **) &frag->segment.seg_addr.pval);
|
||||
frag->segment.seg_key.ptr = (uintptr_t) frag->segment.seg_addr.pval;
|
||||
frag->segment.seg_len = *size;
|
||||
opal_convertor_get_current_pointer (convertor, (void **) &data_ptr);
|
||||
|
||||
frag->segment.seg_key.ptr = (uintptr_t) data_ptr;
|
||||
frag->segment.seg_len = *size;
|
||||
|
||||
frag->base.des_src = NULL;
|
||||
frag->base.des_src_cnt = 0;
|
||||
frag->base.des_dst = &frag->segment;
|
||||
frag->base.des_dst = &frag->segment;
|
||||
frag->base.des_dst_cnt = 1;
|
||||
frag->base.des_flags = flags;
|
||||
frag->base.order = order;
|
||||
frag->base.des_flags = flags;
|
||||
|
||||
frag->endpoint = endpoint;
|
||||
|
||||
return &frag->base;
|
||||
}
|
||||
@ -634,57 +646,58 @@ static struct mca_btl_base_descriptor_t *vader_prepare_src (struct mca_btl_base_
|
||||
uint8_t order, size_t reserve, size_t *size,
|
||||
uint32_t flags)
|
||||
{
|
||||
struct iovec iov, *lcl_mem;
|
||||
mca_btl_vader_frag_t *frag;
|
||||
uint32_t iov_count = 1;
|
||||
void *data_ptr;
|
||||
struct iovec iov, *lcl_mem;
|
||||
int rc;
|
||||
|
||||
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
||||
|
||||
if (OPAL_LIKELY(reserve)) {
|
||||
/* in place send fragment */
|
||||
if (OPAL_UNLIKELY(opal_convertor_need_buffers(convertor)) ||
|
||||
(*size + reserve) < mca_btl_vader_max_inline_send) {
|
||||
if (OPAL_UNLIKELY(opal_convertor_need_buffers(convertor))) {
|
||||
/* non-contiguous data requires the convertor */
|
||||
MCA_BTL_VADER_FRAG_ALLOC_EAGER(frag,rc);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (OPAL_UNLIKELY(opal_convertor_need_buffers(convertor))) {
|
||||
iov.iov_len = mca_btl_vader_component.eager_limit - reserve;
|
||||
iov.iov_base =
|
||||
(IOVBASE_TYPE *)(((uintptr_t)(frag->segment.seg_addr.pval)) +
|
||||
reserve);
|
||||
iov.iov_len = mca_btl_vader_component.eager_limit - reserve;
|
||||
iov.iov_base =
|
||||
(IOVBASE_TYPE *)(((uintptr_t)(frag->segment.seg_addr.pval)) +
|
||||
reserve);
|
||||
|
||||
rc = opal_convertor_pack (convertor, &iov, &iov_count, size);
|
||||
if (OPAL_UNLIKELY(rc < 0)) {
|
||||
MCA_BTL_VADER_FRAG_RETURN(frag);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
/* NTH: the covertor adds some latency so we bypass it if possible */
|
||||
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
||||
memmove ((void *)((uintptr_t)frag->segment.seg_addr.pval + reserve), data_ptr, *size);
|
||||
rc = opal_convertor_pack (convertor, &iov, &iov_count, size);
|
||||
if (OPAL_UNLIKELY(rc < 0)) {
|
||||
MCA_BTL_VADER_FRAG_RETURN(frag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
frag->segment.seg_len = reserve + *size;
|
||||
} else {
|
||||
/* single copy send */
|
||||
MCA_BTL_VADER_FRAG_ALLOC_USER(frag, rc);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* pack the iovec after the reserved memory */
|
||||
lcl_mem = (struct iovec *) ((uintptr_t)(frag->hdr + 1) + reserve);
|
||||
if ((*size + reserve) < mca_btl_vader_max_inline_send) {
|
||||
/* inline send */
|
||||
/* NTH: the covertor adds some latency so we bypass it here */
|
||||
memmove ((void *)((uintptr_t)frag->segment.seg_addr.pval + reserve), data_ptr, *size);
|
||||
frag->segment.seg_len = reserve + *size;
|
||||
} else {
|
||||
/* single copy send */
|
||||
/* pack the iovec after the reserved memory */
|
||||
lcl_mem = (struct iovec *) ((uintptr_t)frag->segment.seg_addr.pval + reserve);
|
||||
|
||||
frag->hdr->flags = MCA_BTL_VADER_FLAG_SINGLE_COPY;
|
||||
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
||||
frag->hdr->flags = MCA_BTL_VADER_FLAG_SINGLE_COPY;
|
||||
|
||||
lcl_mem->iov_base = data_ptr;
|
||||
lcl_mem->iov_len = *size;
|
||||
lcl_mem->iov_base = data_ptr;
|
||||
lcl_mem->iov_len = *size;
|
||||
|
||||
frag->segment.seg_len = reserve;
|
||||
frag->segment.seg_len = reserve;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* put/get fragment */
|
||||
@ -693,16 +706,16 @@ static struct mca_btl_base_descriptor_t *vader_prepare_src (struct mca_btl_base_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
opal_convertor_get_current_pointer (convertor, (void **) &frag->segment.seg_key.ptr);
|
||||
frag->segment.seg_key.ptr = (uintptr_t) data_ptr;
|
||||
frag->segment.seg_len = *size;
|
||||
}
|
||||
|
||||
frag->base.des_src = &frag->segment;
|
||||
frag->base.des_src = &frag->segment;
|
||||
frag->base.des_src_cnt = 1;
|
||||
frag->base.order = MCA_BTL_NO_ORDER;
|
||||
frag->base.des_dst = NULL;
|
||||
frag->base.des_dst_cnt = 0;
|
||||
frag->base.des_flags = flags;
|
||||
frag->base.order = order;
|
||||
frag->base.des_flags = flags;
|
||||
|
||||
frag->endpoint = endpoint;
|
||||
|
||||
return &frag->base;
|
||||
}
|
||||
|
@ -29,16 +29,9 @@ static inline void mca_btl_vader_frag_constructor (mca_btl_vader_frag_t *frag)
|
||||
{
|
||||
frag->hdr = (mca_btl_vader_hdr_t*)frag->base.super.ptr;
|
||||
if(frag->hdr != NULL) {
|
||||
frag->segment.seg_addr.pval = ((char*)frag->hdr) +
|
||||
sizeof(mca_btl_vader_hdr_t);
|
||||
frag->segment.seg_addr.pval = (char *)(frag->hdr + 1);
|
||||
frag->hdr->my_smp_rank = mca_btl_vader_component.my_smp_rank;
|
||||
}
|
||||
frag->segment.seg_len = 0;
|
||||
frag->base.des_src = &frag->segment;
|
||||
frag->base.des_src_cnt = 1;
|
||||
frag->base.des_dst = &frag->segment;
|
||||
frag->base.des_dst_cnt = 1;
|
||||
frag->base.des_flags = 0;
|
||||
}
|
||||
|
||||
OBJ_CLASS_INSTANCE(mca_btl_vader_frag_t, mca_btl_base_descriptor_t,
|
||||
|
@ -57,12 +57,13 @@ typedef struct mca_btl_vader_frag_t mca_btl_vader_frag_t;
|
||||
OBJ_CLASS_DECLARATION(mca_btl_vader_frag_t);
|
||||
|
||||
#define MCA_BTL_VADER_FRAG_ALLOC_EAGER(frag, rc) \
|
||||
do { \
|
||||
do { \
|
||||
ompi_free_list_item_t *item; \
|
||||
OMPI_FREE_LIST_GET(&mca_btl_vader_component.vader_frags_eager, item, rc); \
|
||||
frag = (mca_btl_vader_frag_t *) item; \
|
||||
frag->hdr->complete = false; \
|
||||
frag->hdr->flags = MCA_BTL_VADER_FLAG_INLINE; \
|
||||
frag->hdr->len = 0; \
|
||||
frag->my_list = &mca_btl_vader_component.vader_frags_eager; \
|
||||
} while (0)
|
||||
|
||||
@ -72,11 +73,13 @@ OBJ_CLASS_DECLARATION(mca_btl_vader_frag_t);
|
||||
OMPI_FREE_LIST_GET(&mca_btl_vader_component.vader_frags_user, item, rc); \
|
||||
frag = (mca_btl_vader_frag_t *) item; \
|
||||
frag->hdr->complete = false; \
|
||||
frag->hdr->flags = MCA_BTL_VADER_FLAG_INLINE; \
|
||||
frag->hdr->len = 0; \
|
||||
frag->my_list = &mca_btl_vader_component.vader_frags_user; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define MCA_BTL_VADER_FRAG_RETURN(frag) \
|
||||
OMPI_FREE_LIST_RETURN((frag)->my_list, (ompi_free_list_item_t *)(frag)); \
|
||||
OMPI_FREE_LIST_RETURN((frag)->my_list, (ompi_free_list_item_t *)(frag))
|
||||
|
||||
#endif /* MCA_BTL_VADER_SEND_FRAG_H */
|
||||
|
@ -44,9 +44,9 @@ int mca_btl_vader_get (struct mca_btl_base_module_t *btl,
|
||||
|
||||
if (OPAL_LIKELY((uintptr_t)rem_ptr != src->seg_key.ptr) &&
|
||||
src->seg_len >= mca_btl_vader_memcpy_limit) {
|
||||
memcpy (dst->seg_addr.pval, rem_ptr, size);
|
||||
memcpy ((void *) dst->seg_key.ptr, rem_ptr, size);
|
||||
} else {
|
||||
memmove (dst->seg_addr.pval, rem_ptr, size);
|
||||
memmove ((void *) dst->seg_key.ptr, rem_ptr, size);
|
||||
}
|
||||
|
||||
vader_return_registration (reg, endpoint->peer_smp_rank);
|
||||
|
@ -45,8 +45,6 @@ int mca_btl_vader_send (struct mca_btl_base_module_t *btl,
|
||||
/* type of message, pt-2-pt, one-sided, etc */
|
||||
frag->hdr->tag = tag;
|
||||
|
||||
frag->endpoint = endpoint;
|
||||
|
||||
opal_list_append (&mca_btl_vader_component.active_sends, (opal_list_item_t *) frag);
|
||||
|
||||
/* post the relative address of the descriptor into the peer's fifo */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user