btl/scif: update for BTL 3.0 interface
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
родитель
cf91156105
Коммит
f96d48a2e1
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -98,7 +98,7 @@ typedef struct mca_btl_scif_module_t {
|
||||
|
||||
typedef struct mca_btl_scif_component_t {
|
||||
/* base BTL component */
|
||||
mca_btl_base_component_2_0_0_t super;
|
||||
mca_btl_base_component_3_0_0_t super;
|
||||
|
||||
/* DMA free list settings */
|
||||
int scif_free_list_num;
|
||||
@ -197,29 +197,21 @@ int mca_btl_scif_sendi (struct mca_btl_base_module_t *btl,
|
||||
* Initiate a get operation.
|
||||
*
|
||||
* location: btl_scif_get.c
|
||||
*
|
||||
* @param btl (IN) BTL module
|
||||
* @param endpoint (IN) BTL addressing information
|
||||
* @param descriptor (IN) Description of the data to be transferred
|
||||
*/
|
||||
int
|
||||
mca_btl_scif_get (struct mca_btl_base_module_t *btl,
|
||||
struct mca_btl_base_endpoint_t *endpoint,
|
||||
struct mca_btl_base_descriptor_t *des);
|
||||
int mca_btl_scif_get (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address,
|
||||
uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle,
|
||||
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
|
||||
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata);
|
||||
|
||||
/**
|
||||
* Initiate a put operation.
|
||||
*
|
||||
* location: btl_scif_put.c
|
||||
*
|
||||
* @param btl (IN) BTL module
|
||||
* @param endpoint (IN) BTL addressing information
|
||||
* @param descriptor (IN) Description of the data to be transferred
|
||||
*/
|
||||
int
|
||||
mca_btl_scif_put (struct mca_btl_base_module_t *btl,
|
||||
struct mca_btl_base_endpoint_t *endpoint,
|
||||
struct mca_btl_base_descriptor_t *des);
|
||||
int mca_btl_scif_put (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address,
|
||||
uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle,
|
||||
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
|
||||
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata);
|
||||
|
||||
mca_btl_base_descriptor_t *
|
||||
mca_btl_scif_alloc(struct mca_btl_base_module_t *btl,
|
||||
@ -228,9 +220,25 @@ mca_btl_scif_alloc(struct mca_btl_base_module_t *btl,
|
||||
|
||||
int mca_btl_scif_progress_send_wait_list (struct mca_btl_base_endpoint_t *endpoint);
|
||||
|
||||
struct mca_btl_scif_reg_t;
|
||||
|
||||
struct mca_btl_base_registration_handle_t {
|
||||
/** scif offset */
|
||||
off_t scif_offset;
|
||||
/** base address of this scif region */
|
||||
uintptr_t scif_base;
|
||||
};
|
||||
|
||||
struct mca_btl_scif_registration_handle_t {
|
||||
mca_btl_base_registration_handle_t btl_handle;
|
||||
struct mca_btl_scif_reg_t *reg;
|
||||
};
|
||||
typedef struct mca_btl_scif_registration_handle_t mca_btl_scif_registration_handle_t;
|
||||
|
||||
typedef struct mca_btl_scif_reg_t {
|
||||
mca_mpool_base_registration_t base;
|
||||
off_t *registrations;
|
||||
/** per-endpoint btl handles for this registration */
|
||||
mca_btl_scif_registration_handle_t *handles;
|
||||
} mca_btl_scif_reg_t;
|
||||
|
||||
/* Global structures */
|
||||
|
@ -165,14 +165,14 @@ static int scif_dereg_mem (void *reg_data, mca_mpool_base_registration_t *reg)
|
||||
|
||||
/* register the fragment with all connected endpoints */
|
||||
for (i = 0 ; i < (int) mca_btl_scif_module.endpoint_count ; ++i) {
|
||||
if ((off_t)-1 != scif_reg->registrations[i] &&
|
||||
if ((off_t)-1 != scif_reg->handles[i].btl_handle.scif_offset &&
|
||||
MCA_BTL_SCIF_EP_STATE_CONNECTED == mca_btl_scif_module.endpoints[i].state) {
|
||||
(void) scif_unregister(mca_btl_scif_module.endpoints[i].scif_epd,
|
||||
scif_reg->registrations[i], size);
|
||||
scif_reg->handles[i].btl_handle.scif_offset, size);
|
||||
}
|
||||
}
|
||||
|
||||
free (scif_reg->registrations);
|
||||
free (scif_reg->handles);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -184,17 +184,22 @@ static int scif_reg_mem (void *reg_data, void *base, size_t size,
|
||||
int rc = OPAL_SUCCESS;
|
||||
unsigned int i;
|
||||
|
||||
scif_reg->registrations = calloc (mca_btl_scif_module.endpoint_count,
|
||||
sizeof (off_t));
|
||||
memset (scif_reg->registrations, -1, mca_btl_scif_module.endpoint_count * sizeof (off_t));
|
||||
scif_reg->handles = calloc (mca_btl_scif_module.endpoint_count, sizeof (scif_reg->handles[0]));
|
||||
|
||||
/* intialize all scif offsets to -1 and initialize the pointer back to the mpool registration */
|
||||
for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) {
|
||||
scif_reg->handles[i].btl_handle.scif_offset = -1;
|
||||
scif_reg->handles[i].btl_handle.scif_base = (intptr_t) base;
|
||||
scif_reg->handles[i].reg = scif_reg;
|
||||
}
|
||||
|
||||
/* register the pointer with all connected endpoints */
|
||||
for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) {
|
||||
if (MCA_BTL_SCIF_EP_STATE_CONNECTED == mca_btl_scif_module.endpoints[i].state) {
|
||||
scif_reg->registrations[i] = scif_register(mca_btl_scif_module.endpoints[i].scif_epd,
|
||||
base, size, 0, SCIF_PROT_READ |
|
||||
SCIF_PROT_WRITE, 0);
|
||||
if (SCIF_REGISTER_FAILED == scif_reg->registrations[i]) {
|
||||
scif_reg->handles[i].btl_handle.scif_offset = scif_register (mca_btl_scif_module.endpoints[i].scif_epd,
|
||||
base, size, 0, SCIF_PROT_READ |
|
||||
SCIF_PROT_WRITE, 0);
|
||||
if (SCIF_REGISTER_FAILED == scif_reg->handles[i].btl_handle.scif_offset) {
|
||||
/* cleanup */
|
||||
scif_dereg_mem (reg_data, reg);
|
||||
rc = OPAL_ERR_OUT_OF_RESOURCE;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -171,7 +171,7 @@ static int btl_scif_component_register(void)
|
||||
mca_btl_scif_module.super.btl_flags = MCA_BTL_FLAGS_SEND |
|
||||
MCA_BTL_FLAGS_RDMA | MCA_BTL_FLAGS_SEND_INPLACE;
|
||||
|
||||
mca_btl_scif_module.super.btl_seg_size = sizeof (mca_btl_scif_segment_t);
|
||||
mca_btl_scif_module.super.btl_registration_handle_size = sizeof (mca_btl_base_registration_handle_t);
|
||||
|
||||
mca_btl_scif_module.super.btl_bandwidth = 50000; /* Mbs */
|
||||
mca_btl_scif_module.super.btl_latency = 2; /* Microsecs */
|
||||
@ -329,11 +329,11 @@ static int mca_btl_scif_progress_recvs (mca_btl_base_endpoint_t *ep)
|
||||
* the fragment without introducing another copy here. this
|
||||
* limitation has not appeared to cause any performance
|
||||
* problems. */
|
||||
frag.base.des_local_count = 1;
|
||||
frag.segments[0].base.seg_len = hdr->size;
|
||||
frag.segments[0].base.seg_addr.pval = (void *) (hdr + 1);
|
||||
frag.base.des_segment_count = 1;
|
||||
frag.segments[0].seg_len = hdr->size;
|
||||
frag.segments[0].seg_addr.pval = (void *) (hdr + 1);
|
||||
|
||||
frag.base.des_local = &frag.segments[0].base;
|
||||
frag.base.des_segments = frag.segments;
|
||||
|
||||
/* call the registered callback function */
|
||||
reg->cbfunc(&mca_btl_scif_module.super, hdr->tag, &frag.base, reg->cbdata);
|
||||
|
@ -15,13 +15,13 @@
|
||||
static inline void mca_btl_scif_base_frag_constructor (mca_btl_scif_base_frag_t *frag)
|
||||
{
|
||||
memset ((char *) frag + sizeof (frag->base), 0, sizeof (*frag) - sizeof (frag->base));
|
||||
frag->segments[0].base.seg_addr.pval = frag->base.super.ptr;
|
||||
frag->segments[0].seg_addr.pval = frag->base.super.ptr;
|
||||
}
|
||||
|
||||
static inline void mca_btl_scif_eager_frag_constructor (mca_btl_scif_base_frag_t *frag)
|
||||
{
|
||||
memset ((char *) frag + sizeof (frag->base), 0, sizeof (*frag) - sizeof (frag->base));
|
||||
frag->segments[0].base.seg_addr.pval = frag->base.super.ptr;
|
||||
frag->segments[0].seg_addr.pval = frag->base.super.ptr;
|
||||
}
|
||||
|
||||
OBJ_CLASS_INSTANCE(mca_btl_scif_eager_frag_t, mca_btl_base_descriptor_t,
|
||||
|
@ -15,16 +15,6 @@
|
||||
#include "btl_scif.h"
|
||||
#include "btl_scif_endpoint.h"
|
||||
|
||||
typedef struct mca_btl_scif_segment_t {
|
||||
mca_btl_base_segment_t base;
|
||||
|
||||
/* scif offset */
|
||||
off_t scif_offset;
|
||||
|
||||
/* original pointer */
|
||||
uint64_t orig_ptr;
|
||||
} mca_btl_scif_segment_t;
|
||||
|
||||
typedef struct mca_btl_scif_frag_hdr_t {
|
||||
#if defined(SCIF_USE_SEQ)
|
||||
uint32_t seq;
|
||||
@ -41,7 +31,7 @@ typedef void (*frag_cb_t) (struct mca_btl_scif_base_frag_t *, int);
|
||||
typedef struct mca_btl_scif_base_frag_t {
|
||||
mca_btl_base_descriptor_t base;
|
||||
mca_btl_scif_frag_hdr_t hdr;
|
||||
mca_btl_scif_segment_t segments[2];
|
||||
mca_btl_base_segment_t segments[2];
|
||||
mca_btl_base_endpoint_t *endpoint;
|
||||
mca_btl_scif_reg_t *registration;
|
||||
ompi_free_list_t *my_list;
|
||||
@ -78,9 +68,9 @@ static inline int mca_btl_scif_frag_return (mca_btl_scif_base_frag_t *frag)
|
||||
frag->registration = NULL;
|
||||
}
|
||||
|
||||
frag->segments[0].base.seg_addr.pval = frag->base.super.ptr;
|
||||
frag->segments[0].base.seg_len = 0;
|
||||
frag->segments[1].base.seg_len = 0;
|
||||
frag->segments[0].seg_addr.pval = frag->base.super.ptr;
|
||||
frag->segments[0].seg_len = 0;
|
||||
frag->segments[1].seg_len = 0;
|
||||
|
||||
OMPI_FREE_LIST_RETURN_MT(frag->my_list, (ompi_free_list_item_t *) frag);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
@ -20,18 +20,13 @@
|
||||
|
||||
/**
|
||||
* 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_scif_get (struct mca_btl_base_module_t *btl,
|
||||
struct mca_btl_base_endpoint_t *endpoint,
|
||||
struct mca_btl_base_descriptor_t *des) {
|
||||
mca_btl_scif_segment_t *src = (mca_btl_scif_segment_t *) des->des_remote;
|
||||
mca_btl_scif_segment_t *dst = (mca_btl_scif_segment_t *) des->des_local;
|
||||
size_t len = lmin (src->base.seg_len, dst->base.seg_len);
|
||||
int rc, mark, flags = 0;
|
||||
int mca_btl_scif_get (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address,
|
||||
uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle,
|
||||
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
|
||||
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata)
|
||||
{
|
||||
int rc, mark, scif_flags = 0;
|
||||
off_t roffset, loffset;
|
||||
#if defined(SCIF_TIMING)
|
||||
struct timespec ts;
|
||||
@ -41,30 +36,27 @@ int mca_btl_scif_get (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_scif_component.get_count++;
|
||||
#endif
|
||||
|
||||
BTL_VERBOSE(("Using DMA Get for frag %p from offset %lu", (void *) des,
|
||||
(unsigned long) src->scif_offset));
|
||||
BTL_VERBOSE(("Using DMA Get from remote address %" PRIx64 " to local address %p",
|
||||
remote_address, local_address));
|
||||
|
||||
roffset = src->scif_offset + (off_t)(src->orig_ptr - src->base.seg_addr.lval);
|
||||
loffset = dst->scif_offset + (off_t)(dst->orig_ptr - dst->base.seg_addr.lval);
|
||||
roffset = remote_handle->scif_offset + (off_t)(remote_address - remote_handle->scif_base);
|
||||
loffset = local_handle->scif_offset + (off_t)((intptr_t)local_address - local_handle->scif_base);
|
||||
|
||||
if (mca_btl_scif_component.rma_use_cpu) {
|
||||
flags = SCIF_RMA_USECPU;
|
||||
scif_flags = SCIF_RMA_USECPU;
|
||||
}
|
||||
|
||||
if (mca_btl_scif_component.rma_sync) {
|
||||
flags |= SCIF_RMA_SYNC;
|
||||
scif_flags |= SCIF_RMA_SYNC;
|
||||
}
|
||||
|
||||
/* start the read */
|
||||
rc = scif_readfrom (endpoint->scif_epd, loffset, len, roffset, flags);
|
||||
rc = scif_readfrom (endpoint->scif_epd, loffset, size, roffset, scif_flags);
|
||||
if (OPAL_UNLIKELY(-1 == rc)) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
/* always call the callback function */
|
||||
des->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
|
||||
|
||||
if (!(flags & SCIF_RMA_SYNC)) {
|
||||
if (!(scif_flags & SCIF_RMA_SYNC)) {
|
||||
/* according to the scif documentation is is better to use a fence rather
|
||||
* than using the SCIF_RMA_SYNC flag with scif_readfrom */
|
||||
scif_fence_mark (endpoint->scif_epd, SCIF_FENCE_INIT_SELF, &mark);
|
||||
@ -76,8 +68,8 @@ int mca_btl_scif_get (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_scif_component.get_time_max, ts);
|
||||
#endif
|
||||
|
||||
/* since we completed the fence the RMA operation is complete */
|
||||
mca_btl_scif_frag_complete ((mca_btl_scif_base_frag_t *) des, OPAL_SUCCESS);
|
||||
/* always call the callback function */
|
||||
cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
@ -24,17 +24,14 @@ mca_btl_scif_free (struct mca_btl_base_module_t *btl,
|
||||
static int
|
||||
mca_btl_scif_module_finalize (struct mca_btl_base_module_t* btl);
|
||||
|
||||
static mca_btl_base_descriptor_t *
|
||||
mca_btl_scif_prepare_dst (mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
opal_convertor_t *convertor, uint8_t order,
|
||||
size_t reserve, size_t *size, uint32_t flags);
|
||||
static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
void *base, size_t size, uint32_t flags);
|
||||
static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle);
|
||||
|
||||
static struct mca_btl_base_descriptor_t *
|
||||
mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl,
|
||||
struct mca_btl_base_endpoint_t *endpoint,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
struct opal_convertor_t *convertor,
|
||||
uint8_t order, size_t reserve, size_t *size,
|
||||
uint32_t flags);
|
||||
@ -48,11 +45,12 @@ mca_btl_scif_module_t mca_btl_scif_module = {
|
||||
.btl_alloc = mca_btl_scif_alloc,
|
||||
.btl_free = mca_btl_scif_free,
|
||||
.btl_prepare_src = mca_btl_scif_prepare_src,
|
||||
.btl_prepare_dst = mca_btl_scif_prepare_dst,
|
||||
.btl_send = mca_btl_scif_send,
|
||||
.btl_sendi = mca_btl_scif_sendi,
|
||||
.btl_put = mca_btl_scif_put,
|
||||
.btl_get = mca_btl_scif_get,
|
||||
.btl_register_mem = mca_btl_scif_register_mem,
|
||||
.btl_deregister_mem = mca_btl_scif_deregister_mem,
|
||||
}
|
||||
};
|
||||
|
||||
@ -163,10 +161,10 @@ mca_btl_scif_alloc(struct mca_btl_base_module_t *btl,
|
||||
|
||||
frag->base.des_flags = flags;
|
||||
frag->base.order = order;
|
||||
frag->base.des_local = &frag->segments[0].base;
|
||||
frag->base.des_local_count = 1;
|
||||
frag->base.des_segments = frag->segments;
|
||||
frag->base.des_segment_count = 1;
|
||||
|
||||
frag->segments[0].base.seg_len = size;
|
||||
frag->segments[0].seg_len = size;
|
||||
|
||||
return &frag->base;
|
||||
}
|
||||
@ -178,16 +176,19 @@ mca_btl_scif_free (struct mca_btl_base_module_t *btl,
|
||||
return mca_btl_scif_frag_return ((mca_btl_scif_base_frag_t *) des);
|
||||
}
|
||||
|
||||
static inline mca_btl_base_descriptor_t *mca_btl_scif_prepare_dma (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
void *data_ptr, size_t size,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
uint8_t order, uint32_t flags)
|
||||
static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
void *base, size_t size, uint32_t flags)
|
||||
{
|
||||
mca_btl_scif_base_frag_t *frag;
|
||||
mca_btl_scif_reg_t *scif_reg;
|
||||
int rc;
|
||||
|
||||
if (MCA_BTL_ENDPOINT_ANY == endpoint) {
|
||||
/* it probably isn't possible to support registering memory to use with any endpoint so
|
||||
* return NULL */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) {
|
||||
/* the endpoint needs to be connected before the fragment can be
|
||||
* registered. */
|
||||
@ -198,67 +199,36 @@ static inline mca_btl_base_descriptor_t *mca_btl_scif_prepare_dma (struct mca_bt
|
||||
}
|
||||
}
|
||||
|
||||
(void) MCA_BTL_SCIF_FRAG_ALLOC_DMA(endpoint, frag);
|
||||
if (OPAL_UNLIKELY(NULL == frag)) {
|
||||
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, base, size, 0,
|
||||
(mca_mpool_base_registration_t **) &scif_reg);
|
||||
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (NULL == registration) {
|
||||
rc = btl->btl_mpool->mpool_register(btl->btl_mpool, data_ptr, size, 0,
|
||||
(mca_mpool_base_registration_t **) ®istration);
|
||||
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
||||
mca_btl_scif_frag_return (frag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
frag->registration = (mca_btl_scif_reg_t *) registration;
|
||||
}
|
||||
|
||||
scif_reg = (mca_btl_scif_reg_t *) registration;
|
||||
|
||||
/* register the memory location with this peer if it isn't already */
|
||||
if ((off_t) -1 == scif_reg->registrations[endpoint->id]) {
|
||||
size_t seg_size = (size_t)((uintptr_t) registration->bound - (uintptr_t) registration->base) + 1;
|
||||
scif_reg->registrations[endpoint->id] = scif_register (endpoint->scif_epd, registration->base,
|
||||
seg_size, 0, SCIF_PROT_READ |
|
||||
SCIF_PROT_WRITE, 0);
|
||||
if ((off_t) -1 == scif_reg->handles[endpoint->id].btl_handle.scif_offset) {
|
||||
size_t seg_size = (size_t)((uintptr_t) scif_reg->base.bound - (uintptr_t) scif_reg->base.base) + 1;
|
||||
|
||||
/* NTH: until we determine a way to pass permissions to the mpool just make all segments
|
||||
* read/write */
|
||||
scif_reg->handles[endpoint->id].btl_handle.scif_offset =
|
||||
scif_register (endpoint->scif_epd, scif_reg->base.base, seg_size, 0, SCIF_PROT_READ |
|
||||
SCIF_PROT_WRITE, 0);
|
||||
BTL_VERBOSE(("registered fragment for scif DMA transaction. offset = %lu",
|
||||
(unsigned long) scif_reg->registrations[endpoint->id]));
|
||||
(unsigned long) scif_reg->handles[endpoint->id].btl_handle.scif_offset));
|
||||
}
|
||||
|
||||
if (OPAL_UNLIKELY((off_t) -1 == scif_reg->registrations[endpoint->id])) {
|
||||
mca_btl_scif_frag_return (frag);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
frag->segments[0].base.seg_addr.lval = (uint64_t)(uintptr_t) data_ptr;
|
||||
frag->segments[0].base.seg_len = size;
|
||||
frag->segments[0].scif_offset = scif_reg->registrations[endpoint->id] +
|
||||
(off_t) ((ptrdiff_t) data_ptr - (ptrdiff_t) registration->base);
|
||||
/* save the original pointer so the offset can be adjusted if needed (this is
|
||||
* required for osc/rdma) */
|
||||
frag->segments[0].orig_ptr = (uint64_t)(uintptr_t) data_ptr;
|
||||
frag->base.order = order;
|
||||
frag->base.des_flags = flags;
|
||||
|
||||
frag->base.des_local = &frag->segments->base;
|
||||
frag->base.des_local_count = 1;
|
||||
|
||||
return &frag->base;
|
||||
return &scif_reg->handles[endpoint->id].btl_handle;
|
||||
}
|
||||
|
||||
static inline mca_btl_base_descriptor_t *mca_btl_scif_prepare_dma_conv (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
struct opal_convertor_t *convertor,
|
||||
uint8_t order, size_t *size,
|
||||
uint32_t flags)
|
||||
static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle)
|
||||
{
|
||||
void *data_ptr;
|
||||
mca_btl_scif_registration_handle_t *scif_handle = (mca_btl_scif_registration_handle_t *) handle;
|
||||
mca_btl_scif_reg_t *scif_reg = scif_handle->reg;
|
||||
|
||||
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
||||
btl->btl_mpool->mpool_deregister (btl->btl_mpool, &scif_reg->base);
|
||||
|
||||
return mca_btl_scif_prepare_dma (btl, endpoint, data_ptr, *size, registration, order, flags);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static inline struct mca_btl_base_descriptor_t *
|
||||
@ -286,10 +256,10 @@ mca_btl_scif_prepare_src_send (struct mca_btl_base_module_t *btl,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
frag->segments[0].base.seg_len = reserve;
|
||||
frag->segments[1].base.seg_addr.pval = data_ptr;
|
||||
frag->segments[1].base.seg_len = *size;
|
||||
frag->base.des_local_count = 2;
|
||||
frag->segments[0].seg_len = reserve;
|
||||
frag->segments[1].seg_addr.pval = data_ptr;
|
||||
frag->segments[1].seg_len = *size;
|
||||
frag->base.des_segment_count = 2;
|
||||
} else {
|
||||
/* buffered send */
|
||||
(void) MCA_BTL_SCIF_FRAG_ALLOC_EAGER(endpoint, frag);
|
||||
@ -299,7 +269,7 @@ mca_btl_scif_prepare_src_send (struct mca_btl_base_module_t *btl,
|
||||
|
||||
if (*size) {
|
||||
iov.iov_len = *size;
|
||||
iov.iov_base = (IOVBASE_TYPE *) ((uintptr_t) frag->segments[0].base.seg_addr.pval + reserve);
|
||||
iov.iov_base = (IOVBASE_TYPE *) ((uintptr_t) frag->segments[0].seg_addr.pval + reserve);
|
||||
|
||||
rc = opal_convertor_pack (convertor, &iov, &iov_count, &max_size);
|
||||
if (OPAL_UNLIKELY(rc < 0)) {
|
||||
@ -309,37 +279,22 @@ mca_btl_scif_prepare_src_send (struct mca_btl_base_module_t *btl,
|
||||
*size = max_size;
|
||||
}
|
||||
|
||||
frag->segments[0].base.seg_len = reserve + *size;
|
||||
frag->base.des_local_count = 1;
|
||||
frag->segments[0].seg_len = reserve + *size;
|
||||
frag->base.des_segment_count = 1;
|
||||
}
|
||||
|
||||
frag->base.des_local = &frag->segments->base;
|
||||
frag->base.order = order;
|
||||
frag->base.des_flags = flags;
|
||||
frag->base.des_segments = frag->segments;
|
||||
frag->base.order = order;
|
||||
frag->base.des_flags = flags;
|
||||
|
||||
return &frag->base;
|
||||
}
|
||||
|
||||
static mca_btl_base_descriptor_t *mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
struct opal_convertor_t *convertor,
|
||||
uint8_t order, size_t reserve, size_t *size,
|
||||
uint32_t flags)
|
||||
{
|
||||
if (OPAL_LIKELY(reserve)) {
|
||||
return mca_btl_scif_prepare_src_send (btl, endpoint, convertor,
|
||||
order, reserve, size, flags);
|
||||
} else {
|
||||
return mca_btl_scif_prepare_dma_conv (btl, endpoint, registration, convertor, order, size, flags);
|
||||
}
|
||||
}
|
||||
|
||||
static mca_btl_base_descriptor_t *mca_btl_scif_prepare_dst (mca_btl_base_module_t *btl,
|
||||
mca_btl_base_endpoint_t *endpoint,
|
||||
mca_mpool_base_registration_t *registration,
|
||||
opal_convertor_t *convertor, uint8_t order,
|
||||
size_t reserve, size_t *size, uint32_t flags)
|
||||
{
|
||||
return mca_btl_scif_prepare_dma_conv (btl, endpoint, registration, convertor, order, size, flags);
|
||||
return mca_btl_scif_prepare_src_send (btl, endpoint, convertor, order, reserve, size, flags);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -16,63 +16,57 @@
|
||||
|
||||
/**
|
||||
* Initiate a put 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_scif_put (struct mca_btl_base_module_t *btl,
|
||||
struct mca_btl_base_endpoint_t *endpoint,
|
||||
struct mca_btl_base_descriptor_t *des) {
|
||||
mca_btl_scif_segment_t *src = (mca_btl_scif_segment_t *) des->des_local;
|
||||
mca_btl_scif_segment_t *dst = (mca_btl_scif_segment_t *) des->des_remote;
|
||||
size_t len = lmin (src->base.seg_len, dst->base.seg_len);
|
||||
int rc, mark, flags = 0;
|
||||
int mca_btl_scif_put (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address,
|
||||
uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle,
|
||||
mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags,
|
||||
int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata)
|
||||
{
|
||||
int rc, mark, scif_flags = 0;
|
||||
off_t roffset, loffset;
|
||||
#if defined(SCIF_TIMING)
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
||||
|
||||
mca_btl_scif_component.put_count++;
|
||||
mca_btl_scif_component.get_count++;
|
||||
#endif
|
||||
|
||||
BTL_VERBOSE(("Using DMA Put for frag %p", (void *) des));
|
||||
BTL_VERBOSE(("Using DMA Put from local address %p to remote address %" PRIx64,
|
||||
local_address, remote_address));
|
||||
|
||||
roffset = dst->scif_offset + (off_t)(dst->orig_ptr - dst->base.seg_addr.lval);
|
||||
loffset = src->scif_offset + (off_t)(src->orig_ptr - src->base.seg_addr.lval);
|
||||
roffset = remote_handle->scif_offset + (off_t)(remote_address - remote_handle->scif_base);
|
||||
loffset = local_handle->scif_offset + (off_t)((intptr_t) local_address - local_handle->scif_base);
|
||||
|
||||
if (mca_btl_scif_component.rma_use_cpu) {
|
||||
flags = SCIF_RMA_USECPU;
|
||||
scif_flags = SCIF_RMA_USECPU;
|
||||
}
|
||||
|
||||
if (mca_btl_scif_component.rma_sync) {
|
||||
flags |= SCIF_RMA_SYNC;
|
||||
scif_flags |= SCIF_RMA_SYNC;
|
||||
}
|
||||
|
||||
/* start the write */
|
||||
rc = scif_writeto (endpoint->scif_epd, loffset, len, roffset, flags);
|
||||
rc = scif_writeto (endpoint->scif_epd, loffset, size, roffset, scif_flags);
|
||||
rc = scif_readfrom (endpoint->scif_epd, loffset, size, roffset, scif_flags);
|
||||
if (OPAL_UNLIKELY(-1 == rc)) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
/* always call the callback function */
|
||||
des->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
|
||||
|
||||
/* according to the scif documentation is is better to use a fence rather
|
||||
* than using the SCIF_RMA_SYNC flag with scif_writeto */
|
||||
if (!(flags & SCIF_RMA_SYNC)) {
|
||||
if (!(scif_flags & SCIF_RMA_SYNC)) {
|
||||
/* according to the scif documentation is is better to use a fence rather
|
||||
* than using the SCIF_RMA_SYNC flag with scif_readfrom */
|
||||
scif_fence_mark (endpoint->scif_epd, SCIF_FENCE_INIT_SELF, &mark);
|
||||
scif_fence_wait (endpoint->scif_epd, mark);
|
||||
}
|
||||
|
||||
#if defined(SCIF_TIMING)
|
||||
SCIF_UPDATE_TIMER(mca_btl_scif_component.put_time,
|
||||
mca_btl_scif_component.put_time_max, ts);
|
||||
SCIF_UPDATE_TIMER(mca_btl_scif_component.get_time,
|
||||
mca_btl_scif_component.get_time_max, ts);
|
||||
#endif
|
||||
|
||||
/* since we completed the fence the RMA operation is complete */
|
||||
mca_btl_scif_frag_complete ((mca_btl_scif_base_frag_t *) des, OPAL_SUCCESS);
|
||||
/* always call the callback function */
|
||||
cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
@ -118,22 +118,22 @@ static int mca_btl_scif_send_frag (struct mca_btl_base_endpoint_t *endpoint,
|
||||
unsigned char * restrict dst;
|
||||
|
||||
BTL_VERBOSE(("btl/scif sending descriptor %p from %d -> %d. length = %" PRIu64, (void *) frag,
|
||||
OPAL_PROC_MY_NAME.vpid, endpoint->peer_proc->proc_name.vpid, frag->segments[0].base.seg_len));
|
||||
opal_process_name_vpid(OPAL_PROC_MY_NAME), opal_process_name_vpid(endpoint->peer_proc->proc_name), frag->segments[0].seg_len));
|
||||
|
||||
if (OPAL_LIKELY(OPAL_SUCCESS == mca_btl_scif_send_get_buffer (endpoint, size, &dst))) {
|
||||
unsigned char * restrict data = (unsigned char * restrict) frag->segments[0].base.seg_addr.pval;
|
||||
unsigned char * restrict data = (unsigned char * restrict) frag->segments[0].seg_addr.pval;
|
||||
#if defined(SCIF_TIMING)
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
|
||||
#endif
|
||||
|
||||
memcpy (dst + sizeof (frag->hdr), data, frag->segments[0].base.seg_len);
|
||||
memcpy (dst + sizeof (frag->hdr), data, frag->segments[0].seg_len);
|
||||
|
||||
if (frag->segments[1].base.seg_len) {
|
||||
memcpy (dst + sizeof (frag->hdr) + frag->segments[0].base.seg_len,
|
||||
frag->segments[1].base.seg_addr.pval,
|
||||
frag->segments[1].base.seg_len);
|
||||
if (frag->segments[1].seg_len) {
|
||||
memcpy (dst + sizeof (frag->hdr) + frag->segments[0].seg_len,
|
||||
frag->segments[1].seg_addr.pval,
|
||||
frag->segments[1].seg_len);
|
||||
}
|
||||
|
||||
#if defined(SCIF_USE_SEQ)
|
||||
@ -165,7 +165,7 @@ int mca_btl_scif_send (struct mca_btl_base_module_t *btl,
|
||||
mca_btl_base_tag_t tag)
|
||||
{
|
||||
mca_btl_scif_base_frag_t *frag = (mca_btl_scif_base_frag_t *) descriptor;
|
||||
size_t size = frag->segments[0].base.seg_len + frag->segments[1].base.seg_len;
|
||||
size_t size = frag->segments[0].seg_len + frag->segments[1].seg_len;
|
||||
int rc;
|
||||
|
||||
frag->hdr.tag = tag;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user