2005-08-12 06:41:14 +04:00
|
|
|
/*
|
2007-02-21 19:18:43 +03:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2008-09-16 02:56:23 +04:00
|
|
|
* Copyright (c) 2004-2008 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-08-12 06:41:14 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2006-03-28 02:48:12 +04:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
2005-08-12 06:41:14 +04:00
|
|
|
* All rights reserved.
|
2007-03-26 20:01:27 +04:00
|
|
|
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2008-08-08 16:39:30 +04:00
|
|
|
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
2005-08-12 06:41:14 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2008-09-12 00:52:58 +04:00
|
|
|
#include "opal/util/argv.h"
|
2008-06-09 18:53:58 +04:00
|
|
|
#include "orte/util/show_help.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/class/ompi_bitmap.h"
|
2005-09-13 00:22:59 +04:00
|
|
|
#include "ompi/mca/bml/bml.h"
|
2007-02-21 19:18:43 +03:00
|
|
|
#include "ompi/mca/bml/base/base.h"
|
2005-09-13 00:22:59 +04:00
|
|
|
#include "ompi/mca/btl/btl.h"
|
|
|
|
#include "ompi/mca/btl/base/base.h"
|
|
|
|
#include "ompi/mca/bml/base/bml_base_btl.h"
|
2005-08-12 06:41:14 +04:00
|
|
|
#include "bml_r2.h"
|
2008-02-28 04:57:57 +03:00
|
|
|
#include "orte/util/name_fns.h"
|
2005-09-13 00:22:59 +04:00
|
|
|
#include "ompi/proc/proc.h"
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
extern mca_bml_base_component_t mca_bml_r2_component;
|
|
|
|
|
2008-09-12 00:52:58 +04:00
|
|
|
/* Names of all the BTL components that this BML is aware of */
|
|
|
|
static char *btl_names = NULL;
|
|
|
|
|
2006-02-09 18:49:51 +03:00
|
|
|
static inline unsigned int bml_base_log2(unsigned long val) {
|
|
|
|
unsigned int count = 0;
|
|
|
|
while(val > 0) {
|
|
|
|
val = val >> 1;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
return count > 0 ? count-1: 0;
|
|
|
|
}
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
static int btl_exclusivity_compare(const void* arg1, const void* arg2)
|
|
|
|
{
|
|
|
|
mca_btl_base_module_t* btl1 = *(struct mca_btl_base_module_t**)arg1;
|
|
|
|
mca_btl_base_module_t* btl2 = *(struct mca_btl_base_module_t**)arg2;
|
|
|
|
if( btl1->btl_exclusivity > btl2->btl_exclusivity ) {
|
|
|
|
return -1;
|
|
|
|
} else if (btl1->btl_exclusivity == btl2->btl_exclusivity ) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_bml_r2_add_btls( void )
|
|
|
|
{
|
2008-09-12 00:52:58 +04:00
|
|
|
int i;
|
2005-08-15 23:39:56 +04:00
|
|
|
opal_list_t *btls = NULL;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_btl_base_selected_module_t* selected_btl;
|
2005-08-15 23:39:56 +04:00
|
|
|
size_t num_btls = 0;
|
2008-09-12 00:52:58 +04:00
|
|
|
char **btl_names_argv = NULL;
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-08-24 14:39:23 +04:00
|
|
|
if(true == mca_bml_r2.btls_added) {
|
2005-08-15 23:39:56 +04:00
|
|
|
return OMPI_SUCCESS;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
|
|
|
|
/* build an array of r2s and r2 modules */
|
|
|
|
btls = &mca_btl_base_modules_initialized;
|
|
|
|
num_btls = opal_list_get_size(btls);
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
mca_bml_r2.num_btl_modules = 0;
|
|
|
|
mca_bml_r2.num_btl_progress = 0;
|
|
|
|
|
|
|
|
mca_bml_r2.btl_modules = (mca_btl_base_module_t **)malloc(sizeof(mca_btl_base_module_t*) * num_btls);
|
|
|
|
mca_bml_r2.btl_progress = (mca_btl_base_component_progress_fn_t*)malloc(sizeof(mca_btl_base_component_progress_fn_t) * num_btls);
|
|
|
|
|
|
|
|
if (NULL == mca_bml_r2.btl_modules ||
|
|
|
|
NULL == mca_bml_r2.btl_progress) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(selected_btl = (mca_btl_base_selected_module_t*)opal_list_get_first(btls);
|
|
|
|
selected_btl != (mca_btl_base_selected_module_t*)opal_list_get_end(btls);
|
|
|
|
selected_btl = (mca_btl_base_selected_module_t*)opal_list_get_next(selected_btl)) {
|
|
|
|
mca_btl_base_module_t *btl = selected_btl->btl_module;
|
|
|
|
mca_bml_r2.btl_modules[mca_bml_r2.num_btl_modules++] = btl;
|
2008-09-12 00:52:58 +04:00
|
|
|
for (i = 0; NULL != btl_names_argv && NULL != btl_names_argv[i]; ++i) {
|
|
|
|
if (0 ==
|
|
|
|
strcmp(btl_names_argv[i],
|
|
|
|
btl->btl_component->btl_version.mca_component_name)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NULL == btl_names_argv || NULL == btl_names_argv[i]) {
|
|
|
|
opal_argv_append_nosize(&btl_names_argv,
|
|
|
|
btl->btl_component->btl_version.mca_component_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NULL != btl_names_argv) {
|
|
|
|
btl_names = opal_argv_join(btl_names_argv, ' ');
|
|
|
|
opal_argv_free(btl_names_argv);
|
|
|
|
} else {
|
|
|
|
btl_names = strdup("no devices available");
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* sort r2 list by exclusivity */
|
|
|
|
qsort(mca_bml_r2.btl_modules,
|
|
|
|
mca_bml_r2.num_btl_modules,
|
|
|
|
sizeof(struct mca_btl_base_module_t*),
|
|
|
|
btl_exclusivity_compare);
|
2005-08-12 20:59:15 +04:00
|
|
|
mca_bml_r2.btls_added = true;
|
2005-08-12 06:41:14 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-07-01 15:34:23 +04:00
|
|
|
static int btl_bandwidth_compare(const void *v1, const void *v2)
|
|
|
|
{
|
|
|
|
mca_bml_base_btl_t *b1 = (mca_bml_base_btl_t*)v1,
|
|
|
|
*b2 = (mca_bml_base_btl_t*)v2;
|
|
|
|
|
|
|
|
return b2->btl->btl_bandwidth - b1->btl->btl_bandwidth;
|
|
|
|
}
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/*
|
2007-07-25 21:26:23 +04:00
|
|
|
* For each proc setup a datastructure that indicates the BTLs
|
2005-08-12 06:41:14 +04:00
|
|
|
* that can be used to reach the destination.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_add_procs( size_t nprocs,
|
|
|
|
struct ompi_proc_t** procs,
|
|
|
|
struct ompi_bitmap_t* reachable )
|
2005-08-12 06:41:14 +04:00
|
|
|
{
|
2008-07-24 14:33:17 +04:00
|
|
|
size_t p, p_index, n_new_procs = 0;
|
2005-08-12 06:41:14 +04:00
|
|
|
struct mca_btl_base_endpoint_t ** btl_endpoints = NULL;
|
2005-08-15 23:39:56 +04:00
|
|
|
struct ompi_proc_t** new_procs = NULL;
|
2006-08-14 23:17:36 +04:00
|
|
|
struct ompi_proc_t *unreach_proc = NULL;
|
2008-07-24 14:33:17 +04:00
|
|
|
int rc, ret = OMPI_SUCCESS;
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-08-24 14:39:23 +04:00
|
|
|
if(0 == nprocs) {
|
2005-08-12 06:41:14 +04:00
|
|
|
return OMPI_SUCCESS;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-12 20:59:15 +04:00
|
|
|
|
2005-08-24 14:39:23 +04:00
|
|
|
if(OMPI_SUCCESS != (rc = mca_bml_r2_add_btls()) ) {
|
2005-08-12 06:41:14 +04:00
|
|
|
return rc;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
/* Select only the procs that don't yet have the BML proc struct. This prevent
|
|
|
|
* us from calling btl->add_procs several this on the same destination proc.
|
|
|
|
*/
|
2005-08-12 20:59:15 +04:00
|
|
|
for(p_index = 0; p_index < nprocs; p_index++) {
|
2008-09-30 19:47:43 +04:00
|
|
|
struct ompi_proc_t* proc = procs[p_index];
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
OBJ_RETAIN(proc);
|
2006-07-04 05:20:20 +04:00
|
|
|
if(NULL != proc->proc_bml) {
|
2008-09-30 19:47:43 +04:00
|
|
|
continue; /* go to the next proc */
|
2005-08-12 20:59:15 +04:00
|
|
|
}
|
2008-09-30 19:47:43 +04:00
|
|
|
/* Allocate the new_procs on demand */
|
|
|
|
if( NULL == new_procs ) {
|
|
|
|
new_procs = (struct ompi_proc_t **)malloc(nprocs * sizeof(struct ompi_proc_t *));
|
|
|
|
if( NULL == new_procs ) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
new_procs[n_new_procs++] = proc;
|
2005-08-12 20:59:15 +04:00
|
|
|
}
|
2005-10-13 00:59:25 +04:00
|
|
|
|
|
|
|
if ( 0 == n_new_procs ) {
|
2007-04-14 06:06:05 +04:00
|
|
|
return OMPI_SUCCESS;
|
2005-10-13 00:59:25 +04:00
|
|
|
}
|
2008-09-30 19:47:43 +04:00
|
|
|
|
|
|
|
/* Starting from here we only work on the unregistered procs */
|
2005-08-31 23:44:28 +04:00
|
|
|
procs = new_procs;
|
|
|
|
nprocs = n_new_procs;
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/* attempt to add all procs to each r2 */
|
2005-08-14 23:03:09 +04:00
|
|
|
btl_endpoints = (struct mca_btl_base_endpoint_t **)
|
|
|
|
malloc(nprocs * sizeof(struct mca_btl_base_endpoint_t*));
|
2005-08-24 14:39:23 +04:00
|
|
|
if (NULL == btl_endpoints) {
|
2008-09-30 19:47:43 +04:00
|
|
|
free(new_procs);
|
2005-08-24 14:39:23 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2008-09-12 00:52:58 +04:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
for(p_index = 0; p_index < mca_bml_r2.num_btl_modules; p_index++) {
|
|
|
|
mca_btl_base_module_t* btl = mca_bml_r2.btl_modules[p_index];
|
|
|
|
int btl_inuse = 0;
|
2008-09-12 00:52:58 +04:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/* if the r2 can reach the destination proc it sets the
|
|
|
|
* corresponding bit (proc index) in the reachable bitmap
|
|
|
|
* and can return addressing information for each proc
|
|
|
|
* that is passed back to the r2 on data transfer calls
|
|
|
|
*/
|
|
|
|
ompi_bitmap_clear_all_bits(reachable);
|
|
|
|
memset(btl_endpoints, 0, nprocs *sizeof(struct mca_btl_base_endpoint_t*));
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
rc = btl->btl_add_procs(btl, n_new_procs, new_procs, btl_endpoints, reachable);
|
2005-08-12 06:41:14 +04:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
2008-07-29 22:38:11 +04:00
|
|
|
/* This BTL has troubles adding the nodes. Let's continue maybe some other BTL
|
|
|
|
* can take care of this task.
|
|
|
|
*/
|
|
|
|
continue;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
/* for each proc that is reachable */
|
|
|
|
for( p = 0; p < n_new_procs; p++ ) {
|
2005-08-12 06:41:14 +04:00
|
|
|
if(ompi_bitmap_is_set_bit(reachable, p)) {
|
2005-08-15 23:39:56 +04:00
|
|
|
ompi_proc_t *proc = new_procs[p];
|
2006-07-04 05:20:20 +04:00
|
|
|
mca_bml_base_endpoint_t * bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_bml;
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl;
|
|
|
|
size_t size;
|
2005-08-12 20:59:15 +04:00
|
|
|
|
2005-08-15 19:19:07 +04:00
|
|
|
if(NULL == bml_endpoint) {
|
2005-08-13 01:42:55 +04:00
|
|
|
/* allocate bml specific proc data */
|
2006-07-04 05:20:20 +04:00
|
|
|
bml_endpoint = OBJ_NEW(mca_bml_base_endpoint_t);
|
2005-08-13 01:42:55 +04:00
|
|
|
if (NULL == bml_endpoint) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "mca_bml_r2_add_procs: unable to allocate resources");
|
2005-08-13 01:42:55 +04:00
|
|
|
free(btl_endpoints);
|
2008-09-30 19:47:43 +04:00
|
|
|
free(new_procs);
|
2005-08-13 01:42:55 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* preallocate space in array for max number of r2s */
|
|
|
|
mca_bml_base_btl_array_reserve(&bml_endpoint->btl_eager, mca_bml_r2.num_btl_modules);
|
|
|
|
mca_bml_base_btl_array_reserve(&bml_endpoint->btl_send, mca_bml_r2.num_btl_modules);
|
|
|
|
mca_bml_base_btl_array_reserve(&bml_endpoint->btl_rdma, mca_bml_r2.num_btl_modules);
|
2005-12-21 18:11:40 +03:00
|
|
|
bml_endpoint->btl_max_send_size = -1;
|
2006-07-04 05:20:20 +04:00
|
|
|
bml_endpoint->btl_proc = proc;
|
|
|
|
proc->proc_bml = bml_endpoint;
|
2006-06-28 00:23:47 +04:00
|
|
|
|
|
|
|
bml_endpoint->btl_flags_and = 0;
|
|
|
|
bml_endpoint->btl_flags_or = 0;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
2005-08-13 01:42:55 +04:00
|
|
|
|
2005-08-15 19:19:07 +04:00
|
|
|
/* dont allow an additional BTL with a lower exclusivity ranking */
|
2005-08-12 06:41:14 +04:00
|
|
|
size = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send);
|
|
|
|
if(size > 0) {
|
|
|
|
bml_btl = mca_bml_base_btl_array_get_index(&bml_endpoint->btl_send, size-1);
|
|
|
|
/* skip this btl if the exclusivity is less than the previous */
|
|
|
|
if(bml_btl->btl->btl_exclusivity > btl->btl_exclusivity) {
|
2008-09-30 19:47:43 +04:00
|
|
|
btl->btl_del_procs(btl, 1, &proc, &btl_endpoints[p]);
|
2005-08-12 06:41:14 +04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2005-08-13 01:42:55 +04:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/* cache the endpoint on the proc */
|
|
|
|
bml_btl = mca_bml_base_btl_array_insert(&bml_endpoint->btl_send);
|
|
|
|
bml_btl->btl = btl;
|
|
|
|
bml_btl->btl_eager_limit = btl->btl_eager_limit;
|
2007-12-16 11:35:17 +03:00
|
|
|
bml_btl->btl_rndv_eager_limit = btl->btl_rndv_eager_limit;
|
2005-08-12 06:41:14 +04:00
|
|
|
bml_btl->btl_max_send_size = btl->btl_max_send_size;
|
2007-06-21 11:12:40 +04:00
|
|
|
bml_btl->btl_rdma_pipeline_send_length =
|
|
|
|
btl->btl_rdma_pipeline_send_length;
|
2007-05-17 11:54:27 +04:00
|
|
|
bml_btl->btl_rdma_pipeline_frag_size =
|
|
|
|
btl->btl_rdma_pipeline_frag_size;
|
|
|
|
bml_btl->btl_min_rdma_pipeline_size =
|
|
|
|
btl->btl_min_rdma_pipeline_size;
|
2005-08-12 06:41:14 +04:00
|
|
|
bml_btl->btl_endpoint = btl_endpoints[p];
|
|
|
|
bml_btl->btl_weight = 0;
|
|
|
|
bml_btl->btl_alloc = btl->btl_alloc;
|
|
|
|
bml_btl->btl_free = btl->btl_free;
|
|
|
|
bml_btl->btl_prepare_src = btl->btl_prepare_src;
|
|
|
|
bml_btl->btl_prepare_dst = btl->btl_prepare_dst;
|
|
|
|
bml_btl->btl_send = btl->btl_send;
|
2008-05-30 07:58:39 +04:00
|
|
|
bml_btl->btl_sendi = btl->btl_sendi;
|
2006-06-27 00:00:18 +04:00
|
|
|
bml_btl->btl_flags = btl->btl_flags;
|
2005-08-12 06:41:14 +04:00
|
|
|
bml_btl->btl_put = btl->btl_put;
|
2006-06-27 00:00:18 +04:00
|
|
|
if( (bml_btl->btl_flags & MCA_BTL_FLAGS_PUT) && (NULL == bml_btl->btl_put) ) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "mca_bml_r2_add_procs: The PUT flag is specified for"
|
2006-06-27 00:00:18 +04:00
|
|
|
" the %s BTL without any PUT function attached. Disard the flag !",
|
|
|
|
bml_btl->btl->btl_component->btl_version.mca_component_name);
|
|
|
|
bml_btl->btl_flags ^= MCA_BTL_FLAGS_PUT;
|
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
bml_btl->btl_get = btl->btl_get;
|
2006-06-27 00:00:18 +04:00
|
|
|
if( (bml_btl->btl_flags & MCA_BTL_FLAGS_GET) && (NULL == bml_btl->btl_get) ) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "mca_bml_r2_add_procs: The GET flag is specified for"
|
2006-06-27 00:00:18 +04:00
|
|
|
" the %s BTL without any GET function attached. Disard the flag !",
|
|
|
|
bml_btl->btl->btl_component->btl_version.mca_component_name);
|
|
|
|
bml_btl->btl_flags ^= MCA_BTL_FLAGS_GET;
|
|
|
|
}
|
2005-09-13 02:28:23 +04:00
|
|
|
bml_btl->btl_mpool = btl->btl_mpool;
|
2006-06-27 00:00:18 +04:00
|
|
|
if( (bml_btl->btl_flags & (MCA_BTL_FLAGS_PUT | MCA_BTL_FLAGS_GET | MCA_BTL_FLAGS_SEND)) == 0 ) {
|
|
|
|
/**
|
|
|
|
* If no protocol specified, we have 2 choices: we ignore the BTL
|
|
|
|
* as we don't know which protocl to use, or we suppose that all
|
|
|
|
* BTLs support the send protocol.
|
|
|
|
*/
|
|
|
|
bml_btl->btl_flags |= MCA_BTL_FLAGS_SEND;
|
|
|
|
}
|
2006-06-28 00:23:47 +04:00
|
|
|
/**
|
|
|
|
* calculate the bitwise OR and AND of the btl flags
|
|
|
|
*/
|
|
|
|
bml_endpoint->btl_flags_or |= bml_btl->btl_flags;
|
|
|
|
bml_endpoint->btl_flags_and &= bml_btl->btl_flags;
|
2008-07-24 14:33:17 +04:00
|
|
|
/* This BTL is in use, allow the progress registration */
|
|
|
|
btl_inuse++;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(btl_inuse > 0 && NULL != btl->btl_component->btl_progress) {
|
|
|
|
size_t p;
|
|
|
|
bool found = false;
|
2008-09-16 02:56:23 +04:00
|
|
|
for( p = 0; p < mca_bml_r2.num_btl_progress; p++ ) {
|
2005-08-12 06:41:14 +04:00
|
|
|
if(mca_bml_r2.btl_progress[p] == btl->btl_component->btl_progress) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(found == false) {
|
|
|
|
mca_bml_r2.btl_progress[mca_bml_r2.num_btl_progress] =
|
|
|
|
btl->btl_component->btl_progress;
|
|
|
|
mca_bml_r2.num_btl_progress++;
|
2008-09-16 02:56:23 +04:00
|
|
|
opal_progress_register( btl->btl_component->btl_progress );
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(btl_endpoints);
|
|
|
|
|
|
|
|
/* iterate back through procs and compute metrics for registered r2s */
|
2005-08-15 23:39:56 +04:00
|
|
|
for(p=0; p<n_new_procs; p++) {
|
|
|
|
ompi_proc_t *proc = new_procs[p];
|
2006-07-04 05:20:20 +04:00
|
|
|
mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_bml;
|
2005-08-12 06:41:14 +04:00
|
|
|
double total_bandwidth = 0;
|
2006-06-29 19:13:58 +04:00
|
|
|
uint32_t latency = 0xffffffff;
|
2005-08-12 06:41:14 +04:00
|
|
|
size_t n_index;
|
|
|
|
size_t n_size;
|
|
|
|
|
2005-08-15 19:19:07 +04:00
|
|
|
/* skip over procs w/ no btl's registered */
|
2005-08-24 14:39:23 +04:00
|
|
|
if(NULL == bml_endpoint) {
|
2005-08-12 06:41:14 +04:00
|
|
|
continue;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
|
2005-08-14 23:03:09 +04:00
|
|
|
/* (1) determine the total bandwidth available across all btls
|
|
|
|
* note that we need to do this here, as we may already have btls configured
|
2005-08-12 06:41:14 +04:00
|
|
|
* (2) determine the highest priority ranking for latency
|
2006-08-20 19:54:04 +04:00
|
|
|
* (3) compute the maximum amount of bytes that can be send without any
|
|
|
|
* weighting. Once the left over is smaller than this number we will
|
|
|
|
* start using the weight to compute the correct amount.
|
2005-08-12 06:41:14 +04:00
|
|
|
*/
|
|
|
|
n_size = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send);
|
2007-07-01 15:34:23 +04:00
|
|
|
|
|
|
|
/* sort BTLs in descending order according to bandwidth value */
|
|
|
|
qsort(bml_endpoint->btl_send.bml_btls, n_size,
|
|
|
|
sizeof(mca_bml_base_btl_t), btl_bandwidth_compare);
|
|
|
|
|
2006-08-20 19:54:04 +04:00
|
|
|
bml_endpoint->bml_max_send_length = 0;
|
|
|
|
bml_endpoint->bml_max_rdma_length = 0;
|
2007-01-18 12:15:18 +03:00
|
|
|
bml_endpoint->btl_rdma_index = 0;
|
2005-08-12 06:41:14 +04:00
|
|
|
for(n_index = 0; n_index < n_size; n_index++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl =
|
|
|
|
mca_bml_base_btl_array_get_index(&bml_endpoint->btl_send, n_index);
|
|
|
|
mca_btl_base_module_t* btl = bml_btl->btl;
|
2006-08-20 19:54:04 +04:00
|
|
|
total_bandwidth += bml_btl->btl->btl_bandwidth;
|
2006-06-29 19:13:58 +04:00
|
|
|
if(btl->btl_latency < latency) {
|
2005-08-12 06:41:14 +04:00
|
|
|
latency = btl->btl_latency;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2006-08-20 19:54:04 +04:00
|
|
|
bml_endpoint->bml_max_send_length += bml_btl->btl->btl_bandwidth;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
2006-06-28 00:23:47 +04:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/* (1) set the weight of each btl as a percentage of overall bandwidth
|
|
|
|
* (2) copy all btl instances at the highest priority ranking into the
|
|
|
|
* list of btls used for first fragments
|
|
|
|
*/
|
|
|
|
for(n_index = 0; n_index < n_size; n_index++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl =
|
|
|
|
mca_bml_base_btl_array_get_index(&bml_endpoint->btl_send, n_index);
|
|
|
|
mca_btl_base_module_t *btl = bml_btl->btl;
|
|
|
|
|
|
|
|
/* compute weighting factor for this r2 */
|
2005-08-24 14:39:23 +04:00
|
|
|
if(btl->btl_bandwidth > 0) {
|
2005-10-12 00:41:51 +04:00
|
|
|
bml_btl->btl_weight = btl->btl_bandwidth / total_bandwidth;
|
2005-08-24 14:39:23 +04:00
|
|
|
} else {
|
2005-10-12 00:41:51 +04:00
|
|
|
bml_btl->btl_weight = 1.0 / n_size;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
|
|
|
|
/* check to see if this r2 is already in the array of r2s
|
|
|
|
* used for first fragments - if not add it.
|
|
|
|
*/
|
|
|
|
if(btl->btl_latency == latency) {
|
|
|
|
mca_bml_base_btl_t* bml_btl_new =
|
|
|
|
mca_bml_base_btl_array_insert(&bml_endpoint->btl_eager);
|
|
|
|
*bml_btl_new = *bml_btl;
|
|
|
|
}
|
|
|
|
|
2005-12-21 18:11:40 +03:00
|
|
|
/* set endpoint max send size as min of available btls */
|
|
|
|
if(bml_endpoint->btl_max_send_size > btl->btl_max_send_size)
|
|
|
|
bml_endpoint->btl_max_send_size = btl->btl_max_send_size;
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
/* check flags - is rdma prefered */
|
2007-08-29 01:23:44 +04:00
|
|
|
if ((btl->btl_flags & (MCA_BTL_FLAGS_PUT|MCA_BTL_FLAGS_GET)) &&
|
|
|
|
!((proc->proc_arch != ompi_proc_local_proc->proc_arch) &&
|
|
|
|
(0 == (btl->btl_flags & MCA_BTL_FLAGS_HETEROGENEOUS_RDMA)))) {
|
2005-08-12 06:41:14 +04:00
|
|
|
mca_bml_base_btl_t* bml_btl_rdma = mca_bml_base_btl_array_insert(&bml_endpoint->btl_rdma);
|
|
|
|
*bml_btl_rdma = *bml_btl;
|
2007-06-21 11:12:40 +04:00
|
|
|
if(bml_endpoint->btl_pipeline_send_length <
|
|
|
|
bml_btl_rdma->btl_rdma_pipeline_send_length) {
|
|
|
|
bml_endpoint->btl_pipeline_send_length =
|
|
|
|
bml_btl_rdma->btl_rdma_pipeline_send_length;
|
2007-05-17 11:54:27 +04:00
|
|
|
}
|
|
|
|
if(bml_endpoint->btl_send_limit < bml_btl_rdma->btl_min_rdma_pipeline_size) {
|
|
|
|
bml_endpoint->btl_send_limit = bml_btl_rdma->btl_min_rdma_pipeline_size;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2006-08-14 23:17:36 +04:00
|
|
|
/* see if we have a connection to everyone else */
|
|
|
|
for(p=0; p<n_new_procs; p++) {
|
|
|
|
ompi_proc_t *proc = new_procs[p];
|
|
|
|
|
|
|
|
if (NULL == proc->proc_bml) {
|
|
|
|
if (NULL == unreach_proc) {
|
|
|
|
unreach_proc = proc;
|
|
|
|
}
|
|
|
|
ret = OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mca_bml_r2.show_unreach_errors &&
|
|
|
|
OMPI_ERR_UNREACH == ret) {
|
This commit represents a bunch of work on a Mercurial side branch. As
such, the commit message back to the master SVN repository is fairly
long.
= ORTE Job-Level Output Messages =
Add two new interfaces that should be used for all new code throughout
the ORTE and OMPI layers (we already make the search-and-replace on
the existing ORTE / OMPI layers):
* orte_output(): (and corresponding friends ORTE_OUTPUT,
orte_output_verbose, etc.) This function sends the output directly
to the HNP for processing as part of a job-specific output
channel. It supports all the same outputs as opal_output()
(syslog, file, stdout, stderr), but for stdout/stderr, the output
is sent to the HNP for processing and output. More on this below.
* orte_show_help(): This function is a drop-in-replacement for
opal_show_help(), with two differences in functionality:
1. the rendered text help message output is sent to the HNP for
display (rather than outputting directly into the process' stderr
stream)
1. the HNP detects duplicate help messages and does not display them
(so that you don't see the same error message N times, once from
each of your N MPI processes); instead, it counts "new" instances
of the help message and displays a message every ~5 seconds when
there are new ones ("I got X new copies of the help message...")
opal_show_help and opal_output still exist, but they only output in
the current process. The intent for the new orte_* functions is that
they can apply job-level intelligence to the output. As such, we
recommend that all new ORTE and OMPI code use the new orte_*
functions, not thei opal_* functions.
=== New code ===
For ORTE and OMPI programmers, here's what you need to do differently
in new code:
* Do not include opal/util/show_help.h or opal/util/output.h.
Instead, include orte/util/output.h (this one header file has
declarations for both the orte_output() series of functions and
orte_show_help()).
* Effectively s/opal_output/orte_output/gi throughout your code.
Note that orte_output_open() takes a slightly different argument
list (as a way to pass data to the filtering stream -- see below),
so you if explicitly call opal_output_open(), you'll need to
slightly adapt to the new signature of orte_output_open().
* Literally s/opal_show_help/orte_show_help/. The function signature
is identical.
=== Notes ===
* orte_output'ing to stream 0 will do similar to what
opal_output'ing did, so leaving a hard-coded "0" as the first
argument is safe.
* For systems that do not use ORTE's RML or the HNP, the effect of
orte_output_* and orte_show_help will be identical to their opal
counterparts (the additional information passed to
orte_output_open() will be lost!). Indeed, the orte_* functions
simply become trivial wrappers to their opal_* counterparts. Note
that we have not tested this; the code is simple but it is quite
possible that we mucked something up.
= Filter Framework =
Messages sent view the new orte_* functions described above and
messages output via the IOF on the HNP will now optionally be passed
through a new "filter" framework before being output to
stdout/stderr. The "filter" OPAL MCA framework is intended to allow
preprocessing to messages before they are sent to their final
destinations. The first component that was written in the filter
framework was to create an XML stream, segregating all the messages
into different XML tags, etc. This will allow 3rd party tools to read
the stdout/stderr from the HNP and be able to know exactly what each
text message is (e.g., a help message, another OMPI infrastructure
message, stdout from the user process, stderr from the user process,
etc.).
Filtering is not active by default. Filter components must be
specifically requested, such as:
{{{
$ mpirun --mca filter xml ...
}}}
There can only be one filter component active.
= New MCA Parameters =
The new functionality described above introduces two new MCA
parameters:
* '''orte_base_help_aggregate''': Defaults to 1 (true), meaning that
help messages will be aggregated, as described above. If set to 0,
all help messages will be displayed, even if they are duplicates
(i.e., the original behavior).
* '''orte_base_show_output_recursions''': An MCA parameter to help
debug one of the known issues, described below. It is likely that
this MCA parameter will disappear before v1.3 final.
= Known Issues =
* The XML filter component is not complete. The current output from
this component is preliminary and not real XML. A bit more work
needs to be done to configure.m4 search for an appropriate XML
library/link it in/use it at run time.
* There are possible recursion loops in the orte_output() and
orte_show_help() functions -- e.g., if RML send calls orte_output()
or orte_show_help(). We have some ideas how to fix these, but
figured that it was ok to commit before feature freeze with known
issues. The code currently contains sub-optimal workarounds so
that this will not be a problem, but it would be good to actually
solve the problem rather than have hackish workarounds before v1.3 final.
This commit was SVN r18434.
2008-05-14 00:00:55 +04:00
|
|
|
orte_show_help("help-mca-bml-r2",
|
2006-08-14 23:17:36 +04:00
|
|
|
"unreachable proc",
|
2008-09-12 00:52:58 +04:00
|
|
|
true,
|
2008-09-24 23:32:34 +04:00
|
|
|
ORTE_NAME_PRINT(&(ompi_proc_local_proc->proc_name)),
|
2008-09-12 00:52:58 +04:00
|
|
|
(ompi_proc_local_proc->proc_hostname ?
|
2008-09-24 23:32:34 +04:00
|
|
|
ompi_proc_local_proc->proc_hostname : "unknown!"),
|
2008-09-25 00:17:54 +04:00
|
|
|
ORTE_NAME_PRINT(&(unreach_proc->proc_name)),
|
2008-09-12 00:52:58 +04:00
|
|
|
(unreach_proc->proc_hostname ?
|
2008-09-24 23:32:34 +04:00
|
|
|
unreach_proc->proc_hostname : "unknown!"),
|
2008-09-12 00:52:58 +04:00
|
|
|
btl_names);
|
2006-08-14 23:17:36 +04:00
|
|
|
}
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
free(new_procs);
|
2006-08-14 23:17:36 +04:00
|
|
|
|
|
|
|
return ret;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-09-16 02:56:23 +04:00
|
|
|
* iterate through each proc and notify any BTLs associated
|
2005-08-12 06:41:14 +04:00
|
|
|
* with the proc that it is/has gone away
|
|
|
|
*/
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_del_procs(size_t nprocs,
|
|
|
|
struct ompi_proc_t** procs)
|
2005-08-12 06:41:14 +04:00
|
|
|
{
|
|
|
|
size_t p;
|
|
|
|
int rc;
|
2005-08-15 23:39:56 +04:00
|
|
|
struct ompi_proc_t** del_procs = (struct ompi_proc_t**)
|
|
|
|
malloc(nprocs * sizeof(struct ompi_proc_t*));
|
|
|
|
size_t n_del_procs = 0;
|
|
|
|
|
2005-08-24 14:39:23 +04:00
|
|
|
if (NULL == del_procs) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
for(p =0; p < nprocs; p++) {
|
|
|
|
ompi_proc_t *proc = procs[p];
|
|
|
|
if(((opal_object_t*)proc)->obj_reference_count == 1) {
|
|
|
|
del_procs[n_del_procs++] = proc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(p = 0; p < n_del_procs; p++) {
|
|
|
|
ompi_proc_t *proc = del_procs[p];
|
2006-07-04 05:20:20 +04:00
|
|
|
mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_bml;
|
2005-08-12 06:41:14 +04:00
|
|
|
size_t f_index, f_size;
|
|
|
|
size_t n_index, n_size;
|
|
|
|
|
2008-09-16 02:56:23 +04:00
|
|
|
/* notify each btl that the proc is going away */
|
2005-08-12 06:41:14 +04:00
|
|
|
f_size = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_eager);
|
|
|
|
for(f_index = 0; f_index < f_size; f_index++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&bml_endpoint->btl_eager, f_index);
|
|
|
|
mca_btl_base_module_t* btl = bml_btl->btl;
|
|
|
|
|
|
|
|
rc = btl->btl_del_procs(btl,1,&proc,&bml_btl->btl_endpoint);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove this from next array so that we dont call it twice w/
|
|
|
|
* the same address pointer
|
|
|
|
*/
|
|
|
|
n_size = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_eager);
|
|
|
|
for(n_index = 0; n_index < n_size; n_index++) {
|
2007-01-19 22:48:06 +03:00
|
|
|
mca_bml_base_btl_t* search_bml_btl = mca_bml_base_btl_array_get_index(&bml_endpoint->btl_send, n_index);
|
|
|
|
if(search_bml_btl->btl == btl) {
|
|
|
|
memset(search_bml_btl, 0, sizeof(mca_bml_base_btl_t));
|
2005-08-12 06:41:14 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* notify each r2 that was not in the array of r2s for first fragments */
|
|
|
|
n_size = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send);
|
|
|
|
for(n_index = 0; n_index < n_size; n_index++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&bml_endpoint->btl_eager, n_index);
|
|
|
|
mca_btl_base_module_t* btl = bml_btl->btl;
|
|
|
|
if (btl != 0) {
|
|
|
|
rc = btl->btl_del_procs(btl,1,&proc,&bml_btl->btl_endpoint);
|
2005-08-24 14:39:23 +04:00
|
|
|
if(OMPI_SUCCESS != rc) {
|
2005-08-12 06:41:14 +04:00
|
|
|
return rc;
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
OBJ_RELEASE(proc);
|
2005-08-12 06:41:14 +04:00
|
|
|
/* do any required cleanup */
|
|
|
|
OBJ_RELEASE(bml_endpoint);
|
|
|
|
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2008-09-17 17:55:21 +04:00
|
|
|
static inline int bml_r2_remove_btl_progress(mca_btl_base_module_t* btl)
|
2008-09-16 02:56:23 +04:00
|
|
|
{
|
|
|
|
unsigned int p;
|
|
|
|
|
|
|
|
if(NULL == btl->btl_component->btl_progress) {
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
for(p = 0; p < mca_bml_r2.num_btl_progress; p++) {
|
|
|
|
if(btl->btl_component->btl_progress != mca_bml_r2.btl_progress[p])
|
|
|
|
continue;
|
|
|
|
opal_progress_unregister( btl->btl_component->btl_progress );
|
|
|
|
if( p < (mca_bml_r2.num_btl_progress-1) ) {
|
|
|
|
mca_bml_r2.btl_progress[p] = mca_bml_r2.btl_progress[mca_bml_r2.num_btl_progress-1];
|
|
|
|
}
|
|
|
|
mca_bml_r2.num_btl_progress--;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
return OMPI_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_del_proc_btl(ompi_proc_t* proc, mca_btl_base_module_t* btl)
|
|
|
|
{
|
|
|
|
mca_bml_base_endpoint_t* ep = (mca_bml_base_endpoint_t*)proc->proc_bml;
|
|
|
|
double total_bandwidth = 0;
|
|
|
|
size_t b;
|
|
|
|
|
|
|
|
if(NULL == ep)
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
|
|
|
|
/* remove btl from eager list */
|
|
|
|
mca_bml_base_btl_array_remove(&ep->btl_eager, btl);
|
|
|
|
|
|
|
|
/* remove btl from send list */
|
|
|
|
if(mca_bml_base_btl_array_remove(&ep->btl_send, btl)) {
|
|
|
|
|
|
|
|
/* compute total_bandwidth and
|
|
|
|
reset max_send_size to the min of all btl's */
|
|
|
|
total_bandwidth = 0;
|
|
|
|
for(b=0; b< mca_bml_base_btl_array_get_size(&ep->btl_send); b++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep->btl_send, b);
|
|
|
|
total_bandwidth += bml_btl->btl->btl_bandwidth;
|
|
|
|
if (bml_btl->btl_max_send_size < ep->btl_max_send_size) {
|
|
|
|
ep->btl_max_send_size = bml_btl->btl->btl_max_send_size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compute weighting factor for this btl */
|
|
|
|
for(b=0; b< mca_bml_base_btl_array_get_size(&ep->btl_send); b++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep->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->btl_send);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove btl from RDMA list */
|
|
|
|
if(mca_bml_base_btl_array_remove(&ep->btl_rdma, btl)) {
|
|
|
|
|
|
|
|
/* computer total bandwidth */
|
|
|
|
total_bandwidth = 0;
|
|
|
|
for(b=0; b< mca_bml_base_btl_array_get_size(&ep->btl_rdma); b++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep->btl_rdma, b);
|
|
|
|
/* update aggregate endpoint info */
|
|
|
|
total_bandwidth += bml_btl->btl->btl_bandwidth;
|
|
|
|
if (ep->btl_pipeline_send_length <
|
|
|
|
bml_btl->btl_rdma_pipeline_send_length) {
|
|
|
|
ep->btl_pipeline_send_length =
|
|
|
|
bml_btl->btl_rdma_pipeline_send_length;
|
|
|
|
}
|
|
|
|
if (ep->btl_send_limit < bml_btl->btl_min_rdma_pipeline_size) {
|
|
|
|
ep->btl_send_limit = bml_btl->btl_min_rdma_pipeline_size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compute weighting factor for this btl */
|
|
|
|
for(b=0; b< mca_bml_base_btl_array_get_size(&ep->btl_rdma); b++) {
|
|
|
|
mca_bml_base_btl_t* bml_btl = mca_bml_base_btl_array_get_index(&ep->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->btl_rdma);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2008-09-16 02:56:23 +04:00
|
|
|
int mca_bml_r2_finalize( void )
|
|
|
|
{
|
2007-02-21 19:18:43 +03:00
|
|
|
ompi_proc_t** procs;
|
|
|
|
size_t p, num_procs;
|
|
|
|
opal_list_item_t* w_item;
|
|
|
|
|
2008-09-12 00:52:58 +04:00
|
|
|
if (NULL != btl_names) {
|
|
|
|
free(btl_names);
|
|
|
|
btl_names = NULL;
|
|
|
|
}
|
|
|
|
|
2007-02-21 19:18:43 +03:00
|
|
|
/* Similar to mca_bml_r2_del_btl ... */
|
|
|
|
procs = ompi_proc_all(&num_procs);
|
|
|
|
if(NULL == procs)
|
|
|
|
goto CLEANUP;
|
|
|
|
|
|
|
|
for (w_item = opal_list_get_first(&mca_btl_base_modules_initialized);
|
|
|
|
w_item != opal_list_get_end(&mca_btl_base_modules_initialized);
|
|
|
|
w_item = opal_list_get_next(w_item)) {
|
|
|
|
mca_btl_base_selected_module_t *sm = (mca_btl_base_selected_module_t *) w_item;
|
2008-09-16 02:56:23 +04:00
|
|
|
mca_btl_base_module_t* btl = sm->btl_module;
|
|
|
|
|
|
|
|
/* unregister the BTL progress function if any */
|
|
|
|
bml_r2_remove_btl_progress(btl);
|
2007-02-21 19:18:43 +03:00
|
|
|
|
|
|
|
/* dont use this btl for any peers */
|
|
|
|
for(p=0; p<num_procs; p++) {
|
|
|
|
ompi_proc_t* proc = procs[p];
|
|
|
|
mca_bml_r2_del_proc_btl(proc, sm->btl_module);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CLEANUP:
|
|
|
|
mca_bml_r2.num_btl_modules = 0;
|
|
|
|
mca_bml_r2.num_btl_progress = 0;
|
|
|
|
|
|
|
|
if( NULL != mca_bml_r2.btl_modules) {
|
|
|
|
free( mca_bml_r2.btl_modules);
|
2008-09-17 17:55:21 +04:00
|
|
|
mca_bml_r2.btl_modules = NULL;
|
2007-02-21 19:18:43 +03:00
|
|
|
}
|
|
|
|
if( NULL != mca_bml_r2.btl_progress ) {
|
|
|
|
free( mca_bml_r2.btl_progress);
|
2008-09-17 17:55:21 +04:00
|
|
|
mca_bml_r2.btl_progress = NULL;
|
2007-02-21 19:18:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mca_btl_base_close();
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
|
|
|
|
2006-03-28 02:48:12 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* (1) Remove btl from each bml endpoint
|
|
|
|
* (2) Remove btl from the global list
|
|
|
|
*/
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_del_btl(mca_btl_base_module_t* btl)
|
2006-03-28 02:48:12 +04:00
|
|
|
{
|
|
|
|
ompi_proc_t** procs;
|
2008-09-16 02:56:23 +04:00
|
|
|
size_t i, m, p, num_procs;
|
2006-05-04 22:48:45 +04:00
|
|
|
opal_list_item_t* item;
|
|
|
|
mca_btl_base_module_t** modules;
|
2006-11-07 00:27:17 +03:00
|
|
|
bool found = false;
|
2006-05-20 06:39:05 +04:00
|
|
|
|
2006-03-28 02:48:12 +04:00
|
|
|
procs = ompi_proc_all(&num_procs);
|
|
|
|
if(NULL == procs)
|
|
|
|
return OMPI_SUCCESS;
|
2006-11-07 00:27:17 +03:00
|
|
|
|
2008-09-16 02:56:23 +04:00
|
|
|
if(opal_list_get_size(&mca_btl_base_modules_initialized) == 2) {
|
2008-06-09 18:53:58 +04:00
|
|
|
opal_output(0, "only one BTL left, can't failover");
|
2007-07-31 13:32:49 +04:00
|
|
|
goto CLEANUP;
|
2006-11-07 00:27:17 +03:00
|
|
|
}
|
|
|
|
|
2008-09-16 02:56:23 +04:00
|
|
|
/* Get rid of the associated progress function */
|
|
|
|
bml_r2_remove_btl_progress(btl);
|
|
|
|
|
2006-05-04 22:48:45 +04:00
|
|
|
/* dont use this btl for any peers */
|
2008-09-16 02:56:23 +04:00
|
|
|
for( p = 0; p < num_procs; p++ ) {
|
2006-03-28 02:48:12 +04:00
|
|
|
ompi_proc_t* proc = procs[p];
|
2006-05-04 19:19:12 +04:00
|
|
|
mca_bml_r2_del_proc_btl(proc, btl);
|
|
|
|
}
|
2006-05-04 22:48:45 +04:00
|
|
|
|
|
|
|
/* remove from the btl list */
|
|
|
|
for (item = opal_list_get_first(&mca_btl_base_modules_initialized);
|
|
|
|
item != opal_list_get_end(&mca_btl_base_modules_initialized);
|
|
|
|
item = opal_list_get_next(item)) {
|
|
|
|
mca_btl_base_selected_module_t *sm = (mca_btl_base_selected_module_t *) item;
|
|
|
|
if(sm->btl_module == btl) {
|
|
|
|
opal_list_remove_item(&mca_btl_base_modules_initialized, item);
|
|
|
|
free(sm);
|
2006-11-07 00:27:17 +03:00
|
|
|
found = true;
|
2006-05-04 22:48:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-11-07 00:27:17 +03:00
|
|
|
if(!found) {
|
|
|
|
/* doesn't even exist */
|
2007-07-31 13:32:49 +04:00
|
|
|
goto CLEANUP;
|
2006-11-07 00:27:17 +03:00
|
|
|
}
|
2006-05-04 22:48:45 +04:00
|
|
|
/* remove from bml list */
|
2006-08-24 20:38:08 +04:00
|
|
|
modules = (mca_btl_base_module_t**)malloc(sizeof(mca_btl_base_module_t*) * mca_bml_r2.num_btl_modules-1);
|
2006-05-04 22:48:45 +04:00
|
|
|
for(i=0,m=0; i<mca_bml_r2.num_btl_modules; i++) {
|
|
|
|
if(mca_bml_r2.btl_modules[i] != btl) {
|
|
|
|
modules[m++] = mca_bml_r2.btl_modules[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(mca_bml_r2.btl_modules);
|
|
|
|
mca_bml_r2.btl_modules = modules;
|
|
|
|
mca_bml_r2.num_btl_modules = m;
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
btl->btl_finalize(btl);
|
2007-07-31 13:34:41 +04:00
|
|
|
CLEANUP:
|
2006-05-04 19:19:12 +04:00
|
|
|
free(procs);
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_add_btl(mca_btl_base_module_t* btl)
|
2006-03-28 02:48:12 +04:00
|
|
|
{
|
|
|
|
return ORTE_ERR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register callback w/ all active btls
|
|
|
|
*/
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_register( mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_module_recv_cb_fn_t cbfunc,
|
|
|
|
void* data )
|
2005-08-12 06:41:14 +04:00
|
|
|
{
|
2008-01-15 08:32:53 +03:00
|
|
|
mca_btl_base_active_message_trigger[tag].cbfunc = cbfunc;
|
|
|
|
mca_btl_base_active_message_trigger[tag].cbdata = data;
|
|
|
|
/* Give an oportunity to the BTLs to do something special
|
|
|
|
* for each registration.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
int i, rc;
|
|
|
|
mca_btl_base_module_t *btl;
|
|
|
|
|
|
|
|
for(i = 0; i < (int)mca_bml_r2.num_btl_modules; i++) {
|
|
|
|
btl = mca_bml_r2.btl_modules[i];
|
|
|
|
if( NULL == btl->btl_register )
|
|
|
|
continue;
|
|
|
|
rc = btl->btl_register(btl, tag, cbfunc, data);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
return rc;
|
|
|
|
}
|
2005-08-24 14:39:23 +04:00
|
|
|
}
|
2005-08-12 06:41:14 +04:00
|
|
|
}
|
2008-01-15 08:32:53 +03:00
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-17 00:21:38 +04:00
|
|
|
/*
|
|
|
|
* Register an error handler with/ all active btls
|
|
|
|
* if they support error handlers..
|
|
|
|
*/
|
|
|
|
|
2008-09-30 19:47:43 +04:00
|
|
|
static int mca_bml_r2_register_error( mca_btl_base_module_error_cb_fn_t cbfunc)
|
2006-08-17 00:21:38 +04:00
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
int rc;
|
|
|
|
mca_btl_base_module_t *btl;
|
2006-08-18 02:02:01 +04:00
|
|
|
uint32_t ver;
|
|
|
|
|
2006-08-17 00:21:38 +04:00
|
|
|
for(i = 0; i < mca_bml_r2.num_btl_modules; i++) {
|
|
|
|
btl = mca_bml_r2.btl_modules[i];
|
2006-08-18 02:02:01 +04:00
|
|
|
/* this wont work for version numbers greater than 256... seems
|
|
|
|
reasonable.. */
|
|
|
|
ver = btl->btl_component->btl_version.mca_type_major_version << 16 |
|
|
|
|
btl->btl_component->btl_version.mca_type_minor_version << 8 |
|
|
|
|
btl->btl_component->btl_version.mca_type_release_version;
|
|
|
|
/* is version number greater than or equal to 1.0.1? */
|
|
|
|
if(ver >= ((1 << 16) | (0 << 8) | 1) &&
|
|
|
|
NULL != btl->btl_register_error) {
|
2006-08-17 00:21:38 +04:00
|
|
|
rc = btl->btl_register_error(btl, cbfunc);
|
|
|
|
if(OMPI_SUCCESS != rc) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-12 06:41:14 +04:00
|
|
|
int mca_bml_r2_component_fini(void)
|
|
|
|
{
|
|
|
|
/* FIX */
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2008-09-30 19:47:43 +04:00
|
|
|
|
|
|
|
mca_bml_r2_module_t mca_bml_r2 = {
|
|
|
|
{
|
|
|
|
&mca_bml_r2_component,
|
|
|
|
0, /* eager limit */
|
|
|
|
0, /* min send size */
|
|
|
|
0, /* max send size */
|
|
|
|
0, /* min rdma size */
|
|
|
|
0, /* max rdma size */
|
|
|
|
mca_bml_r2_add_procs,
|
|
|
|
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_register_error,
|
|
|
|
mca_bml_r2_finalize,
|
|
|
|
mca_bml_r2_ft_event
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|