diff --git a/oshmem/mca/spml/yoda/spml_yoda.c b/oshmem/mca/spml/yoda/spml_yoda.c index ccf55b57d7..e26b88e77b 100644 --- a/oshmem/mca/spml/yoda/spml_yoda.c +++ b/oshmem/mca/spml/yoda/spml_yoda.c @@ -1,8 +1,11 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -76,6 +79,10 @@ static int btl_name_to_id(char *btl_name) return YODA_BTL_OPENIB; } else if (0 == strcmp(btl_name, "self")) { return YODA_BTL_SELF; + } else if (0 == strcmp(btl_name, "vader")) { + return YODA_BTL_VADER; + } else if (0 == strcmp(btl_name, "ugni")) { + return YODA_BTL_UGNI; } return YODA_BTL_UNKNOWN; } @@ -91,21 +98,40 @@ static char *btl_type2str(int btl_type) return "openib"; case YODA_BTL_SM: return "sm"; + case YODA_BTL_VADER: + return "vader"; + case YODA_BTL_UGNI: + return "ugni"; } return "bad_btl_type"; } -static inline void calc_nfrags(mca_bml_base_btl_t* bml_btl, - size_t size, - unsigned int *frag_size, - int *nfrags, - int use_send) +static inline void calc_nfrags_put (mca_bml_base_btl_t* bml_btl, + size_t size, + unsigned int *frag_size, + int *nfrags, + int use_send) { if (use_send) { *frag_size = bml_btl->btl->btl_max_send_size - SPML_YODA_SEND_CONTEXT_SIZE; } else { - *frag_size = bml_btl->btl->btl_max_send_size; + *frag_size = bml_btl->btl->btl_put_limit; + } + *nfrags = 1 + (size - 1) / (*frag_size); +} + +static inline void calc_nfrags_get (mca_bml_base_btl_t* bml_btl, + size_t size, + unsigned int *frag_size, + int *nfrags, + int use_send) +{ + if (use_send) { + *frag_size = bml_btl->btl->btl_max_send_size - SPML_YODA_SEND_CONTEXT_SIZE; + } + else { + *frag_size = bml_btl->btl->btl_get_limit; } *nfrags = 1 + (size - 1) / (*frag_size); } @@ -152,7 +178,7 @@ static inline void mca_spml_yoda_bml_alloc( mca_bml_base_btl_t* bml_btl, size, flags); - if (OPAL_UNLIKELY(!(*des) || !(*des)->des_local ) && !is_fence_complete) { + if (OPAL_UNLIKELY(!(*des) || !(*des)->des_segments ) && !is_fence_complete) { mca_spml_yoda_fence_internal(mca_spml_yoda.bml_alloc_threshold); is_fence_complete = true; @@ -205,7 +231,7 @@ static void mca_yoda_put_callback(mca_btl_base_module_t* btl, size_t* size; void** l_addr; - size = (size_t *) des->des_local->seg_addr.pval; + size = (size_t *) des->des_segments->seg_addr.pval; l_addr = (void**) ( ((char*)size) + sizeof(*size)); memcpy(*l_addr, ((char*)l_addr) + sizeof(*l_addr), *size); } @@ -231,7 +257,7 @@ static void mca_yoda_get_callback(mca_btl_base_module_t* btl, putreq = NULL; /* Unpack data */ - p = (void **)des->des_local->seg_addr.pval; + p = (void **)des->des_segments->seg_addr.pval; p_src = (void*) p; size = (size_t*)((char*)p_src + sizeof(*p_src) ); @@ -252,18 +278,18 @@ static void mca_yoda_get_callback(mca_btl_base_module_t* btl, MCA_BTL_DES_SEND_ALWAYS_CALLBACK, 1); - if (OPAL_UNLIKELY(!des_loc || !des_loc->des_local)) { + if (OPAL_UNLIKELY(!des_loc || !des_loc->des_segments)) { SPML_ERROR("shmem OOM error need %d bytes", (int)*size); oshmem_shmem_abort(-1); } - spml_yoda_prepare_for_get_response((void*)des_loc->des_local->seg_addr.pval, *size, (void*)*p_src, (void*) *p_dst,(void*)*p_getreq,1); + spml_yoda_prepare_for_get_response((void*)des_loc->des_segments->seg_addr.pval, *size, (void*)*p_src, (void*) *p_dst,(void*)*p_getreq,1); frag->rdma_req = putreq; /* Initialize callback data for put*/ des_loc->des_cbdata = frag; des_loc->des_cbfunc = mca_spml_yoda_put_completion; - des_loc->des_local_count = 1; + des_loc->des_segment_count = 1; OPAL_THREAD_ADD32(&mca_spml_yoda.n_active_puts, 1); @@ -299,7 +325,7 @@ static void mca_yoda_get_response_callback(mca_btl_base_module_t* btl, mca_spml_yoda_get_request_t* getreq; /* unpacking data*/ - size = (size_t *) ( ((char*)des->des_local->seg_addr.pval) ); + size = (size_t *) ( ((char*)des->des_segments->seg_addr.pval) ); l_addr = (void**)( ((char*)size) + sizeof(*size)); getreq = (mca_spml_yoda_get_request_t*)*(void**)((char*)l_addr + sizeof(*l_addr) + *size); @@ -339,8 +365,7 @@ int mca_spml_yoda_deregister(sshmem_mkey_t *mkeys) yoda_context->btl_src_descriptor = NULL; } if (yoda_context->registration) { - ybtl->btl->btl_mpool->mpool_deregister(ybtl->btl->btl_mpool, - yoda_context->registration); + ybtl->btl->btl_deregister_mem (ybtl->btl, yoda_context->registration); } } @@ -355,16 +380,9 @@ sshmem_mkey_t *mca_spml_yoda_register(void* addr, int *count) { int i; - mca_btl_base_descriptor_t* des = NULL; - const opal_datatype_t *datatype = &opal_datatype_wchar; - opal_convertor_t convertor; sshmem_mkey_t *mkeys; struct yoda_btl *ybtl; - oshmem_proc_t *proc_self; mca_spml_yoda_context_t* yoda_context; - struct iovec iov; - uint32_t iov_count = 1; - SPML_VERBOSE(10, "address %p len %llu", addr, (unsigned long long)size); *count = 0; @@ -375,10 +393,6 @@ sshmem_mkey_t *mca_spml_yoda_register(void* addr, return NULL ; } - proc_self = oshmem_proc_group_find(oshmem_group_all, oshmem_my_proc_id()); - /* create convertor */ - OBJ_CONSTRUCT(&convertor, opal_convertor_t); - mca_bml.bml_register( MCA_SPML_YODA_PUT, mca_yoda_put_callback, NULL ); @@ -402,8 +416,8 @@ sshmem_mkey_t *mca_spml_yoda_register(void* addr, continue; } - /* If we have shared memory just save its id*/ - if (YODA_BTL_SM == ybtl->btl_type + /* If we have shared memory just save its id */ + if ((YODA_BTL_SM == ybtl->btl_type || YODA_BTL_VADER == ybtl->btl_type) && MAP_SEGMENT_SHM_INVALID != (int)shmid) { mkeys[i].u.key = shmid; mkeys[i].va_base = 0; @@ -415,54 +429,23 @@ sshmem_mkey_t *mca_spml_yoda_register(void* addr, yoda_context->registration = NULL; if (ybtl->btl->btl_flags & MCA_BTL_FLAGS_RDMA) { - - /* initialize convertor for source descriptor*/ - opal_convertor_copy_and_prepare_for_recv(proc_self->super.proc_convertor, - datatype, - size, - addr, - 0, - &convertor); - - if (NULL != ybtl->btl->btl_mpool && NULL != ybtl->btl->btl_mpool->mpool_register) { - iov.iov_len = size; - iov.iov_base = NULL; - - opal_convertor_pack(&convertor, &iov, &iov_count, &size); - ybtl->btl->btl_mpool->mpool_register(ybtl->btl->btl_mpool, - iov.iov_base, size, 0, &yoda_context->registration); - } - /* initialize convertor for source descriptor*/ - opal_convertor_copy_and_prepare_for_recv(proc_self->super.proc_convertor, - datatype, - size, - addr, - 0, - &convertor); - - /* register source memory */ - des = ybtl->btl->btl_prepare_src(ybtl->btl, - ybtl->bml_btl->btl_endpoint, - yoda_context->registration, - &convertor, - MCA_BTL_NO_ORDER, - 0, - &size, - 0); - if (NULL == des) { - SPML_ERROR("%s: failed to register source memory. ", - btl_type2str(ybtl->btl_type)); - /* FIXME some cleanup might be needed here - * yoda_context->btl_src_descriptor = NULL; - * OBJ_DESTRUCT(&convertor); - * *count = ???; - */ - return NULL; + if (NULL != ybtl->btl->btl_register_mem) { + yoda_context->registration = ybtl->btl->btl_register_mem (ybtl->btl, MCA_BTL_ENDPOINT_ANY, + addr, size, MCA_BTL_REG_FLAG_ACCESS_ANY); + if (NULL == yoda_context->registration) { + SPML_ERROR("%s: failed to register source memory: addr: %p, size: %u", + btl_type2str(ybtl->btl_type), addr, size); + /* FIXME some cleanup might be needed here + * yoda_context->btl_src_descriptor = NULL; + * *count = ???; + */ + return NULL; + } } - yoda_context->btl_src_descriptor = des; - mkeys[i].u.data = des->des_local; - mkeys[i].len = ybtl->btl->btl_seg_size; + yoda_context->btl_src_descriptor = NULL; + mkeys[i].u.data = yoda_context->registration; + mkeys[i].len = yoda_context->registration ? ybtl->btl->btl_registration_handle_size : 0; } SPML_VERBOSE(5, @@ -470,7 +453,6 @@ sshmem_mkey_t *mca_spml_yoda_register(void* addr, OSHMEM_PROC_VPID(oshmem_proc_local_proc), btl_type2str(ybtl->btl_type), mkeys[i].va_base, mkeys[i].len, (unsigned long long)mkeys[i].u.key, (unsigned long long)size); } - OBJ_DESTRUCT(&convertor); *count = mca_spml_yoda.n_btls; return mkeys; } @@ -746,7 +728,6 @@ static inline mca_bml_base_btl_t *get_next_btl(int dst, int *btl_id) return bml_btl; } - static inline int mca_spml_yoda_put_internal(void *dst_addr, size_t size, void *src_addr, @@ -769,6 +750,7 @@ static inline int mca_spml_yoda_put_internal(void *dst_addr, int btl_id = 0; struct yoda_btl *ybtl; int put_via_send; + mca_btl_base_registration_handle_t *local_handle = NULL, *remote_handle = NULL; /* If nothing to put its OK.*/ if (0 >= size) { @@ -802,17 +784,22 @@ static inline int mca_spml_yoda_put_internal(void *dst_addr, ybtl = &mca_spml_yoda.btl_type_map[btl_id]; + if (ybtl->btl->btl_register_mem) { + assert (r_mkey->len == ybtl->btl->btl_registration_handle_size); + remote_handle = (mca_btl_base_registration_handle_t *) r_mkey->u.data; + } + /* check if we doing put into shm attached segment and if so * just do memcpy */ - if ((YODA_BTL_SM == ybtl->btl_type) + if ((YODA_BTL_SM == ybtl->btl_type || YODA_BTL_VADER == ybtl->btl_type) && mca_memheap_base_can_local_copy(r_mkey, dst_addr)) { memcpy((void *) (unsigned long) rva, src_addr, size); return OSHMEM_SUCCESS; } /* We support only blocking PUT now => we always need copy for src buffer*/ - calc_nfrags(bml_btl, size, &frag_size, &nfrags, put_via_send); + calc_nfrags_put (bml_btl, size, &frag_size, &nfrags, put_via_send); p_src = (char*) src_addr; p_dst = (char*) (unsigned long) rva; @@ -832,7 +819,7 @@ static inline int mca_spml_yoda_put_internal(void *dst_addr, MCA_BTL_DES_SEND_ALWAYS_CALLBACK, put_via_send); - if (OPAL_UNLIKELY(!des || !des->des_local )) { + if (OPAL_UNLIKELY(!des || !des->des_segments )) { SPML_ERROR("src=%p nfrags = %d frag_size=%d", src_addr, nfrags, frag_size); SPML_ERROR("shmem OOM error need %d bytes", ncopied); @@ -844,35 +831,36 @@ static inline int mca_spml_yoda_put_internal(void *dst_addr, } /* copy data to allocated buffer*/ - segment = des->des_local; + segment = des->des_segments; spml_yoda_prepare_for_put((void*)segment->seg_addr.pval, ncopied, (void*)p_src, (void*)p_dst, put_via_send); - /* Preparing destination buffer */ - - assert( NULL != r_mkey->u.data && 0 != r_mkey->len); - - memcpy(&frag->rdma_segs[0].base_seg, - r_mkey->u.data, - r_mkey->len); + if (!put_via_send && ybtl->btl->btl_register_mem) { + local_handle = ybtl->btl->btl_register_mem (ybtl->btl, bml_btl->btl_endpoint, + segment->seg_addr.pval, ncopied, 0); + if (NULL == local_handle) { + /* No free resources, Block on completion here */ + SPML_ERROR("shmem error: OSHMEM_ERR_OUT_OF_RESOURCE"); + oshmem_request_wait_completion(&putreq->req_put.req_base.req_oshmem); + } + } frag->rdma_segs[0].base_seg.seg_addr.lval = (uintptr_t) p_dst; frag->rdma_segs[0].base_seg.seg_len = (put_via_send ? ncopied + SPML_YODA_SEND_CONTEXT_SIZE : ncopied); - des->des_remote = &frag->rdma_segs[0].base_seg; - frag->rdma_req = putreq; /* initialize callback data for put*/ des->des_cbdata = frag; des->des_cbfunc = mca_spml_yoda_put_completion; - des->des_remote_count = 1; OPAL_THREAD_ADD32(&mca_spml_yoda.n_active_puts, 1); /* put the data to remote side */ if (!put_via_send) { - rc = mca_bml_base_put(bml_btl, des); + rc = mca_bml_base_put (bml_btl, segment->seg_addr.pval, (uint64_t) (intptr_t) p_dst, + local_handle, remote_handle, ncopied, 0, 0, mca_spml_yoda_put_completion_rdma, + des); } else { rc = mca_bml_base_send(bml_btl, des, MCA_SPML_YODA_PUT); if (1 == rc) @@ -1025,11 +1013,7 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) struct yoda_btl *ybtl; int btl_id = 0; int get_via_send; - const opal_datatype_t *datatype = &opal_datatype_wchar; - opal_convertor_t convertor; - oshmem_proc_t *proc_self; - size_t prepare_size; - mca_mpool_base_registration_t* registration; + mca_btl_base_registration_handle_t *local_handle, *remote_handle = NULL; mca_spml_yoda_get_request_t* getreq = NULL; /*If nothing to get its OK.*/ @@ -1057,6 +1041,7 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) src, src_addr); oshmem_shmem_abort(-1); } + #if SPML_YODA_DEBUG == 1 SPML_VERBOSE(100, "get: pe:%d src=%p -> dst: %p sz=%d. src_rva=%p, %s", src, src_addr, dst_addr, (int)size, (void *)rva, mca_spml_base_mkey2str(r_mkey)); @@ -1064,12 +1049,17 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) ybtl = &mca_spml_yoda.btl_type_map[btl_id]; + if (ybtl->btl->btl_register_mem) { + assert(ybtl->btl->btl_registration_handle_size == r_mkey->len); + remote_handle = (mca_btl_base_registration_handle_t *) r_mkey->u.data; + } + nfrags = 1; /* check if we doing get into shm attached segment and if so * just do memcpy */ - if ((YODA_BTL_SM == ybtl->btl_type) + if ((YODA_BTL_SM == ybtl->btl_type || YODA_BTL_VADER == ybtl->btl_type) && mca_memheap_base_can_local_copy(r_mkey, src_addr)) { memcpy(dst_addr, (void *) rva, size); /* must call progress here to avoid deadlock. Scenarion: @@ -1089,7 +1079,7 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) */ frag_size = ncopied; if ((NULL == l_mkey) || get_via_send) { - calc_nfrags(bml_btl, size, &frag_size, &nfrags, get_via_send); + calc_nfrags_get (bml_btl, size, &frag_size, &nfrags, get_via_send); } p_src = (char*) (unsigned long) rva; @@ -1110,7 +1100,6 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) ncopied = i < nfrags - 1 ? frag_size :(unsigned) ((char *) dst_addr + size - p_dst); frag->allocated = 0; /* Prepare destination descriptor*/ - assert(0 != r_mkey->len); memcpy(&frag->rdma_segs[0].base_seg, r_mkey->u.data, r_mkey->len); @@ -1130,16 +1119,17 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) (int)frag_size, MCA_BTL_DES_SEND_ALWAYS_CALLBACK, get_via_send); - if (OPAL_UNLIKELY(!des || !des->des_local)) { + if (OPAL_UNLIKELY(!des || !des->des_segments)) { SPML_ERROR("shmem OOM error need %d bytes", ncopied); SPML_ERROR("src=%p nfrags = %d frag_size=%d", src_addr, nfrags, frag_size); oshmem_shmem_abort(-1); } - segment = des->des_local; + segment = des->des_segments; spml_yoda_prepare_for_get((void*)segment->seg_addr.pval, ncopied, (void*)p_src, oshmem_my_proc_id(), (void*)p_dst, (void*) getreq); des->des_cbfunc = mca_spml_yoda_get_response_completion; + des->des_cbdata = frag; OPAL_THREAD_ADD32(&mca_spml_yoda.n_active_gets, 1); } @@ -1147,36 +1137,24 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) /* * Register src memory if do GET via GET */ - proc_self = oshmem_proc_group_find(oshmem_group_all, oshmem_my_proc_id()); - OBJ_CONSTRUCT(&convertor, opal_convertor_t); + if (NULL == l_mkey && ybtl->btl->btl_register_mem) { + local_handle = ybtl->btl->btl_register_mem (ybtl->btl, bml_btl->btl_endpoint, p_dst, ncopied, + MCA_BTL_REG_FLAG_LOCAL_WRITE); - prepare_size = ncopied; - opal_convertor_copy_and_prepare_for_recv(proc_self->super.proc_convertor, - datatype, - prepare_size, - p_dst, - 0, - &convertor); + if (NULL == local_handle) { + SPML_ERROR("%s: failed to register destination memory %p.", + btl_type2str(ybtl->btl_type), p_dst); + } - registration = (NULL == l_mkey ? NULL : ((mca_spml_yoda_context_t*)l_mkey->spml_context)->registration); - des = ybtl->btl->btl_prepare_dst(ybtl->btl, - bml_btl->btl_endpoint, - registration, - &convertor, - MCA_BTL_NO_ORDER, - 0, - &prepare_size, - 0); - if (NULL == des) { - SPML_ERROR("%s: failed to register destination memory %p.", - btl_type2str(ybtl->btl_type), p_dst); + frag->local_handle = local_handle; + } else { + local_handle = ((mca_spml_yoda_context_t*)l_mkey->spml_context)->registration; + frag->local_handle = NULL; } - OBJ_DESTRUCT(&convertor); + frag->rdma_segs[0].base_seg.seg_addr.lval = (uintptr_t) p_src; getreq->p_dst = (uint64_t*) p_dst; frag->size = ncopied; - des->des_cbfunc = mca_spml_yoda_get_completion; - des->des_remote = &frag->rdma_segs[0].base_seg; OPAL_THREAD_ADD32(&mca_spml_yoda.n_active_gets, 1); } @@ -1189,12 +1167,6 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) frag->rdma_req = getreq; - /** - * Init remote side descriptor. - */ - des->des_remote_count = 1; - des->des_cbdata = frag; - /** * Do GET operation */ @@ -1203,7 +1175,8 @@ int mca_spml_yoda_get(void* src_addr, size_t size, void* dst_addr, int src) if (1 == rc) rc = OSHMEM_SUCCESS; } else { - rc = mca_bml_base_get(bml_btl, des); + rc = mca_bml_base_get(bml_btl, p_dst, (uint64_t) (intptr_t) p_src, local_handle, + remote_handle, ncopied, 0, 0, mca_spml_yoda_get_completion, frag); } if (OPAL_UNLIKELY(OSHMEM_SUCCESS != rc)) { diff --git a/oshmem/mca/spml/yoda/spml_yoda.h b/oshmem/mca/spml/yoda/spml_yoda.h index 7a21f01a63..deb45654b9 100644 --- a/oshmem/mca/spml/yoda/spml_yoda.h +++ b/oshmem/mca/spml/yoda/spml_yoda.h @@ -1,6 +1,9 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,6 +53,8 @@ enum { YODA_BTL_SELF = 0, YODA_BTL_SM, YODA_BTL_OPENIB, + YODA_BTL_VADER, + YODA_BTL_UGNI, YODA_BTL_MAX }; @@ -86,7 +91,7 @@ typedef struct mca_spml_yoda_t mca_spml_yoda_module_t; struct mca_spml_yoda_context_t { mca_btl_base_descriptor_t* btl_src_descriptor; - mca_mpool_base_registration_t* registration; + mca_btl_base_registration_handle_t *registration; }; typedef struct mca_spml_yoda_context_t mca_spml_yoda_context_t; diff --git a/oshmem/mca/spml/yoda/spml_yoda_getreq.c b/oshmem/mca/spml/yoda/spml_yoda_getreq.c index 85e495a1c6..1b63038b9a 100644 --- a/oshmem/mca/spml/yoda/spml_yoda_getreq.c +++ b/oshmem/mca/spml/yoda/spml_yoda_getreq.c @@ -1,8 +1,11 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -72,29 +75,24 @@ OBJ_CLASS_INSTANCE( mca_spml_yoda_get_request_t, mca_spml_yoda_get_request_construct, mca_spml_yoda_get_request_destruct); -void mca_spml_yoda_get_completion(mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status) +void mca_spml_yoda_get_completion (struct mca_btl_base_module_t* module, + struct mca_btl_base_endpoint_t* endpoint, + void *local_address, + struct mca_btl_base_registration_handle_t *local_handle, + void *context, void *cbdata, int status) { mca_spml_yoda_rdma_frag_t* frag = - (mca_spml_yoda_rdma_frag_t*) des->des_cbdata; + (mca_spml_yoda_rdma_frag_t*) cbdata; mca_spml_yoda_get_request_t* getreq = (mca_spml_yoda_get_request_t*) frag->rdma_req; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; + mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) context; /* check completion status */ - if (OPAL_UNLIKELY(OSHMEM_SUCCESS != status)) { + if (OPAL_UNLIKELY(OPAL_SUCCESS != status)) { /* shmem has no way to propagate errors. cry&die */ SPML_ERROR("FATAL get completion error"); abort(); } - /* decide if we need to copy buffer */ - if (getreq->p_dst) { - memcpy(getreq->p_dst, - des->des_local->seg_addr.pval, - frag->size); - } if (getreq->parent) { OPAL_THREAD_ADD32(&getreq->parent->active_count, -1); @@ -103,7 +101,9 @@ void mca_spml_yoda_get_completion(mca_btl_base_module_t* btl, oshmem_request_complete(&getreq->req_get.req_base.req_oshmem, 1); oshmem_request_free((oshmem_request_t**) &getreq); - mca_bml_base_free(bml_btl, des); + if (bml_btl->btl->btl_register_mem && frag->local_handle) { + bml_btl->btl->btl_deregister_mem (bml_btl->btl, frag->local_handle); + } OPAL_THREAD_ADD32(&mca_spml_yoda.n_active_gets, -1); } diff --git a/oshmem/mca/spml/yoda/spml_yoda_getreq.h b/oshmem/mca/spml/yoda/spml_yoda_getreq.h index b83aa75669..f32f843063 100644 --- a/oshmem/mca/spml/yoda/spml_yoda_getreq.h +++ b/oshmem/mca/spml/yoda/spml_yoda_getreq.h @@ -1,6 +1,9 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,10 +54,11 @@ static inline mca_spml_yoda_get_request_t *mca_spml_yoda_getreq_alloc(int dst) return getreq; } -void mca_spml_yoda_get_completion(mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status); +void mca_spml_yoda_get_completion (struct mca_btl_base_module_t* module, + struct mca_btl_base_endpoint_t* endpoint, + void *local_address, + struct mca_btl_base_registration_handle_t *local_handle, + void *context, void *cbdata, int status); void mca_spml_yoda_get_response_completion(mca_btl_base_module_t* btl, struct mca_btl_base_endpoint_t* ep, diff --git a/oshmem/mca/spml/yoda/spml_yoda_putreq.c b/oshmem/mca/spml/yoda/spml_yoda_putreq.c index e70f34c63d..dea643652e 100644 --- a/oshmem/mca/spml/yoda/spml_yoda_putreq.c +++ b/oshmem/mca/spml/yoda/spml_yoda_putreq.c @@ -91,3 +91,20 @@ void mca_spml_yoda_put_completion(mca_btl_base_module_t* btl, oshmem_request_free((oshmem_request_t**) &putreq); mca_bml_base_free(bml_btl, des); } + +void mca_spml_yoda_put_completion_rdma (struct mca_btl_base_module_t* module, + struct mca_btl_base_endpoint_t* endpoint, + void *local_address, + struct mca_btl_base_registration_handle_t *local_handle, + void *context, void *cbdata, int status) +{ + mca_btl_base_descriptor_t *des = (mca_btl_base_descriptor_t *) cbdata; + mca_bml_base_btl_t *bml_btl = (mca_bml_base_btl_t *) context; + des->des_context = context; + + if (bml_btl->btl->btl_register_mem) { + bml_btl->btl->btl_deregister_mem (bml_btl->btl, local_handle); + } + + des->des_cbfunc (module, endpoint, des, status); +} diff --git a/oshmem/mca/spml/yoda/spml_yoda_putreq.h b/oshmem/mca/spml/yoda/spml_yoda_putreq.h index ea1aabfbbc..5251aa4415 100644 --- a/oshmem/mca/spml/yoda/spml_yoda_putreq.h +++ b/oshmem/mca/spml/yoda/spml_yoda_putreq.h @@ -49,6 +49,12 @@ void mca_spml_yoda_put_completion(mca_btl_base_module_t* btl, struct mca_btl_base_descriptor_t* des, int status); +void mca_spml_yoda_put_completion_rdma (struct mca_btl_base_module_t* module, + struct mca_btl_base_endpoint_t* endpoint, + void *local_address, + struct mca_btl_base_registration_handle_t *local_handle, + void *context, void *cbdata, int status); + END_C_DECLS #endif /* OSHMEM_SPML_YODA_PUT_REQUEST_H */ diff --git a/oshmem/mca/spml/yoda/spml_yoda_rdmafrag.h b/oshmem/mca/spml/yoda/spml_yoda_rdmafrag.h index 00ca338d17..398d378125 100644 --- a/oshmem/mca/spml/yoda/spml_yoda_rdmafrag.h +++ b/oshmem/mca/spml/yoda/spml_yoda_rdmafrag.h @@ -32,7 +32,7 @@ typedef union mca_spml_yoda_segment_t { struct mca_spml_yoda_rdma_frag_t { mca_spml_yoda_segment_t rdma_segs[2]; - mca_btl_base_segment_t *btl_seg; /* save pointer to btl allocated descriptor segment */ + mca_btl_base_registration_handle_t *local_handle; void *rdma_req; int allocated; int use_send;