コード例 #1
0
ファイル: param.c プロジェクト: forzaclaudio/orcm
static void orcm_info_show_mca_group_params(const mca_base_var_group_t *group, bool want_internal)
{
    const mca_base_var_t *var;
    const int *variables;
    int ret, i, j, count;
    const int *groups;
    char **strings;

    variables = OPAL_VALUE_ARRAY_GET_BASE(&group->group_vars, const int);
    count = opal_value_array_get_size((opal_value_array_t *)&group->group_vars);

    for (i = 0 ; i < count ; ++i) {
        ret = mca_base_var_get(variables[i], &var);
        if (OPAL_SUCCESS != ret || ((var->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL) &&
                                    !want_internal)) {
            continue;
        }

        ret = mca_base_var_dump(variables[i], &strings, !orcm_info_pretty ? MCA_BASE_VAR_DUMP_PARSABLE : MCA_BASE_VAR_DUMP_READABLE);
        if (OPAL_SUCCESS != ret) {
            continue;
        }

        for (j = 0 ; strings[j] ; ++j) {
            if (0 == j && orcm_info_pretty) {
                char *message;

                asprintf (&message, "MCA %s", group->group_framework);
                orcm_info_out(message, message, strings[j]);
                free(message);
            } else {
                orcm_info_out("", "", strings[j]);
            }
            free(strings[j]);
        }
        free(strings);
    }

    groups = OPAL_VALUE_ARRAY_GET_BASE(&group->group_subgroups, const int);
    count = opal_value_array_get_size((opal_value_array_t *)&group->group_subgroups);

    for (i = 0 ; i < count ; ++i) {
        ret = mca_base_var_group_get(groups[i], &group);
        if (OPAL_SUCCESS != ret) {
            continue;
        }
        orcm_info_show_mca_group_params(group, want_internal);
    }
}
コード例 #2
0
void orcm_info_show_path(const char *type, const char *value)
{
    char *pretty, *path;
    
    pretty = strdup(type);
    pretty[0] = toupper(pretty[0]);
    
    asprintf(&path, "path:%s", type);
    orcm_info_out(pretty, path, value);
    free(pretty);
    free(path);
}
コード例 #3
0
/*
 * do_config
 * Accepts:
 *	- want_all: boolean flag; TRUE -> display all options
 *				  FALSE -> display selected options
 *
 * This function displays all the options with which the current
 * installation of orcm was configured. There are many options here 
 * that are carried forward from ORCM-7 and are not mca parameters 
 * in ORCM-10. I have to dig through the invalid options and replace
 * them with ORCM-10 options.
 */
