2005-05-24 02:06:50 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "mca/mca.h"
|
|
|
|
#include "mca/base/base.h"
|
|
|
|
#include "mca/pml/pml.h"
|
2005-06-30 06:08:24 +04:00
|
|
|
#include "mca/btl/btl.h"
|
|
|
|
#include "mca/btl/base/base.h"
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-06-08 19:59:49 +04:00
|
|
|
OBJ_CLASS_INSTANCE(
|
2005-06-30 06:08:24 +04:00
|
|
|
mca_btl_base_selected_module_t,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t,
|
2005-06-08 19:59:49 +04:00
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2005-05-24 02:06:50 +04:00
|
|
|
/**
|
2005-06-30 06:08:24 +04:00
|
|
|
* Function for weeding out btl components that don't want to run.
|
2005-05-24 02:06:50 +04:00
|
|
|
*
|
|
|
|
* Call the init function on all available components to find out if
|
|
|
|
* they want to run. Select all components that don't fail. Failing
|
|
|
|
* components will be closed and unloaded. The selected modules will
|
2005-07-03 20:22:16 +04:00
|
|
|
* be returned to the caller in a opal_list_t.
|
2005-05-24 02:06:50 +04:00
|
|
|
*/
|
2005-06-30 06:08:24 +04:00
|
|
|
int mca_btl_base_select(bool enable_progress_threads,
|
2005-05-24 02:06:50 +04:00
|
|
|
bool enable_mpi_threads)
|
|
|
|
{
|
2005-06-30 06:08:24 +04:00
|
|
|
int i, num_btls;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2005-05-24 02:06:50 +04:00
|
|
|
mca_base_component_list_item_t *cli;
|
2005-06-30 06:08:24 +04:00
|
|
|
mca_btl_base_component_t *component;
|
|
|
|
mca_btl_base_module_t **modules;
|
|
|
|
mca_btl_base_selected_module_t *sm;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
2005-07-04 04:13:44 +04:00
|
|
|
char** include = opal_argv_split(mca_btl_base_include, ',');
|
|
|
|
char** exclude = opal_argv_split(mca_btl_base_exclude, ',');
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
/* Traverse the list of opened modules; call their init
|
|
|
|
functions. */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_get_first(&mca_btl_base_components_opened);
|
|
|
|
while(item != opal_list_get_end(&mca_btl_base_components_opened)) {
|
|
|
|
opal_list_item_t *next = opal_list_get_next(item);
|
2005-05-24 02:06:50 +04:00
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
|
2005-06-30 06:08:24 +04:00
|
|
|
component = (mca_btl_base_component_t *) cli->cli_component;
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
/* if there is an include list - item must be in the list to be included */
|
|
|
|
if ( NULL != include ) {
|
|
|
|
char** argv = include;
|
|
|
|
bool found = false;
|
|
|
|
while(argv && *argv) {
|
2005-06-30 06:08:24 +04:00
|
|
|
if(strcmp(component->btl_version.mca_component_name,*argv) == 0) {
|
2005-05-24 02:06:50 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
argv++;
|
|
|
|
}
|
|
|
|
if(found == false) {
|
|
|
|
item = next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* otherwise - check the exclude list to see if this item has been specifically excluded */
|
|
|
|
} else if ( NULL != exclude ) {
|
|
|
|
char** argv = exclude;
|
|
|
|
bool found = false;
|
|
|
|
while(argv && *argv) {
|
2005-06-30 06:08:24 +04:00
|
|
|
if(strcmp(component->btl_version.mca_component_name,*argv) == 0) {
|
2005-05-24 02:06:50 +04:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
argv++;
|
|
|
|
}
|
|
|
|
if(found == true) {
|
|
|
|
item = next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, mca_btl_base_output,
|
2005-05-24 02:06:50 +04:00
|
|
|
"select: initializing %s component %s",
|
2005-06-30 06:08:24 +04:00
|
|
|
component->btl_version.mca_type_name,
|
|
|
|
component->btl_version.mca_component_name);
|
|
|
|
if (NULL == component->btl_init) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, mca_btl_base_output,
|
2005-05-24 02:06:50 +04:00
|
|
|
"select: no init function; ignoring component");
|
|
|
|
} else {
|
2005-06-30 06:08:24 +04:00
|
|
|
modules = component->btl_init(&num_btls, enable_progress_threads,
|
2005-05-24 02:06:50 +04:00
|
|
|
enable_mpi_threads);
|
|
|
|
|
|
|
|
/* If the component didn't initialize, remove it from the opened
|
|
|
|
list and remove it from the component repository */
|
|
|
|
|
|
|
|
if (NULL == modules) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, mca_btl_base_output,
|
2005-05-24 02:06:50 +04:00
|
|
|
"select: init returned failure");
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, mca_btl_base_output,
|
2005-05-24 02:06:50 +04:00
|
|
|
"select: module %s unloaded",
|
2005-06-30 06:08:24 +04:00
|
|
|
component->btl_version.mca_component_name);
|
2005-05-24 02:06:50 +04:00
|
|
|
|
|
|
|
mca_base_component_repository_release((mca_base_component_t *) component);
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_remove_item(&mca_btl_base_components_opened, item);
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, it initialized properly. Save it. */
|
|
|
|
|
|
|
|
else {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, mca_btl_base_output,
|
2005-05-24 02:06:50 +04:00
|
|
|
"select: init returned success");
|
|
|
|
|
2005-06-30 06:08:24 +04:00
|
|
|
for (i = 0; i < num_btls; ++i) {
|
|
|
|
sm = OBJ_NEW(mca_btl_base_selected_module_t);
|
2005-05-24 02:06:50 +04:00
|
|
|
if (NULL == sm) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2005-06-30 06:08:24 +04:00
|
|
|
sm->btl_component = component;
|
|
|
|
sm->btl_module = modules[i];
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&mca_btl_base_modules_initialized,
|
|
|
|
(opal_list_item_t*) sm);
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
free(modules);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finished querying all components. Check for the bozo case. */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
if (0 == opal_list_get_size(&mca_btl_base_modules_initialized)) {
|
2005-05-24 02:06:50 +04:00
|
|
|
/* JMS Replace with show_help */
|
2005-06-30 06:08:24 +04:00
|
|
|
orte_abort(1, "No btl components available. This shouldn't happen.");
|
2005-05-24 02:06:50 +04:00
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|