1
1

Add support for the MCA variable information level to ompi_info.

Add an option to ompi_info (-l, --level) that takes a number in the
interval (1,9). Only MCA variables up to this level will be printed.
The default level is 1.

Print the level as part of both the parsable and readable output.

This commit was SVN r28750.
Этот коммит содержится в:
Nathan Hjelm 2013-07-10 18:52:36 +00:00
родитель 28dac8010b
Коммит a694bcb6b6
4 изменённых файлов: 56 добавлений и 14 удалений

Просмотреть файл

@ -72,6 +72,18 @@ static opal_list_t mca_base_var_override_values;
static int mca_base_var_count = 0;
static int mca_base_var_group_count = 0;
static const char *info_lvl_strings[] = {
"user/basic",
"user/detail",
"user/all",
"tuner/basic",
"tuner/detail",
"tuner/all",
"dev/basic",
"dev/detail",
"dev/all"
};
/*
* local functions
*/
@ -2099,7 +2111,7 @@ int mca_base_var_dump(int index, char ***out, mca_base_var_dump_type_t output_ty
(void) var->mbv_enumerator->get_count(var->mbv_enumerator, &enum_count);
}
line_count = 7 + (var->mbv_description ? 1 : 0) + (VAR_IS_SYNONYM(var[0]) ? 1 : synonym_count) +
line_count = 8 + (var->mbv_description ? 1 : 0) + (VAR_IS_SYNONYM(var[0]) ? 1 : synonym_count) +
enum_count;
*out = (char **) calloc (line_count + 1, sizeof (char *));
@ -2124,6 +2136,9 @@ int mca_base_var_dump(int index, char ***out, mca_base_var_dump_type_t output_ty
/* Output whether it's read only or writable */
asprintf(out[0] + line++, "%sstatus:%s", tmp, VAR_IS_DEFAULT_ONLY(var[0]) ? "read-only" : "writeable");
/* Output the info level of this parametere */
asprintf(out[0] + line++, "%slevel:%d", tmp, var->mbv_info_lvl + 1);
/* If it has a help message, output the help message */
if (var->mbv_description) {
asprintf(out[0] + line++, "%shelp:%s", tmp, var->mbv_description);
@ -2175,9 +2190,10 @@ int mca_base_var_dump(int index, char ***out, mca_base_var_dump_type_t output_ty
return OPAL_ERR_OUT_OF_RESOURCE;
}
asprintf (out[0], "%s \"%s\" (current value: \"%s\", data source: %s",
asprintf (out[0], "%s \"%s\" (current value: \"%s\", data source: %s, level: %d %s",
VAR_IS_DEFAULT_ONLY(var[0]) ? "informational" : "parameter",
full_name, value_string, source_string);
full_name, value_string, source_string, var->mbv_info_lvl + 1,
info_lvl_strings[var->mbv_info_lvl]);
free (value_string);
free (source_string);

Просмотреть файл

@ -11,6 +11,8 @@
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -55,3 +57,9 @@ for that framework was not configured into this version of OMPI. Please see
ompi_info --config
for a full report of how OMPI was configured.
#
[invalid-level]
An invalid MCA parameter information level was specified. Valid values are
1-9.
Value: %s

Просмотреть файл

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2012 Los Alamos National Security, LLC.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2011-2012 University of Houston. All rights reserved.
* $COPYRIGHT$
@ -145,7 +145,9 @@ int opal_info_init(int argc, char **argv,
"Show the hostname that Open MPI was configured and built on");
opal_cmd_line_make_opt3(opal_info_cmd_line, 'a', NULL, "all", 0,
"Show all configuration options and MCA parameters");
opal_cmd_line_make_opt3(opal_info_cmd_line, 'l', NULL, "level", 1,
"Show only variables with at most this level (1-9)");
/* set our threading level */
opal_set_using_threads(false);
@ -408,6 +410,7 @@ void opal_info_do_params(bool want_all_in, bool want_internal,
opal_pointer_array_t *mca_types,
opal_cmd_line_t *opal_info_cmd_line)
{
mca_base_var_info_lvl_t max_level = OPAL_INFO_LVL_1;
int count;
char *type, *component, *str;
bool found;
@ -423,6 +426,19 @@ void opal_info_do_params(bool want_all_in, bool want_internal,
p = "foo"; /* should never happen, but protect against segfault */
}
if (NULL != (str = opal_cmd_line_get_param (opal_info_cmd_line, "level", 0, 0))) {
char *tmp;
errno = 0;
max_level = strtol (str, &tmp, 10) + OPAL_INFO_LVL_1 - 1;
if (0 != errno || '\0' != tmp[0] || max_level < OPAL_INFO_LVL_1 || max_level > OPAL_INFO_LVL_9) {
char *usage = opal_cmd_line_get_usage_msg(opal_info_cmd_line);
opal_show_help("help-opal_info.txt", "invalid-level", true, str);
free(usage);
exit(1);
}
}
if (want_all_in) {
want_all = true;
} else {
@ -446,7 +462,7 @@ void opal_info_do_params(bool want_all_in, bool want_internal,
if (NULL == (type = (char *)opal_pointer_array_get_item(mca_types, i))) {
continue;
}
opal_info_show_mca_params(type, opal_info_component_all, want_internal);
opal_info_show_mca_params(type, opal_info_component_all, max_level, want_internal);
}
} else {
for (i = 0; i < count; ++i) {
@ -470,7 +486,7 @@ void opal_info_do_params(bool want_all_in, bool want_internal,
exit(1);
}
opal_info_show_mca_params(type, component, want_internal);
opal_info_show_mca_params(type, component, max_level, want_internal);
}
}
}
@ -493,13 +509,13 @@ void opal_info_err_params(opal_pointer_array_t *component_map)
fprintf(stderr, "opal_info_err_params: map not found\n");
return;
}
opal_info_show_mca_params(map->type, opal_info_component_all, true);
opal_info_show_mca_params(map->type, opal_info_component_all, OPAL_INFO_LVL_9, true);
fprintf(stderr, "\n");
return;
}
static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, bool want_internal)
static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, mca_base_var_info_lvl_t max_level, bool want_internal)
{
const mca_base_var_t *var;
const int *variables;
@ -513,7 +529,8 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, b
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)) {
!want_internal) ||
max_level < var->mbv_info_lvl) {
continue;
}
@ -545,12 +562,12 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, b
if (OPAL_SUCCESS != ret) {
continue;
}
opal_info_show_mca_group_params(group, want_internal);
opal_info_show_mca_group_params(group, max_level, want_internal);
}
}
void opal_info_show_mca_params(const char *type, const char *component,
bool want_internal)
mca_base_var_info_lvl_t max_level, bool want_internal)
{
const mca_base_var_group_t *group;
int ret;
@ -563,7 +580,7 @@ void opal_info_show_mca_params(const char *type, const char *component,
(void) mca_base_var_group_get(ret, &group);
opal_info_show_mca_group_params(group, want_internal);
opal_info_show_mca_group_params(group, max_level, want_internal);
} else {
ret = mca_base_var_group_find("*", type, component);
if (0 > ret) {
@ -571,7 +588,7 @@ void opal_info_show_mca_params(const char *type, const char *component,
}
(void) mca_base_var_group_get(ret, &group);
opal_info_show_mca_group_params(group, want_internal);
opal_info_show_mca_group_params(group, max_level, want_internal);
}
}

Просмотреть файл

@ -75,6 +75,7 @@ OPAL_DECLSPEC void opal_info_do_path(bool want_all, opal_cmd_line_t *cmd_line);
OPAL_DECLSPEC void opal_info_show_mca_params(const char *type,
const char *component,
mca_base_var_info_lvl_t max_level,
bool want_internal);
OPAL_DECLSPEC void opal_info_show_mca_version(const mca_base_component_t *component,