Ejemplo n.º 1
0
int mca_base_components_close(int output_id, opal_list_t *components,
                              const mca_base_component_t *skip)
{
    mca_base_component_list_item_t *cli, *next;

    /* Close and unload all components in the available list, except the
       "skip" item.  This is handy to close out all non-selected
       components.  It's easier to simply remove the entire list and
       then simply re-add the skip entry when done. */

    OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
        if (skip == cli->cli_component) {
            continue;
        }

        mca_base_component_close (cli->cli_component, output_id);
        opal_list_remove_item (components, &cli->super);

        OBJ_RELEASE(cli);
    }

    /* All done */
    return OPAL_SUCCESS;
}
Ejemplo n.º 2
0
/*
 * Traverse the entire list of found components (a list of
 * mca_base_component_t instances).  If the requested_component_names
 * array is empty, or the name of each component in the list of found
 * components is in the requested_components_array, try to open it.
 * If it opens, add it to the components_available list.
 */
static int open_components(mca_base_framework_t *framework)
{
    opal_list_t *components = &framework->framework_components;
    uint32_t open_only_flags = MCA_BASE_METADATA_PARAM_NONE;
    int output_id = framework->framework_output;
    mca_base_component_list_item_t *cli, *next;
    int ret;

    /*
     * Pre-process the list with parameter constraints
     * e.g., If requested to select only CR enabled components
     *       then only make available those components.
     *
     * JJH Note: Currently checkpoint/restart is the only user of this
     *           functionality. If other component constraint options are
     *           added, then this logic can be used for all contraint
     *           options.
     *
     * NTH: Logic moved to mca_base_components_filter.
     */
#if (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1)
    if (mca_base_component_distill_checkpoint_ready) {
        open_only_flags |= MCA_BASE_METADATA_PARAM_CHECKPOINT;
    }
#endif  /* (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1) */

    /* If mca_base_framework_register_components was called with the MCA_BASE_COMPONENTS_ALL flag 
       we need to trim down and close any extra components we do not want open */
    ret = mca_base_components_filter (framework->framework_name, &framework->framework_components,
                                      framework->framework_output, framework->framework_selection,
                                      open_only_flags);
    if (OPAL_SUCCESS != ret) {
        return ret;
    }

    /* Announce */
    opal_output_verbose(10, output_id,
                        "mca: base: components_open: opening %s components",
                        framework->framework_name);
    
    /* Traverse the list of components */
    OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
        const mca_base_component_t *component = cli->cli_component;
        
        opal_output_verbose(10, output_id, 
                            "mca: base: components_open: found loaded component %s",
                            component->mca_component_name);

	if (NULL != component->mca_open_component) {
	    /* Call open if register didn't call it already */
            ret = component->mca_open_component();

            if (OPAL_SUCCESS == ret) {
                opal_output_verbose(10, output_id, 
                                    "mca: base: components_open: "
                                    "component %s open function successful",
                                    component->mca_component_name);
            } else {
		if (OPAL_ERR_NOT_AVAILABLE != ret) {
		    /* If the component returns OPAL_ERR_NOT_AVAILABLE,
		       it's a cue to "silently ignore me" -- it's not a
		       failure, it's just a way for the component to say
		       "nope!".  

		       Otherwise, however, display an error.  We may end
		       up displaying this twice, but it may go to separate
		       streams.  So better to be redundant than to not
		       display the error in the stream where it was
		       expected. */
                
		    if (mca_base_component_show_load_errors) {
			opal_output(0, "mca: base: components_open: "
				    "component %s / %s open function failed",
				    component->mca_type_name,
				    component->mca_component_name);
		    }
		    opal_output_verbose(10, output_id, 
					"mca: base: components_open: "
					"component %s open function failed",
					component->mca_component_name);
		}

                mca_base_component_close (component, output_id);

		opal_list_remove_item (components, &cli->super);
		OBJ_RELEASE(cli);
	    }
	}
    }
    
    /* All done */
    
    return OPAL_SUCCESS;
}