1
1

added optional copy routine to allow "derived" class

of mca_bml_base_endpoint to copy state if an endpoint
is updated (e.g. btl deleted/added)

This commit was SVN r9814.
Этот коммит содержится в:
Tim Woodall 2006-05-04 15:19:12 +00:00
родитель 14293acce0
Коммит fdd622544b
4 изменённых файлов: 122 добавлений и 90 удалений

Просмотреть файл

@ -27,6 +27,7 @@
static void mca_bml_base_endpoint_construct(mca_bml_base_endpoint_t* ep)
{
ep->copy = NULL;
ep->btl_rdma_offset = 0;
ep->btl_max_send_size = 0;
ep->btl_rdma_size = 0;

Просмотреть файл

@ -203,7 +203,13 @@ static inline mca_bml_base_btl_t* mca_bml_base_btl_array_find(
return NULL;
}
/**
* Hook to copy derived class info.
*/
typedef void (*mca_bml_base_endpoint_copy_fn_t)(
struct mca_bml_base_endpoint_t* dst,
struct mca_bml_base_endpoint_t* src);
/**
* Structure associated w/ ompi_proc_t that contains the set
@ -218,6 +224,7 @@ struct mca_bml_base_endpoint_t {
mca_bml_base_btl_array_t btl_eager; /**< array of btls to use for first fragments */
mca_bml_base_btl_array_t btl_send; /**< array of btls to use for remaining fragments */
mca_bml_base_btl_array_t btl_rdma; /**< array of btls that support (prefer) rdma */
mca_bml_base_endpoint_copy_fn_t copy;
};
typedef struct mca_bml_base_endpoint_t mca_bml_base_endpoint_t;
@ -514,6 +521,19 @@ typedef int (*mca_bml_base_module_add_btl_fn_t)( struct mca_btl_base_module_t* )
*/
typedef int (*mca_bml_base_module_del_btl_fn_t)( struct mca_btl_base_module_t* );
/**
* Notification of change to the btl list.
*
* @param bml (IN) BTL module
* @return Status indicating if cleanup was successful
*
* On failure of a btl, remove it from the set of forwarding
* entries used by the BML.
*/
typedef int (*mca_bml_base_module_del_proc_btl_fn_t)(
struct ompi_proc_t*,
struct mca_btl_base_module_t* );
/**
* Callback function that is called asynchronously on receipt
* of data by the transport layer.
@ -559,12 +579,13 @@ struct mca_bml_base_module_t {
size_t bml_max_rdma_size; /**< maximum rdma fragment size supported by the BML */
/* BML function table */
mca_bml_base_module_add_procs_fn_t bml_add_procs;
mca_bml_base_module_del_procs_fn_t bml_del_procs;
mca_bml_base_module_add_btl_fn_t bml_add_btl;
mca_bml_base_module_del_btl_fn_t bml_del_btl;
mca_bml_base_module_register_fn_t bml_register;
mca_bml_base_module_finalize_fn_t bml_finalize;
mca_bml_base_module_add_procs_fn_t bml_add_procs;
mca_bml_base_module_del_procs_fn_t bml_del_procs;
mca_bml_base_module_add_btl_fn_t bml_add_btl;
mca_bml_base_module_del_btl_fn_t bml_del_btl;
mca_bml_base_module_del_proc_btl_fn_t bml_del_proc_btl;
mca_bml_base_module_register_fn_t bml_register;
mca_bml_base_module_finalize_fn_t bml_finalize;
mca_bml_base_module_progress_fn_t bml_progress;

Просмотреть файл

