Ejemplo n.º 1
0
int opal_dss_register_vars (void)
{
    mca_base_var_enum_t *new_enum;
    char *enviro_val;
    int ret;

    enviro_val = getenv("OPAL_dss_debug");
    if (NULL != enviro_val) {  /* debug requested */
        opal_dss_verbose = 0;
    }

    opal_dss_group_id = mca_base_var_group_register ("opal", "dss", NULL, NULL);

    /** set the default buffer type. If we are in debug mode, then we default
     * to fully described buffers. Otherwise, we default to non-described for brevity
     * and performance
     */
#if OPAL_ENABLE_DEBUG
    default_buf_type = OPAL_DSS_BUFFER_FULLY_DESC;
#else
    default_buf_type = OPAL_DSS_BUFFER_NON_DESC;
#endif

    ret = mca_base_var_enum_create ("buffer types", buffer_type_values, &new_enum);
    if (OPAL_SUCCESS != ret) {
        fprintf (stderr, "Fail A\n");
        return ret;
    }

    ret = mca_base_var_register ("opal", "dss", NULL, "buffer_type",
                                 "Set the default mode for OpenRTE buffers (0=non-described, 1=described)",
                                 MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
                                 OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_ALL_EQ,
                                 &default_buf_type);
    OBJ_RELEASE(new_enum);
    if (0 > ret) {
        return ret;
    }

    /* setup the initial size of the buffer. */
    opal_dss_initial_size = OPAL_DSS_DEFAULT_INITIAL_SIZE;
    ret = mca_base_var_register ("opal", "dss", NULL, "buffer_initial_size", NULL,
                                 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
                                 OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_ALL_EQ,
                                 &opal_dss_initial_size);
    if (0 > ret) {
        return ret;
    }

    /* the threshold as to where to stop doubling the size of the buffer
     * allocated memory and start doing additive increases */
    opal_dss_threshold_size = OPAL_DSS_DEFAULT_THRESHOLD_SIZE;
    ret = mca_base_var_register ("opal", "dss", NULL, "buffer_threshold_size", NULL,
                                 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
                                 OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_ALL_EQ,
                                 &opal_dss_threshold_size);

    return (0 > ret) ? ret : OPAL_SUCCESS;
}
int mca_base_framework_register (struct mca_base_framework_t *framework,
                                 mca_base_register_flag_t flags)
{
    char *desc;
    int ret;

    assert (NULL != framework);

    if (framework_is_registered (framework)) {
        return OPAL_SUCCESS;
    }

    if (!(MCA_BASE_FRAMEWORK_FLAG_NOREGISTER & framework->framework_flags)) {
        /* register this framework with the MCA variable system */
        ret = mca_base_var_group_register (framework->framework_project,
                                           framework->framework_name,
                                           NULL, framework->framework_description);
        if (0 > ret) {
            return ret;
        }

        asprintf (&desc, "Default selection set of components for the %s framework (<none>"
                  " means use all components that can be found)", framework->framework_name);
        ret = mca_base_var_register (framework->framework_project, framework->framework_name,
                                     NULL, NULL, desc, MCA_BASE_VAR_TYPE_STRING, NULL, 0,
                                     MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_2,
                                     MCA_BASE_VAR_SCOPE_ALL_EQ, &framework->framework_selection);
        free (desc);
        if (0 > ret) {
            return ret;
        }

        /* register a verbosity variable for this framework */
        asprintf (&desc, "Verbosity level for the %s framework (0 = no verbosity)",
                  framework->framework_name);
        ret = mca_base_framework_var_register (framework, "verbose", desc,
                                               MCA_BASE_VAR_TYPE_INT, NULL, 0,
                                               MCA_BASE_VAR_FLAG_SETTABLE,
                                               OPAL_INFO_LVL_8,
                                               MCA_BASE_VAR_SCOPE_LOCAL,
                                               &framework->framework_verbose);                                           
        free(desc);
        if (0 > ret) {
            return ret;
        }

        /* check the initial verbosity and open the output if necessary. we
           will recheck this on open */
        framework_open_output (framework);

        /* register framework variables */
        if (NULL != framework->framework_register) {
            ret = framework->framework_register (flags);
            if (OPAL_SUCCESS != ret) {
                return ret;
            }
        }

        /* register components variables */
        ret = mca_base_framework_components_register (framework, flags);
        if (OPAL_SUCCESS != ret) {
            return ret;
        }
    }

    framework->framework_flags |= MCA_BASE_FRAMEWORK_FLAG_REGISTERED;

    /* framework did not provide a register function */
    return OPAL_SUCCESS;
}