Opal: Add a new MCA variable type "version_string". Also add a
new flag to ompi_info that allows a user to print all MCA variables of a specific type. --type version_string This command will print all MCA variables of type version_string. This feature was developed by Elena Shipunova and was reviewed by Josh Ladd. This commit was SVN r32166.
Этот коммит содержится в:
родитель
cde2b67284
Коммит
057370364d
@ -1411,7 +1411,7 @@ static int fca_register(void)
|
||||
(void) mca_base_component_var_register(c,
|
||||
MCA_COMPILETIME_VER,
|
||||
"Version of the libfca library ompi compiled with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
@ -1420,7 +1420,7 @@ static int fca_register(void)
|
||||
(void) mca_base_component_var_register(c,
|
||||
MCA_RUNTIME_VER,
|
||||
"Version of the libfca library ompi run with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
|
@ -211,7 +211,7 @@ static int hcoll_register(void)
|
||||
mca_base_component_var_register(&mca_coll_hcoll_component.super.collm_version,
|
||||
MCA_COMPILETIME_VER,
|
||||
"Version of the libhcoll library ompi compiled with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
@ -220,7 +220,7 @@ static int hcoll_register(void)
|
||||
mca_base_component_var_register(&mca_coll_hcoll_component.super.collm_version,
|
||||
MCA_RUNTIME_VER,
|
||||
"Version of the libhcoll library ompi run with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
|
@ -96,7 +96,7 @@ static int ompi_mtl_mxm_component_register(void)
|
||||
(void) mca_base_component_var_register(c,
|
||||
MCA_COMPILETIME_VER,
|
||||
"Version of the libmxm library ompi compiled with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
@ -115,7 +115,7 @@ static int ompi_mtl_mxm_component_register(void)
|
||||
(void) mca_base_component_var_register(c,
|
||||
MCA_RUNTIME_VER,
|
||||
"Version of the libmxm library ompi run with",
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
NULL, 0, 0,
|
||||
OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
|
@ -83,6 +83,12 @@ Show MCA parameters. The first parameter is the type of the component
|
||||
to display; the second parameter is the specific component to display
|
||||
(or the keyword "all", meaning "display all components of this type").
|
||||
.TP 8
|
||||
.I \-t|\-\-type
|
||||
Show MCA parameters of the type specified in the parameter. Accepts the
|
||||
following parameters: unsigned_int, unsigned_long, unsigned_long_long,
|
||||
size_t, string, version_string, bool, double. By default level
|
||||
is 9 unless it is specified with \-\-level.
|
||||
.TP 8
|
||||
.I \-\-parsable
|
||||
When used in conjunction with other parameters, the output is
|
||||
displayed in a machine-parsable format
|
||||
@ -243,6 +249,12 @@ machine-parsable format.
|
||||
.
|
||||
.
|
||||
.TP
|
||||
ompi_info --type string --pretty-print --level 3
|
||||
Show the level 3 MCA parameters of string type in a human-readable /
|
||||
prettyprint format.
|
||||
.
|
||||
.
|
||||
.TP
|
||||
ompi_info --path bindir
|
||||
Show the "bindir" that Open MPI was configured with.
|
||||
.
|
||||
|
@ -158,6 +158,10 @@ int main(int argc, char *argv[])
|
||||
&mca_types, ompi_info_cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
if (opal_cmd_line_is_taken(ompi_info_cmd_line, "type")) {
|
||||
opal_info_do_type(ompi_info_cmd_line);
|
||||
acted = true;
|
||||
}
|
||||
|
||||
/* If no command line args are specified, show default set */
|
||||
|
||||
|
@ -73,11 +73,12 @@ static opal_hash_table_t mca_base_var_index_hash;
|
||||
|
||||
const char *var_type_names[] = {
|
||||
"int",
|
||||
"unsigned",
|
||||
"unsigned long",
|
||||
"unsigned long long",
|
||||
"unsigned_int",
|
||||
"unsigned_long",
|
||||
"unsigned_long_long",
|
||||
"size_t",
|
||||
"string",
|
||||
"version_string",
|
||||
"bool",
|
||||
"double"
|
||||
};
|
||||
@ -89,6 +90,7 @@ const size_t var_type_sizes[] = {
|
||||
sizeof (unsigned long long),
|
||||
sizeof (size_t),
|
||||
sizeof (char),
|
||||
sizeof (char),
|
||||
sizeof (bool),
|
||||
sizeof (double)
|
||||
};
|
||||
@ -653,6 +655,7 @@ static int var_set_from_string (mca_base_var_t *var, char *src)
|
||||
dst->lfval = strtod (src, NULL);
|
||||
break;
|
||||
case MCA_BASE_VAR_TYPE_STRING:
|
||||
case MCA_BASE_VAR_TYPE_VERSION_STRING:
|
||||
var_set_string (var, src);
|
||||
break;
|
||||
case MCA_BASE_VAR_TYPE_MAX:
|
||||
@ -693,7 +696,7 @@ int mca_base_var_set_value (int vari, const void *value, size_t size, mca_base_v
|
||||
}
|
||||
}
|
||||
|
||||
if (MCA_BASE_VAR_TYPE_STRING != var->mbv_type) {
|
||||
if (MCA_BASE_VAR_TYPE_STRING != var->mbv_type && MCA_BASE_VAR_TYPE_VERSION_STRING != var->mbv_type) {
|
||||
memmove (var->mbv_storage, value, var_type_sizes[var->mbv_type]);
|
||||
} else {
|
||||
var_set_string (var, (char *) value);
|
||||
@ -735,7 +738,7 @@ int mca_base_var_deregister(int vari)
|
||||
}
|
||||
|
||||
/* Release the current value if it is a string. */
|
||||
if (MCA_BASE_VAR_TYPE_STRING == var->mbv_type &&
|
||||
if ((MCA_BASE_VAR_TYPE_STRING == var->mbv_type || MCA_BASE_VAR_TYPE_VERSION_STRING == var->mbv_type) &&
|
||||
var->mbv_storage->stringval) {
|
||||
free (var->mbv_storage->stringval);
|
||||
var->mbv_storage->stringval = NULL;
|
||||
@ -935,7 +938,7 @@ int mca_base_var_build_env(char ***env, int *num_env, bool internal)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (MCA_BASE_VAR_TYPE_STRING == var->mbv_type &&
|
||||
if ((MCA_BASE_VAR_TYPE_STRING == var->mbv_type || MCA_BASE_VAR_TYPE_VERSION_STRING == var->mbv_type) &&
|
||||
NULL == var->mbv_storage->stringval) {
|
||||
continue;
|
||||
}
|
||||
@ -1327,7 +1330,7 @@ static int register_variable (const char *project_name, const char *framework_na
|
||||
var->mbv_storage = storage;
|
||||
|
||||
/* make a copy of the default string value */
|
||||
if (MCA_BASE_VAR_TYPE_STRING == type && NULL != ((char **)storage)[0]) {
|
||||
if ((MCA_BASE_VAR_TYPE_STRING == type || MCA_BASE_VAR_TYPE_VERSION_STRING == type) && NULL != ((char **)storage)[0]) {
|
||||
((char **)storage)[0] = strdup (((char **)storage)[0]);
|
||||
}
|
||||
}
|
||||
@ -1655,7 +1658,8 @@ static void var_constructor(mca_base_var_t *var)
|
||||
*/
|
||||
static void var_destructor(mca_base_var_t *var)
|
||||
{
|
||||
if (MCA_BASE_VAR_TYPE_STRING == var->mbv_type &&
|
||||
if ((MCA_BASE_VAR_TYPE_STRING == var->mbv_type ||
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING == var->mbv_type) &&
|
||||
NULL != var->mbv_storage &&
|
||||
NULL != var->mbv_storage->stringval) {
|
||||
free (var->mbv_storage->stringval);
|
||||
@ -1759,6 +1763,7 @@ static int var_value_string (mca_base_var_t *var, char **value_string)
|
||||
ret = asprintf (value_string, "%" PRIsize_t, value->sizetval);
|
||||
break;
|
||||
case MCA_BASE_VAR_TYPE_STRING:
|
||||
case MCA_BASE_VAR_TYPE_VERSION_STRING:
|
||||
ret = asprintf (value_string, "%s",
|
||||
value->stringval ? value->stringval : "");
|
||||
break;
|
||||
@ -2054,3 +2059,4 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,8 @@ typedef enum {
|
||||
MCA_BASE_VAR_TYPE_SIZE_T,
|
||||
/** The variable is of type string. */
|
||||
MCA_BASE_VAR_TYPE_STRING,
|
||||
/** The variable is of type string and contains version. */
|
||||
MCA_BASE_VAR_TYPE_VERSION_STRING,
|
||||
/** The variable is of type bool */
|
||||
MCA_BASE_VAR_TYPE_BOOL,
|
||||
/** The variable is of type double */
|
||||
@ -92,6 +94,7 @@ typedef enum {
|
||||
MCA_BASE_VAR_TYPE_MAX
|
||||
} mca_base_var_type_t;
|
||||
|
||||
extern const char *var_type_names[];
|
||||
|
||||
/**
|
||||
* Source of an MCA variable's value
|
||||
|
@ -138,6 +138,8 @@ int opal_info_init(int argc, char **argv,
|
||||
"Show architecture Open MPI was compiled on");
|
||||
opal_cmd_line_make_opt3(opal_info_cmd_line, 'c', NULL, "config", 0,
|
||||
"Show configuration options");
|
||||
opal_cmd_line_make_opt3(opal_info_cmd_line, 't', NULL, "type", 1,
|
||||
"Show internal MCA parameters with the type specified in parameter.");
|
||||
opal_cmd_line_make_opt3(opal_info_cmd_line, 'h', NULL, "help", 0,
|
||||
"Show this help message");
|
||||
opal_cmd_line_make_opt3(opal_info_cmd_line, '\0', NULL, "pretty-print", 0,
|
||||
@ -532,6 +534,63 @@ void opal_info_err_params(opal_pointer_array_t *component_map)
|
||||
return;
|
||||
}
|
||||
|
||||
void opal_info_do_type(opal_cmd_line_t *opal_info_cmd_line)
|
||||
{
|
||||
mca_base_var_info_lvl_t max_level = OPAL_INFO_LVL_9;
|
||||
int count;
|
||||
char *type, *component, *str;
|
||||
bool found;
|
||||
int i, j, k, len, ret;
|
||||
char *p;
|
||||
const mca_base_var_t *var;
|
||||
char** strings, *message;
|
||||
const mca_base_var_group_t *group;
|
||||
p = "type";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
count = opal_cmd_line_get_ninsts(opal_info_cmd_line, p);
|
||||
len = mca_base_var_get_count ();
|
||||
|
||||
for (k = 0; k < count; ++k) {
|
||||
type = opal_cmd_line_get_param(opal_info_cmd_line, p, k, 0);
|
||||
for (i = 0; i < len; ++i) {
|
||||
ret = mca_base_var_get (i, &var);
|
||||
if (OPAL_SUCCESS != ret) {
|
||||
continue;
|
||||
}
|
||||
if (0 == strcmp(type, var_type_names[var->mbv_type]) && (var->mbv_info_lvl <= max_level)) {
|
||||
ret = mca_base_var_dump(var->mbv_index, &strings, !opal_info_pretty ? MCA_BASE_VAR_DUMP_PARSABLE : MCA_BASE_VAR_DUMP_READABLE);
|
||||
if (OPAL_SUCCESS != ret) {
|
||||
continue;
|
||||
}
|
||||
(void) mca_base_var_group_get(var->mbv_group_index, &group);
|
||||
for (j = 0 ; strings[j] ; ++j) {
|
||||
if (0 == j && opal_info_pretty) {
|
||||
asprintf (&message, "MCA %s", group->group_framework);
|
||||
opal_info_out(message, message, strings[j]);
|
||||
free(message);
|
||||
} else {
|
||||
opal_info_out("", "", strings[j]);
|
||||
}
|
||||
free(strings[j]);
|
||||
}
|
||||
free(strings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -98,6 +98,8 @@ OPAL_DECLSPEC void opal_info_do_arch(void);
|
||||
|
||||
OPAL_DECLSPEC void opal_info_do_hostname(void);
|
||||
|
||||
OPAL_DECLSPEC void opal_info_do_type(opal_cmd_line_t *opal_info_cmd_line);
|
||||
|
||||
OPAL_DECLSPEC void opal_info_out(const char *pretty_message, const char *plain_message, const char *value);
|
||||
|
||||
OPAL_DECLSPEC void opal_info_out_int(const char *pretty_message,
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user