@ -45,6 +45,7 @@ mca_bml_r2_module_t mca_bml_r2 = {
mca_bml_r2_del_procs,
mca_bml_r2_add_btl,
mca_bml_r2_del_btl,
mca_bml_r2_del_proc_btl,
mca_bml_r2_register,
mca_bml_r2_finalize,
mca_bml_r2_progress
@ -282,9 +283,6 @@ int mca_bml_r2_add_procs(
continue;
}
}
/* cache the endpoint on the proc */
bml_btl = mca_bml_base_btl_array_insert(&bml_endpoint->btl_send);
@ -501,89 +499,99 @@ int mca_bml_r2_del_btl(mca_btl_base_module_t* btl)
return OMPI_SUCCESS;
for(p=0; p<num_procs; p++) {
double total_bandwidth = 0;
ompi_proc_t* proc = procs[p];
mca_bml_base_endpoint_t* ep_old = (mca_bml_base_endpoint_t*)proc->proc_pml;
mca_bml_base_endpoint_t* ep_new = OBJ_NEW(mca_bml_base_endpoint_t);
size_t b;
/* initialize */
ep_new->super.proc_ompi = proc;
ep_new->btl_max_send_size = -1;
ep_new->btl_rdma_size = -1;
ep_new->btl_rdma_align = 0;
ep_new->btl_rdma_offset = 0;
/* build new eager list */
mca_bml_base_btl_array_reserve(&ep_new->btl_eager, mca_bml_base_btl_array_get_size(&ep_old->btl_eager));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_eager); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_eager, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_eager);
*bml_btl_new = *bml_btl_old;
}
}
/* build new send list */
total_bandwidth = 0;
mca_bml_base_btl_array_reserve(&ep_new->btl_send, mca_bml_base_btl_array_get_size(&ep_old->btl_send));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_send); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_send, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_send);
*bml_btl_new = *bml_btl_old;
total_bandwidth += bml_btl_new->btl->btl_bandwidth;
if (bml_btl_new->btl_max_send_size < ep_new->btl_max_send_size) {
ep_new->btl_max_send_size = bml_btl_new->btl->btl_max_send_size;
}
}
}
/* compute weighting factor for this btl */
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_new->btl_send); b++) {
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep_old->btl_send, b);
if(bml_btl->btl->btl_bandwidth > 0) {
bml_btl->btl_weight = bml_btl->btl->btl_bandwidth / total_bandwidth;
} else {
bml_btl->btl_weight = 1.0 / mca_bml_base_btl_array_get_size(&ep_new->btl_send);
}
}
/* build new rdma list */
total_bandwidth = 0;
mca_bml_base_btl_array_reserve(&ep_new->btl_rdma, mca_bml_base_btl_array_get_size(&ep_old->btl_rdma));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_rdma); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_rdma, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_rdma);
*bml_btl_new = *bml_btl_old;
/* update aggregate endpoint info */
total_bandwidth += bml_btl_new->btl->btl_bandwidth;
if (ep_new->btl_rdma_offset < bml_btl_new->btl_min_rdma_size) {
ep_new->btl_rdma_offset = bml_btl_new->btl_min_rdma_size;
}
if (ep_new->btl_rdma_size > bml_btl_new->btl_max_rdma_size) {
ep_new->btl_rdma_size = bml_btl_new->btl_max_rdma_size;
ep_new->btl_rdma_align = bml_base_log2(ep_new->btl_rdma_size);
}
}
}
/* compute weighting factor for this btl */
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_new->btl_rdma); b++) {
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep_old->btl_rdma, b);
if(bml_btl->btl->btl_bandwidth > 0) {
bml_btl->btl_weight = bml_btl->btl->btl_bandwidth / total_bandwidth;
} else {
bml_btl->btl_weight = 1.0 / mca_bml_base_btl_array_get_size(&ep_new->btl_rdma);
}
}
/* save on proc */
proc->proc_pml = (mca_pml_proc_t*)ep_new;
/* DONT delete old endpoint structure as it may still be in use... */
mca_bml_r2_del_proc_btl(proc, btl);
}
free(procs);
return OMPI_SUCCESS;
}
int mca_bml_r2_del_proc_btl(ompi_proc_t* proc, mca_btl_base_module_t* btl)
{
mca_bml_base_endpoint_t* ep_old = (mca_bml_base_endpoint_t*)proc->proc_pml;
mca_bml_base_endpoint_t* ep_new = opal_obj_new(mca_bml_r2.endpoint_class);
double total_bandwidth = 0;
size_t b;
/* initialize */
ep_new->super.proc_ompi = proc;
ep_new->btl_max_send_size = -1;
ep_new->btl_rdma_size = -1;
ep_new->btl_rdma_align = 0;
ep_new->btl_rdma_offset = 0;
/* build new eager list */
mca_bml_base_btl_array_reserve(&ep_new->btl_eager, mca_bml_base_btl_array_get_size(&ep_old->btl_eager));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_eager); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_eager, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_eager);
*bml_btl_new = *bml_btl_old;
}
}
/* build new send list */
total_bandwidth = 0;
mca_bml_base_btl_array_reserve(&ep_new->btl_send, mca_bml_base_btl_array_get_size(&ep_old->btl_send));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_send); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_send, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_send);
*bml_btl_new = *bml_btl_old;
total_bandwidth += bml_btl_new->btl->btl_bandwidth;
if (bml_btl_new->btl_max_send_size < ep_new->btl_max_send_size) {
ep_new->btl_max_send_size = bml_btl_new->btl->btl_max_send_size;
}
}
}
/* compute weighting factor for this btl */
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_new->btl_send); b++) {
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep_old->btl_send, b);
if(bml_btl->btl->btl_bandwidth > 0) {
bml_btl->btl_weight = bml_btl->btl->btl_bandwidth / total_bandwidth;
} else {
bml_btl->btl_weight = 1.0 / mca_bml_base_btl_array_get_size(&ep_new->btl_send);
}
}
/* build new rdma list */
total_bandwidth = 0;
mca_bml_base_btl_array_reserve(&ep_new->btl_rdma, mca_bml_base_btl_array_get_size(&ep_old->btl_rdma));
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_old->btl_rdma); b++) {
mca_bml_base_btl_t* bml_btl_old = mca_bml_base_btl_array_get_index(&ep_old->btl_rdma, b);
if(bml_btl_old->btl != btl) {
mca_bml_base_btl_t* bml_btl_new = mca_bml_base_btl_array_insert(&ep_new->btl_rdma);
*bml_btl_new = *bml_btl_old;
/* update aggregate endpoint info */
total_bandwidth += bml_btl_new->btl->btl_bandwidth;
if (ep_new->btl_rdma_offset < bml_btl_new->btl_min_rdma_size) {
ep_new->btl_rdma_offset = bml_btl_new->btl_min_rdma_size;
}
if (ep_new->btl_rdma_size > bml_btl_new->btl_max_rdma_size) {
ep_new->btl_rdma_size = bml_btl_new->btl_max_rdma_size;
ep_new->btl_rdma_align = bml_base_log2(ep_new->btl_rdma_size);
}
}
}
/* compute weighting factor for this btl */
for(b=0; b< mca_bml_base_btl_array_get_size(&ep_new->btl_rdma); b++) {
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep_old->btl_rdma, b);
if(bml_btl->btl->btl_bandwidth > 0) {
bml_btl->btl_weight = bml_btl->btl->btl_bandwidth / total_bandwidth;
} else {
bml_btl->btl_weight = 1.0 / mca_bml_base_btl_array_get_size(&ep_new->btl_rdma);
}
}
/* copy over any additional state ... */
if(NULL != ep_new->copy) {
ep_new->copy(ep_new, ep_old);
}
/* save on proc */
proc->proc_pml = (mca_pml_proc_t*)ep_new;
return OMPI_SUCCESS;
}

Просмотреть файл

@ -89,6 +89,8 @@ int mca_bml_r2_add_btl( mca_btl_base_module_t* btl );
int mca_bml_r2_del_btl( mca_btl_base_module_t* btl );
int mca_bml_r2_del_proc_btl( struct ompi_proc_t* proc, mca_btl_base_module_t* btl );
int mca_bml_r2_register(
mca_btl_base_tag_t tag,
mca_bml_base_module_recv_cb_fn_t cbfunc,