Ejemplo n.º 1
0
void orcm_info_show_mca_params(const char *type, const char *component, 
                               bool want_internal)
{
    const mca_base_var_group_t *group;
    int ret;

    if (0 == strcmp (component, "all")) {
        ret = mca_base_var_group_find("*", type, NULL);
        if (0 > ret) {
            return;
        }

        (void) mca_base_var_group_get(ret, &group);

        if (NULL != group) {
            orcm_info_show_mca_group_params(group, want_internal);
        }
    } else {
        ret = mca_base_var_group_find("*", type, component);
        if (0 > ret) {
            return;
        }

        (void) mca_base_var_group_get(ret, &group);
        if (NULL != group) {
            orcm_info_show_mca_group_params(group, want_internal);
        }
    }
}
/*
 * Close a component 
 */
static void ri_destructor(opal_object_t *obj)
{
  repository_item_t *ri = (repository_item_t *) obj;
  dependency_item_t *di;
  opal_list_item_t *item;
  int group_id;

  group_id = mca_base_var_group_find (NULL, ri->ri_type,
                                      ri->ri_component_struct->mca_component_name);
  if (0 <= group_id) {
    mca_base_var_group_deregister (group_id);
  }

  /* Close the component (and potentially unload it from memory */
  lt_dlclose(ri->ri_dlhandle);

  /* It should be obvious, but I'll state it anyway because it bit me
     during debugging: after the dlclose(), the mca_base_component_t
     pointer is no longer valid because it has [potentially] been
     unloaded from memory.  So don't try to use it.  :-) */

  /* Now go release/close (at a minimum: decrement the refcount) any
     dependencies of this component */

  for (item = opal_list_remove_first(&ri->ri_dependencies);
       NULL != item; 
       item = opal_list_remove_first(&ri->ri_dependencies)) {
    di = (dependency_item_t *) item;
    OBJ_RELEASE(di);
  }
  OBJ_DESTRUCT(&ri->ri_dependencies);
  opal_list_remove_item(&repository, (opal_list_item_t *) ri);
}
int mca_base_framework_close (struct mca_base_framework_t *framework) {
    bool is_open = !!framework->framework_refcnt;
    int ret, group_id;

    assert (NULL != framework);

    if (!framework_is_registered (framework) && 0 == framework->framework_refcnt) {
        return OPAL_SUCCESS;
    }

    if (framework->framework_refcnt && --framework->framework_refcnt) {
        return OPAL_SUCCESS;
    }

    /* find and deregister all component groups and variables */
    group_id = mca_base_var_group_find (framework->framework_project,
                                        framework->framework_name, NULL);
    if (0 <= group_id) {
        ret = mca_base_var_group_deregister (group_id);
        framework->framework_flags &= ~MCA_BASE_FRAMEWORK_FLAG_REGISTERED;
    }

    /* close the framework and all of its components */
    if (is_open) {
        if (NULL != framework->framework_close) {
            ret = framework->framework_close ();
        } else {
            ret = mca_base_framework_components_close (framework, NULL);
        }

        if (OPAL_SUCCESS != ret) {
            return ret;
        }
    } else {
        opal_list_item_t *item;
        while (NULL != (item = opal_list_remove_first (&framework->framework_components))) {
            mca_base_component_unload ((mca_base_component_t *) item, framework->framework_output);
            OBJ_RELEASE(item);
        }
        ret = OPAL_SUCCESS;
    }

    framework->framework_flags &= ~MCA_BASE_FRAMEWORK_FLAG_REGISTERED;

    framework_close_output (framework);

    return ret;
}
Ejemplo n.º 4
0
void mca_base_component_unload (const mca_base_component_t *component, int output_id)
{
    int ret;

    /* Unload */
    opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, output_id,
                         "mca: base: close: unloading component %s",
                         component->mca_component_name);

    ret = mca_base_var_group_find (component->mca_project_name, component->mca_type_name,
                                   component->mca_component_name);
    if (0 <= ret) {
        mca_base_var_group_deregister (ret);
    }

    mca_base_component_repository_release (component);
}
int mca_base_framework_open (struct mca_base_framework_t *framework,
                             mca_base_open_flag_t flags) {
    int ret;

    assert (NULL != framework);

    /* check if this framework is already open */
    if (framework->framework_refcnt++) {
        return OPAL_SUCCESS;
    }

    /* register this framework before opening it */
    ret = mca_base_framework_register (framework, MCA_BASE_REGISTER_DEFAULT);
    if (OPAL_SUCCESS != ret) {
        return ret;
    }

    if (MCA_BASE_FRAMEWORK_FLAG_NOREGISTER & framework->framework_flags) {
        flags |= MCA_BASE_OPEN_FIND_COMPONENTS;
    }

    /* lock all of this frameworks's variables */
    ret = mca_base_var_group_find (framework->framework_project,
                                   framework->framework_name,
                                   NULL);
    mca_base_var_group_set_var_flag (ret, MCA_BASE_VAR_FLAG_SETTABLE, false);

    /* check the verbosity level and open (or close) the output */
    framework_open_output (framework);

    if (NULL != framework->framework_open) {
        ret = framework->framework_open (flags);
    } else {
        ret = mca_base_framework_components_open (framework, flags);
    }

    if (OPAL_SUCCESS != ret) {
        framework->framework_refcnt = 0;
    }

    return ret;
}