diff --git a/opal/mca/base/base.h b/opal/mca/base/base.h index f7d9e3d34f..04feff4037 100644 --- a/opal/mca/base/base.h +++ b/opal/mca/base/base.h @@ -151,6 +151,13 @@ OPAL_DECLSPEC int mca_base_component_find(const char *directory, const char *typ opal_list_t *found_components, bool open_dso_components); +/** + * Parse the requested component string and return an opal_argv of the requested + * (or not requested) components. + */ +int mca_base_component_parse_requested (const char *requested, bool *include_mode, + char ***requested_component_names); + /** * Filter a list of components based on a comma-delimted list of names and/or * a set of meta-data flags. diff --git a/opal/mca/base/mca_base_component_find.c b/opal/mca/base/mca_base_component_find.c index 2af9f5f852..b96f291c2d 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -150,9 +150,6 @@ static bool use_component(const bool include_mode, const char **requested_component_names, const char *component_name); -static int parse_requested (const char *requested, bool *include_mode, - char ***requested_component_names); - /* * Function to find as many components of a given type as possible. This @@ -174,7 +171,7 @@ int mca_base_component_find(const char *directory, const char *type, bool include_mode; int i, ret; - ret = parse_requested (requested_components, &include_mode, + ret = mca_base_component_parse_requested (requested_components, &include_mode, &requested_component_names); if (OPAL_SUCCESS != ret) { return ret; @@ -259,7 +256,7 @@ int mca_base_components_filter (const char *framework_name, opal_list_t *compone return OPAL_SUCCESS; } - ret = parse_requested (filter_names, &include_mode, + ret = mca_base_component_parse_requested (filter_names, &include_mode, &requested_component_names); if (OPAL_SUCCESS != ret) { return ret; @@ -1022,8 +1019,8 @@ static int component_find_check (const char *framework_name, char **requested_co return OPAL_SUCCESS; } -static int parse_requested (const char *requested, bool *include_mode, - char ***requested_component_names) +int mca_base_component_parse_requested (const char *requested, bool *include_mode, + char ***requested_component_names) { const char *requested_orig = requested; diff --git a/opal/mca/base/mca_base_pvar.c b/opal/mca/base/mca_base_pvar.c index 6f1a0b98ad..5aeb9f5bd3 100644 --- a/opal/mca/base/mca_base_pvar.c +++ b/opal/mca/base/mca_base_pvar.c @@ -784,7 +784,7 @@ int mca_base_pvar_dump(int index, char ***out, mca_base_var_dump_type_t output_t mca_base_var_group_t *group; int line = 0, line_count, i; const mca_base_pvar_t *pvar; - int ret, enum_count; + int ret, enum_count = 0; char *tmp; ret = mca_base_pvar_get (index, &pvar); diff --git a/opal/mca/base/mca_base_pvar.h b/opal/mca/base/mca_base_pvar.h index 39bf090733..a935228428 100644 --- a/opal/mca/base/mca_base_pvar.h +++ b/opal/mca/base/mca_base_pvar.h @@ -166,9 +166,6 @@ typedef struct mca_base_pvar_t { int pvar_index; /** Full name of the variable: form is framework_component_name */ - char *full_name; - - /** Short name of the variable */ char *name; /** Description of this performance variable */ diff --git a/opal/runtime/opal_info_support.c b/opal/runtime/opal_info_support.c index eb18148252..6fc9a722a3 100644 --- a/opal/runtime/opal_info_support.c +++ b/opal/runtime/opal_info_support.c @@ -532,15 +532,48 @@ void opal_info_err_params(opal_pointer_array_t *component_map) 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 int *variables, *groups; + const mca_base_pvar_t *pvar; + const char *group_component; const mca_base_var_t *var; - const int *variables; + char **strings, *message; + bool requested = true; 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); + /* the default component name is "base". depending on how the + * group was registered the group may or not have this set. */ + group_component = group->group_component ? group->group_component : "base"; + + /* check if this group may be disabled due to a selection variable */ + if (0 != strcmp (group_component, "base")) { + int var_id; + + /* read the selection parameter */ + var_id = mca_base_var_find (group->group_project, group->group_framework, NULL, NULL); + if (0 <= var_id) { + const mca_base_var_storage_t *value; + char **requested_components; + bool include_mode; + + mca_base_var_get_value (var_id, &value, NULL, NULL); + if (NULL != value->stringval && '\0' != value->stringval[0]) { + mca_base_component_parse_requested (value->stringval, &include_mode, &requested_components); + + for (i = 0, requested = !include_mode ; requested_components[i] ; ++i) { + if (0 == strcmp (requested_components[i], group->group_component)) { + requested = include_mode; + break; + } + } + + opal_argv_free (requested_components); + } + } + } + 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) && @@ -556,9 +589,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m for (j = 0 ; strings[j] ; ++j) { if (0 == j && opal_info_pretty) { - char *message; - - asprintf (&message, "MCA %s", group->group_framework); + asprintf (&message, "MCA%s %s", requested ? "" : " (disabled)", group->group_framework); opal_info_out(message, message, strings[j]); free(message); } else { @@ -566,6 +597,14 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m } free(strings[j]); } + if (!opal_info_pretty) { + /* generate an entry indicating whether this variable is disabled or not. if the + * format in mca_base_var/pvar.c changes this needs to be changed as well */ + asprintf (&message, "mca:%s:%s:param:%s:disabled:%s", group->group_framework, + group_component, var->mbv_full_name, requested ? "false" : "true"); + opal_info_out("", "", message); + free (message); + } free(strings); } @@ -573,6 +612,11 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m count = opal_value_array_get_size((opal_value_array_t *)&group->group_pvars); for (i = 0 ; i < count ; ++i) { + ret = mca_base_pvar_get(variables[i], &pvar); + if (OPAL_SUCCESS != ret || max_level < pvar->verbosity) { + continue; + } + ret = mca_base_pvar_dump (variables[i], &strings, !opal_info_pretty ? MCA_BASE_VAR_DUMP_PARSABLE : MCA_BASE_VAR_DUMP_READABLE); if (OPAL_SUCCESS != ret) { continue; @@ -580,9 +624,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m for (j = 0 ; strings[j] ; ++j) { if (0 == j && opal_info_pretty) { - char *message; - - asprintf (&message, "MCA %s", group->group_framework); + asprintf (&message, "MCA%s %s", requested ? "" : " (disabled)", group->group_framework); opal_info_out(message, message, strings[j]); free(message); } else { @@ -590,6 +632,14 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m } free(strings[j]); } + if (!opal_info_pretty) { + /* generate an entry indicating whether this variable is disabled or not. if the + * format in mca_base_var/pvar.c changes this needs to be changed as well */ + asprintf (&message, "mca:%s:%s:pvar:%s:disabled:%s", group->group_framework, + group_component, pvar->name, requested ? "false" : "true"); + opal_info_out("", "", message); + free (message); + } free(strings); }