Two quibbles with this commit: 1. Can the help strings for the various components be updated to use proper grammar and capitalization? For example:
Version of the libfca library ompi compiled with change to: Version of the libfca library with which Open MPI was compiled 2. I'm not a fan of --type automatically changing the level to 9. --type should be orthogonal to level; --type should just set a filter to only show variables of a certain type -- nothing else. On Jul 8, 2014, at 9:37 PM, svn-commit-mai...@open-mpi.org wrote: > Author: jladd (Joshua Ladd) > Date: 2014-07-08 21:37:23 EDT (Tue, 08 Jul 2014) > New Revision: 32166 > URL: https://svn.open-mpi.org/trac/ompi/changeset/32166 > > Log: > 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. > > Text files modified: > trunk/ompi/mca/coll/fca/coll_fca_component.c | 4 +- > > trunk/ompi/mca/coll/hcoll/coll_hcoll_component.c | 4 +- > > trunk/ompi/mca/mtl/mxm/mtl_mxm_component.c | 4 +- > > trunk/ompi/tools/ompi_info/ompi_info.1in | 12 ++++++++ > > trunk/ompi/tools/ompi_info/ompi_info.c | 4 ++ > > trunk/opal/mca/base/mca_base_var.c | 22 +++++++++----- > > trunk/opal/mca/base/mca_base_var.h | 3 ++ > > trunk/opal/runtime/opal_info_support.c | 59 > ++++++++++++++++++++++++++++++++++++++++ > trunk/opal/runtime/opal_info_support.h | 2 + > > 9 files changed, 100 insertions(+), 14 deletions(-) > > Modified: trunk/ompi/mca/coll/fca/coll_fca_component.c > ============================================================================== > --- trunk/ompi/mca/coll/fca/coll_fca_component.c Tue Jul 8 21:24:53 > 2014 (r32165) > +++ trunk/ompi/mca/coll/fca/coll_fca_component.c 2014-07-08 21:37:23 EDT > (Tue, 08 Jul 2014) (r32166) > @@ -1411,7 +1411,7 @@ > (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 @@ > (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, > > Modified: trunk/ompi/mca/coll/hcoll/coll_hcoll_component.c > ============================================================================== > --- trunk/ompi/mca/coll/hcoll/coll_hcoll_component.c Tue Jul 8 21:24:53 > 2014 (r32165) > +++ trunk/ompi/mca/coll/hcoll/coll_hcoll_component.c 2014-07-08 21:37:23 EDT > (Tue, 08 Jul 2014) (r32166) > @@ -211,7 +211,7 @@ > > 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 @@ > > 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, > > Modified: trunk/ompi/mca/mtl/mxm/mtl_mxm_component.c > ============================================================================== > --- trunk/ompi/mca/mtl/mxm/mtl_mxm_component.c Tue Jul 8 21:24:53 > 2014 (r32165) > +++ trunk/ompi/mca/mtl/mxm/mtl_mxm_component.c 2014-07-08 21:37:23 EDT > (Tue, 08 Jul 2014) (r32166) > @@ -96,7 +96,7 @@ > (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 @@ > (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, > > Modified: trunk/ompi/tools/ompi_info/ompi_info.1in > ============================================================================== > --- trunk/ompi/tools/ompi_info/ompi_info.1in Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/ompi/tools/ompi_info/ompi_info.1in 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -83,6 +83,12 @@ > 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 @@ > . > . > .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. > . > > Modified: trunk/ompi/tools/ompi_info/ompi_info.c > ============================================================================== > --- trunk/ompi/tools/ompi_info/ompi_info.c Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/ompi/tools/ompi_info/ompi_info.c 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -158,6 +158,10 @@ > &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 */ > > > Modified: trunk/opal/mca/base/mca_base_var.c > ============================================================================== > --- trunk/opal/mca/base/mca_base_var.c Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/opal/mca/base/mca_base_var.c 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -73,11 +73,12 @@ > > 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 @@ > sizeof (unsigned long long), > sizeof (size_t), > sizeof (char), > + sizeof (char), > sizeof (bool), > sizeof (double) > }; > @@ -653,6 +655,7 @@ > 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 @@ > } > } > > - 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 @@ > } > > /* 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 @@ > 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 @@ > 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_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 @@ > 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 @@ > > return OPAL_SUCCESS; > } > + > > Modified: trunk/opal/mca/base/mca_base_var.h > ============================================================================== > --- trunk/opal/mca/base/mca_base_var.h Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/opal/mca/base/mca_base_var.h 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -84,6 +84,8 @@ > 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 @@ > MCA_BASE_VAR_TYPE_MAX > } mca_base_var_type_t; > > +extern const char *var_type_names[]; > > /** > * Source of an MCA variable's value > > Modified: trunk/opal/runtime/opal_info_support.c > ============================================================================== > --- trunk/opal/runtime/opal_info_support.c Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/opal/runtime/opal_info_support.c 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -138,6 +138,8 @@ > "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 @@ > 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) > { > > Modified: trunk/opal/runtime/opal_info_support.h > ============================================================================== > --- trunk/opal/runtime/opal_info_support.h Tue Jul 8 21:24:53 2014 > (r32165) > +++ trunk/opal/runtime/opal_info_support.h 2014-07-08 21:37:23 EDT (Tue, > 08 Jul 2014) (r32166) > @@ -98,6 +98,8 @@ > > 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, > _______________________________________________ > svn-full mailing list > svn-f...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/svn-full -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/