orcm/mca/pvsn/base/pvsn_base_select.c
/**
 * Call the init function on all available components to find out if
 * they want to run.  Select the highest priority component that doesn't
 * fail. Failing components will be closed and unloaded.
 */
Call the init function on all available components to find out if
they want to run.  Select the highest priority component that doesn't
fail. Failing components will be closed and unloaded.
Call the init function on all available components to find out if they want to run . Select the highest priority component that doesn ' t fail . Failing components will be closed and unloaded .
int orcm_pvsn_base_select(void)
{
    mca_base_component_list_item_t *cli = NULL;
    mca_base_component_t *component = NULL;
    mca_base_module_t *module = NULL;
    orcm_pvsn_base_module_t *nmodule, *best_module = NULL;
    int rc, priority, pri = -1;
    if (selected) {
        return ORTE_SUCCESS;
    }
    selected = true;
    OPAL_LIST_FOREACH(cli, &orcm_pvsn_base_framework.framework_components, mca_base_component_list_item_t) {
        component = (mca_base_component_t *) cli->cli_component;
        opal_output_verbose(5, orcm_pvsn_base_framework.framework_output,
                            "mca:pvsn:select: checking available component %s",
                            component->mca_component_name);
        if (NULL == component->mca_query_component) {
            opal_output_verbose(5, orcm_pvsn_base_framework.framework_output,
                                "mca:pvsn:select: Skipping component [%s]. It does not implement a query function",
                                component->mca_component_name );
            continue;
        }
        opal_output_verbose(5, orcm_pvsn_base_framework.framework_output,
                            "mca:pvsn:select: Querying component [%s]",
                            component->mca_component_name);
        rc = component->mca_query_component(&module, &priority);
        if (ORTE_SUCCESS != rc || NULL == module) {
            opal_output_verbose(5, orcm_pvsn_base_framework.framework_output,
                                "mca:pvsn:select: Skipping component [%s]. Query failed to return a module",
                                component->mca_component_name );
            continue;
        }
        nmodule = (orcm_pvsn_base_module_t*) module;
        if (NULL == nmodule->init) {
            continue;
        }
        if (ORCM_SUCCESS != nmodule->init()) {
            if (NULL != nmodule->finalize) {
                nmodule->finalize();
            }
            continue;
        }
        if (pri < priority) {
            best_module = nmodule;
            pri = priority;
        }
    }
    if (NULL == best_module) {
        return ORCM_ERR_NOT_FOUND;
    }
    orcm_pvsn_base.active = *best_module;
    return ORCM_SUCCESS;;
}
int orcm_pvsn_base_select ( void ) { mca_base_component_list_item_t * cli = NULL ; mca_base_component_t * component = NULL ; mca_base_module_t * module = NULL ; orcm_pvsn_base_module_t * nmodule , * best_module = NULL ; int rc , priority , pri = -1 ; if ( selected ) { return ORTE_SUCCESS ; } selected = true ; OPAL_LIST_FOREACH ( cli , & orcm_pvsn_base_framework . framework_components , mca_base_component_list_item_t ) { component = ( mca_base_component_t * ) cli -> cli_component ; opal_output_verbose ( 5 , orcm_pvsn_base_framework . framework_output , " " , component -> mca_component_name ) ; if ( NULL == component -> mca_query_component ) { opal_output_verbose ( 5 , orcm_pvsn_base_framework . framework_output , " " , component -> mca_component_name ) ; continue ; } opal_output_verbose ( 5 , orcm_pvsn_base_framework . framework_output , " " , component -> mca_component_name ) ; rc = component -> mca_query_component ( & module , & priority ) ; if ( ORTE_SUCCESS != rc || NULL == module ) { opal_output_verbose ( 5 , orcm_pvsn_base_framework . framework_output , " " , component -> mca_component_name ) ; continue ; } nmodule = ( orcm_pvsn_base_module_t * ) module ; if ( NULL == nmodule -> init ) { continue ; } if ( ORCM_SUCCESS != nmodule -> init ( ) ) { if ( NULL != nmodule -> finalize ) { nmodule -> finalize ( ) ; } continue ; } if ( pri < priority ) { best_module = nmodule ; pri = priority ; } } if ( NULL == best_module ) { return ORCM_ERR_NOT_FOUND ; } orcm_pvsn_base . active = * best_module ; return ORCM_SUCCESS ; ; }
Call the init function on all available components to find out if
 they want to run.
Call the init function on all available components to find out if they want to run .
/* ensure we don't do this twice */ /* Query all available components and ask if they have a module */ /* If there's no query function, skip it */ /* Query the component */ /* If no module was returned, then skip component */ /* see if it can init */ /* keep the highest priority one */