1
1

Make sure to look in not only the env var, but also {{{orte_routed_base_components}}} to confirm that this is the only component available, and intended for selection.

This commit was SVN r22323.
Этот коммит содержится в:
Josh Hursey 2009-12-16 20:17:26 +00:00
родитель 646f90a90a
Коммит a418a7dc43

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

@ -44,13 +44,15 @@ orte_routed_component_t mca_routed_cm_component = {
}
};
static int is_component_requested(bool *is_req);
static int orte_routed_cm_component_query(mca_base_module_t **module, int *priority)
{
char *spec;
/* only select us if specified */
spec = getenv("OMPI_MCA_routed");
if (NULL == spec || 0 != strcmp("cm", spec)) {
bool is_requested = false;
is_component_requested(&is_requested);
if( !is_requested ) {
*priority = 0;
*module = NULL;
return ORTE_ERROR;
@ -60,3 +62,42 @@ static int orte_routed_cm_component_query(mca_base_module_t **module, int *prior
*module = (mca_base_module_t *)&orte_routed_cm_module;
return ORTE_SUCCESS;
}
static int is_component_requested(bool *is_req)
{
char *spec = NULL;
opal_list_item_t *item = NULL;
mca_base_component_list_item_t *cli = NULL;
mca_base_component_t *component = NULL;
/*
* Check the environment variable
*/
*is_req = false;
spec = getenv("OMPI_MCA_routed");
if (NULL != spec && 0 == strcmp("cm", spec)) {
*is_req = true;
return ORTE_SUCCESS;
}
/*
* Otherwise look through the components available for opening
* Must be the -only- component in the list
*/
*is_req = false;
if( 1 == opal_list_get_size(&orte_routed_base_components) ) {
item = opal_list_get_first(&orte_routed_base_components);
cli = (mca_base_component_list_item_t *) item;
component = (mca_base_component_t *) cli->cli_component;
if( 0 == strncmp(component->mca_component_name,
mca_routed_cm_component.base_version.mca_component_name,
strlen(mca_routed_cm_component.base_version.mca_component_name)) ) {
*is_req = true;
return ORTE_SUCCESS;
}
}
return ORTE_SUCCESS;
}