void orcm_info_do_config(bool want_all)
{
    char *heterogeneous;
    char *memprofile;
    char *memdebug;
    char *debug;
    char *threads;
    char *want_libltdl;
    char *symbol_visibility;
    char *ft_support;
    
    /* setup the strings that don't require allocations*/
    heterogeneous = OPAL_ENABLE_HETEROGENEOUS_SUPPORT ? "yes" : "no";
    memprofile = OPAL_ENABLE_MEM_PROFILE ? "yes" : "no";
    memdebug = OPAL_ENABLE_MEM_DEBUG ? "yes" : "no";
    debug = OPAL_ENABLE_DEBUG ? "yes" : "no";
    want_libltdl = OPAL_WANT_LIBLTDL ? "yes" : "no";
    symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no";
    
    /* setup strings that require allocation */    
    if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) {
        asprintf(&threads, "%s (mpi: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
                 (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"),
                 OPAL_ENABLE_MULTI_THREADS ? "yes" : "no");
    } else {
        threads = strdup("no");
    }
    
    asprintf(&ft_support, "%s (checkpoint thread: %s)", 
             OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no");;
    
    /* output values */
    orcm_info_out("Configured by", "config:user", ORCM_CONFIGURE_USER);
    orcm_info_out("Configured on", "config:timestamp", ORCM_CONFIGURE_DATE);
    orcm_info_out("Configure host", "config:host", ORCM_CONFIGURE_HOST);
    
    orcm_info_out("Built by", "build:user", ORCM_BUILD_USER);
    orcm_info_out("Built on", "build:timestamp", ORCM_BUILD_DATE);
    orcm_info_out("Built host", "build:host", ORCM_BUILD_HOST);

    orcm_info_out("C compiler", "compiler:c:command", OPAL_CC);
    orcm_info_out("C compiler family name", "compiler:c:familyname", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
    orcm_info_out("C compiler version", "compiler:c:version", _STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
    
    if (want_all) {
        orcm_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char));
        /* JMS: should be fixed in MPI-2.2 to differentiate between C
         _Bool and C++ bool.  For the moment, the code base assumes
         that they are the same.  Because of opal_config_bottom.h,
         we can sizeof(bool) here, so we might as well -- even
         though this technically isn't right.  This should be fixed
         when we update to MPI-2.2.  See below for note about C++
         bool alignment. */
        orcm_info_out_int("C bool size", "compiler:c:sizeof:bool", sizeof(bool));
        orcm_info_out_int("C short size", "compiler:c:sizeof:short", sizeof(short));
        orcm_info_out_int("C int size", "compiler:c:sizeof:int", sizeof(int));
        orcm_info_out_int("C long size", "compiler:c:sizeof:long", sizeof(long));
        orcm_info_out_int("C float size", "compiler:c:sizeof:float", sizeof(float));
        orcm_info_out_int("C double size", "compiler:c:sizeof:double", sizeof(double));
        orcm_info_out_int("C pointer size", "compiler:c:sizeof:pointer", sizeof(void *));
        orcm_info_out_int("C char align", "compiler:c:align:char", OPAL_ALIGNMENT_CHAR);
        orcm_info_out("C bool align", "compiler:c:align:bool", "skipped");
        orcm_info_out_int("C int align", "compiler:c:align:int", OPAL_ALIGNMENT_INT);
        orcm_info_out_int("C float align", "compiler:c:align:float", OPAL_ALIGNMENT_FLOAT);
        orcm_info_out_int("C double align", "compiler:c:align:double", OPAL_ALIGNMENT_DOUBLE);
    }
    
    if (want_all) {
        
        orcm_info_out("Thread support", "option:threads", threads);
        free(threads);
        
        orcm_info_out("Build CFLAGS", "option:build:cflags", ORCM_BUILD_CFLAGS);
        orcm_info_out("Build LDFLAGS", "option:build:ldflags", ORCM_BUILD_LDFLAGS);
        orcm_info_out("Build LIBS", "option:build:libs", ORCM_BUILD_LIBS);
        
        orcm_info_out("Wrapper extra CFLAGS", "option:wrapper:extra_cflags", 
                      WRAPPER_EXTRA_CFLAGS);
        orcm_info_out("Wrapper extra CXXFLAGS", "option:wrapper:extra_cxxflags", 
                      WRAPPER_EXTRA_CXXFLAGS);
        orcm_info_out("Wrapper extra LDFLAGS", "option:wrapper:extra_ldflags", 
                      WRAPPER_EXTRA_LDFLAGS);
        orcm_info_out("Wrapper extra LIBS", "option:wrapper:extra_libs",
                      WRAPPER_EXTRA_LIBS);
    }
    
    orcm_info_out("Internal debug support", "option:debug", debug);
    orcm_info_out("Memory profiling support", "option:mem-profile", memprofile);
    orcm_info_out("Memory debugging support", "option:mem-debug", memdebug);
    orcm_info_out("libltdl support", "option:dlopen", want_libltdl);
    orcm_info_out("Heterogeneous support", "options:heterogeneous", heterogeneous);
    orcm_info_out("Symbol vis. support", "options:visibility", symbol_visibility);
    
    orcm_info_out("FT Checkpoint support", "options:ft_support", ft_support);
    free(ft_support);
    
}
コード例 #4
0
void orcm_info_do_hostname()
{
    orcm_info_out("Configure host", "config:host", ORCM_CONFIGURE_HOST);
}
コード例 #5
0
void orcm_info_do_arch()
{
    orcm_info_out("Configured architecture", "config:arch", OPAL_ARCH);
}
コード例 #6
0
void orcm_info_show_mca_params(opal_list_t *info,
                               const char *type, const char *component, 
                               bool want_internal)
{
    opal_list_item_t *i;
    mca_base_param_info_t *p;
    char *value_string, *empty = "";
    char *message, *content, *tmp;
    int value_int, j;
    mca_base_param_source_t source;
    char *src_file;
    
    for (i = opal_list_get_first(info); i != opal_list_get_last(info);
         i = opal_list_get_next(i)) {
        p = (mca_base_param_info_t*) i;
        
        if (NULL != p->mbpp_type_name && 0 == strcmp(type, p->mbpp_type_name)) {
            if (0 == strcmp(component, orcm_info_component_all) || 
                NULL == p->mbpp_component_name ||
                (NULL != p->mbpp_component_name &&
                 0 == strcmp(component, p->mbpp_component_name))) {
                
                /* Find the source of the value */
                if (OPAL_SUCCESS != 
                    mca_base_param_lookup_source(p->mbpp_index, &source, &src_file)) {
                    continue;
                }
                
                /* Make a char *for the default value.  Invoke a
                 * lookup because it may transform the char *("~/" ->
                 * "<home dir>/") or get the value from the
                 * environment, a file, etc.
                 */
                if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
                    mca_base_param_lookup_string(p->mbpp_index,
                                                 &value_string);
                    
                    /* Can't let the char *be NULL because we
                     * assign it to a std::string, below
                     */
                    if (NULL == value_string) {
                        value_string = strdup(empty);
                    }
                } else {
                    mca_base_param_lookup_int(p->mbpp_index, &value_int);
                    asprintf(&value_string, "%d", value_int);
                }
                
                /* Build up the strings to orcm_info_output. */
                
                if (orcm_info_pretty) {
                    asprintf(&message, "MCA %s", p->mbpp_type_name);
                    
                    /* Put in the real, full name (which may be
                     * different than the categorization).
                     */
                    asprintf(&content, "%s \"%s\" (%s: <%s>, data source: ",
                             p->mbpp_read_only ? "information" : "parameter",
                             p->mbpp_full_name,
                             p->mbpp_read_only ? "value" : "current value",
                             (0 == strlen(value_string)) ? "none" : value_string);
                    
                    /* Indicate where the param was set from */
                    switch(source) {
                        case MCA_BASE_PARAM_SOURCE_DEFAULT:
                            asprintf(&tmp, "%sdefault value", content);
                            free(content);
                            content = tmp;
                            break;
                        case MCA_BASE_PARAM_SOURCE_ENV:
                            asprintf(&tmp, "%senvironment or cmdline", content);
                            free(content);
                            content = tmp;
                            break;
                        case MCA_BASE_PARAM_SOURCE_FILE:
                            asprintf(&tmp, "%sfile [%s]", content, src_file);
                            free(content);
                            content = tmp;
                            break;
                        case MCA_BASE_PARAM_SOURCE_OVERRIDE:
                            asprintf(&tmp, "%sAPI override", content);
                            free(content);
                            content = tmp;
                            break;
                        default:
                            break;
                    }
                    
                    /* Is this parameter deprecated? */
                    if (p->mbpp_deprecated) {
                        asprintf(&tmp, "%s, deprecated", content);
                        free(content);
                        content = tmp;
                    }
                    
                    /* Does this parameter have any synonyms? */
                    if (p->mbpp_synonyms_len > 0) {
                        asprintf(&tmp, "%s, synonyms: ", content);
                        free(content);
                        content = tmp;
                        for (j = 0; j < p->mbpp_synonyms_len; ++j) {
                            if (j > 0) {
                                asprintf(&tmp, "%s, %s", content, p->mbpp_synonyms[j]->mbpp_full_name);
                                free(content);
                                content = tmp;
                            } else {
                                asprintf(&tmp, "%s%s", content, p->mbpp_synonyms[j]->mbpp_full_name);
                                free(content);
                                content = tmp;
                            }
                        }
                    }
                    
                    /* Is this parameter a synonym of something else? */
                    else if (NULL != p->mbpp_synonym_parent) {
                        asprintf(&tmp, "%s, synonym of: %s", content, p->mbpp_synonym_parent->mbpp_full_name);
                        free(content);
                        content = tmp;
                    }
                    asprintf(&tmp, "%s)", content);
                    free(content);
                    content = tmp;
                    orcm_info_out(message, message, content);
                    free(message);
                    free(content);
                    
                    /* If we have a help message, orcm_info_output it */
                    if (NULL != p->mbpp_help_msg) {
                        orcm_info_out("", "", p->mbpp_help_msg);
                    }
                } else {
                    /* build the message*/
                    asprintf(&tmp, "mca:%s:%s:param:%s:", p->mbpp_type_name,
                             (NULL == p->mbpp_component_name) ? "base" : p->mbpp_component_name,
                             p->mbpp_full_name);

                    /* Output the value */
                    asprintf(&message, "%svalue", tmp);
                    orcm_info_out(message, message, value_string);
                    free(message);
                    
                    /* Indicate where the param was set from */
                    
                    asprintf(&message, "%sdata_source", tmp);
                    switch(source) {
                        case MCA_BASE_PARAM_SOURCE_DEFAULT:
                            content = strdup("default value");
                            break;
                        case MCA_BASE_PARAM_SOURCE_ENV:
                            content = strdup("environment-cmdline");
                            break;
                        case MCA_BASE_PARAM_SOURCE_FILE:
                            asprintf(&content, "file: %s", src_file);
                            break;
                        case MCA_BASE_PARAM_SOURCE_OVERRIDE:
                            content = strdup("API override");
                            break;
                        default:
                            break;
                    }
                    orcm_info_out(message, message, content);
                    free(message);
                    free(content);
                    
                    /* Output whether it's read only or writable */
                    
                    asprintf(&message, "%sstatus", tmp);
                    content = p->mbpp_read_only ? "read-only" : "writable";
                    orcm_info_out(message, message, content);
                    free(message);
                    
                    /* If it has a help message, orcm_info_output that */
                    
                    if (NULL != p->mbpp_help_msg) {
                        asprintf(&message, "%shelp", tmp);
                        content = p->mbpp_help_msg;
                        orcm_info_out(message, message, content);
                        free(message);
                    }
                    
                    /* Is this parameter deprecated? */
                    asprintf(&message, "%sdeprecated", tmp);
                    content = p->mbpp_deprecated ? "yes" : "no";
                    orcm_info_out(message, message, content);
                    free(message);
                    
                    /* Does this parameter have any synonyms? */
                    if (p->mbpp_synonyms_len > 0) {
                        for (j = 0; j < p->mbpp_synonyms_len; ++j) {
                            asprintf(&message, "%ssynonym:name", tmp);
                            content = p->mbpp_synonyms[j]->mbpp_full_name;
                            orcm_info_out(message, message, content);
                            free(message);
                        }
                    }
                    
                    /* Is this parameter a synonym of something else? */
                    else if (NULL != p->mbpp_synonym_parent) {
                        asprintf(&message, "%ssynonym_of:name", tmp);
                        content = p->mbpp_synonym_parent->mbpp_full_name;
                        orcm_info_out(message, message, content);
                        free(message);
                    }
                }
                
                /* If we allocated the string, then free it */
                
                if (NULL != value_string) {
                    free(value_string);
                }
            }
        }
    }
}