Fixes trac:1383
Lenny and I went back and forth on whether we should simply register another "mpi_paffinity_alone" MCA param and then try to figure out which one was set in ompi_mpi_init, but there was difficulty in figuring out what to do. So it seemed like the Right Thing to do was to implement what was committed in r18770; then we could tell where MCA parameters were set from and you could do Better Things (this is also useful in the openib BTL, where parameters can be set either via MCA parameter or via an INI file). But after that was done, it seemed only a few steps further to actually implement two new features in the MCA params area: * Synonyms (where one MCA param name is a synonym for another) * Allow MCA params and/or their synonyms to be marked as "deprecated" (printing out warnings if they are used) These features have actually long been discussed/desired, and I had some time in airports and airplanes recently where I could work in this stuff on a standalone laptop. So I did it. :-) This commit introduces these two new features, and then uses them to register mpi_paffinity_alone as a non-deprecated synonym for opal_paffinity_alone. A few other random points in this commit: * Add a few error checks for conditions that were not checked before * Correct some comments in mca_base_params.h * Add a few comments in strategic places * ompi_info now prints additional information: * for any MCA parameter that has synonyms, it lists all the synonyms * synonyms are also output as 1st-class MCA params, but with an additional attribute indicating that they have a "parent" * all MCA param name (both "real" or "synonym") will output an attribute indicating whether it is deprecated or not. A synonym is deprecated if it iself is marked as deprecated (via the mca_base_param_regist_syn() or mca_base_param_register_syn_name() functions) or if its "parent" MCA parameter is deprecated This commit was SVN r18859. The following SVN revision numbers were found above: r18770 --> open-mpi/ompi@8efe67e08c The following Trac tickets were found above: Ticket 1383 --> https://svn.open-mpi.org/trac/ompi/ticket/1383
Этот коммит содержится в:
родитель
480c17c332
Коммит
49be4b1e45
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -58,7 +58,7 @@ bool ompi_use_sparse_group_storage = OPAL_INT_TO_BOOL(OMPI_GROUP_SPARSE);
|
||||
|
||||
int ompi_mpi_register_params(void)
|
||||
{
|
||||
int value;
|
||||
int index, value;
|
||||
|
||||
/* Whether we want MPI API function parameter checking or not */
|
||||
|
||||
@ -228,6 +228,11 @@ int ompi_mpi_register_params(void)
|
||||
true);
|
||||
}
|
||||
|
||||
/* Paffinity alone -- make mpi_paffinity_alone a synonym for
|
||||
opal_paffinity_alone */
|
||||
index = mca_base_param_find("opal", NULL, "paffinity_alone");
|
||||
mca_base_param_reg_syn_name(index, "mpi", "paffinity_alone", false);
|
||||
|
||||
/* Sparse group storage support */
|
||||
|
||||
mca_base_param_reg_int_name("mpi", "have_sparse_group_storage",
|
||||
|
@ -9,7 +9,7 @@
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2007 Cisco, Inc. All rights reserved.
|
||||
// Copyright (c) 2007-2008 Cisco, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -91,7 +91,8 @@ namespace ompi_info {
|
||||
extern const std::string path_pkgincludedir;
|
||||
|
||||
void do_params(bool want_all, bool want_internal);
|
||||
void show_mca_params(const std::string& type, const std::string& component,
|
||||
void show_mca_params(opal_list_t *info,
|
||||
const std::string& type, const std::string& component,
|
||||
bool want_internal);
|
||||
|
||||
void do_path(bool want_all, opal_cmd_line_t *cmd_line);
|
||||
|
@ -9,7 +9,7 @@
|
||||
// University of Stuttgart. All rights reserved.
|
||||
// Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
// All rights reserved.
|
||||
// Copyright (c) 2007 Cisco, Inc. All rights reserved.
|
||||
// Copyright (c) 2007-2008 Cisco, Inc. All rights reserved.
|
||||
// $COPYRIGHT$
|
||||
//
|
||||
// Additional copyrights may follow
|
||||
@ -87,6 +87,7 @@ void ompi_info::do_params(bool want_all, bool want_internal)
|
||||
string type, component;
|
||||
bool found;
|
||||
ompi_info::type_vector_t::size_type i;
|
||||
opal_list_t *info;
|
||||
|
||||
ompi_info::open_components();
|
||||
|
||||
@ -102,11 +103,14 @@ void ompi_info::do_params(bool want_all, bool want_internal)
|
||||
}
|
||||
}
|
||||
|
||||
// Get a dump of all the MCA params
|
||||
mca_base_param_dump(&info, want_internal);
|
||||
|
||||
// Show the params
|
||||
|
||||
if (want_all) {
|
||||
for (i = 0; i < mca_types.size(); ++i) {
|
||||
show_mca_params(mca_types[i], component_all, want_internal);
|
||||
show_mca_params(info, mca_types[i], component_all, want_internal);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < count; ++i) {
|
||||
@ -127,23 +131,25 @@ void ompi_info::do_params(bool want_all, bool want_internal)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
show_mca_params(type, component, want_internal);
|
||||
}
|
||||
show_mca_params(info, type, component, want_internal);
|
||||
}
|
||||
}
|
||||
|
||||
// Release all the MCA param memory
|
||||
mca_base_param_dump_release(info);
|
||||
}
|
||||
|
||||
void ompi_info::show_mca_params(const string& type, const string& component,
|
||||
|
||||
void ompi_info::show_mca_params(opal_list_t *info,
|
||||
const string& type, const string& component,
|
||||
bool want_internal)
|
||||
{
|
||||
opal_list_t *info;
|
||||
opal_list_item_t *i;
|
||||
mca_base_param_info_t *p;
|
||||
char *value_string, empty[] = "\0";
|
||||
string message, content, tmp;
|
||||
int value_int;
|
||||
int value_int, j;
|
||||
|
||||
mca_base_param_dump(&info, want_internal);
|
||||
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;
|
||||
@ -192,12 +198,35 @@ void ompi_info::show_mca_params(const string& type, const string& component,
|
||||
"value: " : "current value: ";
|
||||
|
||||
if (strlen(value_string) == 0) {
|
||||
content += "<none>)";
|
||||
content += "<none>";
|
||||
} else {
|
||||
content += "\"";
|
||||
content += value_string;
|
||||
content += "\")";
|
||||
content += "\"";
|
||||
}
|
||||
|
||||
// Is this parameter deprecated?
|
||||
if (p->mbpp_deprecated) {
|
||||
content += ", deprecated";
|
||||
}
|
||||
|
||||
// Does this parameter have any synonyms?
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
content += ", synonyms: ";
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
if (j > 0) {
|
||||
content += ", ";
|
||||
}
|
||||
content += p->mbpp_synonyms[j]->mbpp_full_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Is this parameter a synonym of something else?
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
content += ", synonym of: ";
|
||||
content += p->mbpp_synonym_parent->mbpp_full_name;
|
||||
}
|
||||
content += ")";
|
||||
out(message, message, content);
|
||||
|
||||
// If we have a help message, output it
|
||||
@ -244,6 +273,30 @@ void ompi_info::show_mca_params(const string& type, const string& component,
|
||||
content = p->mbpp_help_msg;
|
||||
out(message, message, content);
|
||||
}
|
||||
|
||||
// Is this parameter deprecated?
|
||||
message = tmp;
|
||||
message += "deprecated";
|
||||
content = p->mbpp_deprecated ? "yes" : "no";
|
||||
out(message, message, content);
|
||||
|
||||
// Does this parameter have any synonyms?
|
||||
if (p->mbpp_synonyms_len > 0) {
|
||||
for (j = 0; j < p->mbpp_synonyms_len; ++j) {
|
||||
message = tmp;
|
||||
message += "synonym:name";
|
||||
content = p->mbpp_synonyms[j]->mbpp_full_name;
|
||||
out(message, message, content);
|
||||
}
|
||||
}
|
||||
|
||||
// Is this parameter a synonym of something else?
|
||||
else if (NULL != p->mbpp_synonym_parent) {
|
||||
message = tmp;
|
||||
message += "synonym_of:name";
|
||||
content = p->mbpp_synonym_parent->mbpp_full_name;
|
||||
out(message, message, content);
|
||||
}
|
||||
}
|
||||
|
||||
// If we allocated the string, then free it
|
||||
@ -254,10 +307,6 @@ void ompi_info::show_mca_params(const string& type, const string& component,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Release the memory */
|
||||
|
||||
mca_base_param_dump_release(info);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
# University of Stuttgart. All rights reserved.
|
||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -23,6 +24,21 @@ WARNING: A user-supplied value attempted to override the read-only MCA
|
||||
parameter named "%s".
|
||||
|
||||
The user-supplied value was ignored.
|
||||
#
|
||||
[missing-param-file]
|
||||
Process %d Unable to locate the parameter file "%s" in the following search path:
|
||||
%s
|
||||
#
|
||||
[deprecated mca param env]
|
||||
A deprecated MCA parameter value was specified in the environment or
|
||||
on the command line. Deprecated MCA parameters should be avoided;
|
||||
they may disappear in future releases.
|
||||
|
||||
Deprecated parameter: %s
|
||||
#
|
||||
[deprecated mca param file]
|
||||
A deprecated MCA parameter value was specified in an MCA parameter
|
||||
file. Deprecated MCA parameters should be avoided; they may disappear
|
||||
in future releases.
|
||||
|
||||
Deprecated parameter: %s
|
||||
|
@ -49,6 +49,33 @@
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/opal_environ.h"
|
||||
|
||||
/*
|
||||
* Local types
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
/* Base class */
|
||||
opal_list_item_t super;
|
||||
|
||||
/* String of the type name or NULL */
|
||||
char *si_type_name;
|
||||
/* String of the component name */
|
||||
char *si_component_name;
|
||||
/* String of the param name */
|
||||
char *si_param_name;
|
||||
/* Full name of the synonym */
|
||||
char *si_full_name;
|
||||
/* Name of the synonym's corresponding environment variable */
|
||||
char *si_env_var_name;
|
||||
|
||||
/* Whether this synonym is a deprecated name or not */
|
||||
bool si_deprecated;
|
||||
/* Whether we've shown a warning that this synonym has been
|
||||
displayed or not */
|
||||
bool si_deprecated_warning_shown;
|
||||
} syn_info_t;
|
||||
|
||||
|
||||
/*
|
||||
* Public variables
|
||||
*
|
||||
@ -57,7 +84,6 @@
|
||||
*/
|
||||
opal_list_t mca_base_param_file_values;
|
||||
|
||||
|
||||
/*
|
||||
* local variables
|
||||
*/
|
||||
@ -87,6 +113,9 @@ static int param_register(const char *type_name,
|
||||
mca_base_param_storage_t *file_value,
|
||||
mca_base_param_storage_t *override_value,
|
||||
mca_base_param_storage_t *current_value);
|
||||
static int syn_register(int index_orig, const char *syn_type_name,
|
||||
const char *syn_component_name,
|
||||
const char *syn_param_name, bool deprecated);
|
||||
static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
|
||||
opal_hash_table_t *attrs,
|
||||
mca_base_param_source_t *source);
|
||||
@ -112,7 +141,8 @@ static void fv_constructor(mca_base_param_file_value_t *p);
|
||||
static void fv_destructor(mca_base_param_file_value_t *p);
|
||||
static void info_constructor(mca_base_param_info_t *p);
|
||||
static void info_destructor(mca_base_param_info_t *p);
|
||||
|
||||
static void syn_info_constructor(syn_info_t *si);
|
||||
static void syn_info_destructor(syn_info_t *si);
|
||||
|
||||
/*
|
||||
* Make the class instance for mca_base_param_t
|
||||
@ -123,6 +153,8 @@ OBJ_CLASS_INSTANCE(mca_base_param_file_value_t, opal_list_item_t,
|
||||
fv_constructor, fv_destructor);
|
||||
OBJ_CLASS_INSTANCE(mca_base_param_info_t, opal_list_item_t,
|
||||
info_constructor, info_destructor);
|
||||
OBJ_CLASS_INSTANCE(syn_info_t, opal_list_item_t,
|
||||
syn_info_constructor, syn_info_destructor);
|
||||
|
||||
/*
|
||||
* Set it up
|
||||
@ -424,6 +456,31 @@ int mca_base_param_register_string(const char *type_name,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Register a synonym name for an existing MCA parameter
|
||||
*/
|
||||
int mca_base_param_reg_syn(int index_orig,
|
||||
const mca_base_component_t *syn_component,
|
||||
const char *syn_param_name, bool deprecated)
|
||||
{
|
||||
return syn_register(index_orig,
|
||||
syn_component->mca_type_name,
|
||||
syn_component->mca_component_name,
|
||||
syn_param_name, deprecated);
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a synonym name for an existing MCA parameter
|
||||
*/
|
||||
int mca_base_param_reg_syn_name(int index_orig,
|
||||
const char *syn_type_name,
|
||||
const char *syn_param_name, bool deprecated)
|
||||
{
|
||||
return syn_register(index_orig, syn_type_name, NULL,
|
||||
syn_param_name, deprecated);
|
||||
}
|
||||
|
||||
/*
|
||||
* Associate a keyval with a parameter index
|
||||
*/
|
||||
@ -570,7 +627,7 @@ int mca_base_param_unset(int index)
|
||||
}
|
||||
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
if (((size_t) index) > len) {
|
||||
if (index < 0 || ((size_t) index) > len) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
@ -728,9 +785,11 @@ int mca_base_param_set_internal(int index, bool internal)
|
||||
*/
|
||||
int mca_base_param_dump(opal_list_t **info, bool internal)
|
||||
{
|
||||
size_t i, len;
|
||||
mca_base_param_info_t *p;
|
||||
size_t i, j, len;
|
||||
mca_base_param_info_t *p, *q;
|
||||
mca_base_param_t *array;
|
||||
opal_list_item_t *item;
|
||||
syn_info_t *si;
|
||||
|
||||
/* Check for bozo cases */
|
||||
|
||||
@ -750,16 +809,65 @@ int mca_base_param_dump(opal_list_t **info, bool internal)
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (array[i].mbp_internal == internal || internal) {
|
||||
p = OBJ_NEW(mca_base_param_info_t);
|
||||
if (NULL == p) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
p->mbpp_index = (int)i;
|
||||
p->mbpp_type_name = array[i].mbp_type_name;
|
||||
p->mbpp_component_name = array[i].mbp_component_name;
|
||||
p->mbpp_param_name = array[i].mbp_param_name;
|
||||
p->mbpp_full_name = array[i].mbp_full_name;
|
||||
p->mbpp_deprecated = array[i].mbp_deprecated;
|
||||
p->mbpp_read_only = array[i].mbp_read_only;
|
||||
p->mbpp_type = array[i].mbp_type;
|
||||
p->mbpp_help_msg = array[i].mbp_help_msg;
|
||||
|
||||
/* Save this entry to the list */
|
||||
opal_list_append(*info, (opal_list_item_t*) p);
|
||||
|
||||
/* If this param has synonyms, add them too */
|
||||
if (NULL != array[i].mbp_synonyms &&
|
||||
!opal_list_is_empty(array[i].mbp_synonyms)) {
|
||||
p->mbpp_synonyms_len =
|
||||
(int) opal_list_get_size(array[i].mbp_synonyms);
|
||||
printf("*** dumping %d synonyms, too\n",
|
||||
p->mbpp_synonyms_len);
|
||||
p->mbpp_synonyms = malloc(sizeof(mca_base_param_info_t*) *
|
||||
p->mbpp_synonyms_len);
|
||||
if (NULL == p->mbpp_synonyms) {
|
||||
p->mbpp_synonyms_len = 0;
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
for (j = 0, item = opal_list_get_first(array[i].mbp_synonyms);
|
||||
opal_list_get_end(array[i].mbp_synonyms) != item;
|
||||
++j, item = opal_list_get_next(item)) {
|
||||
si = (syn_info_t*) item;
|
||||
q = OBJ_NEW(mca_base_param_info_t);
|
||||
if (NULL == q) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
q->mbpp_index = (int)i;
|
||||
q->mbpp_type_name = si->si_type_name;
|
||||
q->mbpp_component_name = si->si_component_name;
|
||||
q->mbpp_param_name = si->si_param_name;
|
||||
q->mbpp_full_name = si->si_full_name;
|
||||
q->mbpp_deprecated = si->si_deprecated ||
|
||||
array[i].mbp_deprecated;
|
||||
q->mbpp_read_only = array[i].mbp_read_only;
|
||||
q->mbpp_type = array[i].mbp_type;
|
||||
q->mbpp_help_msg = array[i].mbp_help_msg;
|
||||
|
||||
/* Let this one point to the original */
|
||||
q->mbpp_synonym_parent = p;
|
||||
|
||||
/* Let the original point to this one */
|
||||
p->mbpp_synonyms[j] = q;
|
||||
|
||||
/* Save this entry to the list */
|
||||
opal_list_append(*info, (opal_list_item_t*) q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1230,7 +1338,7 @@ static int param_register(const char *type_name,
|
||||
}
|
||||
}
|
||||
|
||||
param.mbp_env_var_name = NULL;
|
||||
/* Build up the full name */
|
||||
len = 16;
|
||||
if (NULL != type_name) {
|
||||
len += strlen(type_name);
|
||||
@ -1470,8 +1578,10 @@ static int param_register(const char *type_name,
|
||||
}
|
||||
}
|
||||
|
||||
/* Add it to the array */
|
||||
|
||||
/* Add it to the array. Note that we copy the mca_param_t by value,
|
||||
so the entire contents of the struct is copied. The synonym list
|
||||
will always be empty at this point, so there's no need for an
|
||||
extra RETAIN or RELEASE. */
|
||||
if (OPAL_SUCCESS !=
|
||||
(ret = opal_value_array_append_item(&mca_base_params, ¶m))) {
|
||||
return ret;
|
||||
@ -1492,6 +1602,124 @@ static int param_register(const char *type_name,
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Back-end for registering a synonym
|
||||
*/
|
||||
static int syn_register(int index_orig, const char *syn_type_name,
|
||||
const char *syn_component_name,
|
||||
const char *syn_param_name, bool deprecated)
|
||||
{
|
||||
size_t len;
|
||||
syn_info_t *si;
|
||||
mca_base_param_t *array;
|
||||
|
||||
if (!initialized) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
/* Sanity check index param */
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
if (index_orig < 0 || ((size_t) index_orig) > len) {
|
||||
return OPAL_ERR_BAD_PARAM;
|
||||
}
|
||||
|
||||
/* Make the synonym info object */
|
||||
si = OBJ_NEW(syn_info_t);
|
||||
if (NULL == si) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* Note that the following logic likely could have been combined
|
||||
into more compact code. However, keeping it separate made it
|
||||
much easier to read / maintain (IMHO). This is not a high
|
||||
performance section of the code, so a premium was placed on
|
||||
future readability / maintenance. */
|
||||
|
||||
/* Save the function parameters */
|
||||
si->si_deprecated = deprecated;
|
||||
if (NULL != syn_type_name) {
|
||||
si->si_type_name = strdup(syn_type_name);
|
||||
if (NULL == si->si_type_name) {
|
||||
OBJ_RELEASE(si);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != syn_component_name) {
|
||||
si->si_component_name = strdup(syn_component_name);
|
||||
if (NULL == si->si_component_name) {
|
||||
OBJ_RELEASE(si);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != syn_param_name) {
|
||||
si->si_param_name = strdup(syn_param_name);
|
||||
if (NULL == si->si_param_name) {
|
||||
OBJ_RELEASE(si);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build up the full name */
|
||||
len = 16;
|
||||
if (NULL != syn_type_name) {
|
||||
len += strlen(syn_type_name);
|
||||
}
|
||||
if (NULL != syn_component_name) {
|
||||
len += strlen(syn_component_name);
|
||||
}
|
||||
if (NULL != syn_param_name) {
|
||||
len += strlen(syn_param_name);
|
||||
}
|
||||
si->si_full_name = (char*) malloc(len);
|
||||
if (NULL == si->si_full_name) {
|
||||
OBJ_RELEASE(si);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
/* Copy the name over in parts */
|
||||
si->si_full_name[0] = '\0';
|
||||
if (NULL != syn_type_name) {
|
||||
strncat(si->si_full_name, syn_type_name, len);
|
||||
}
|
||||
if (NULL != syn_component_name) {
|
||||
if ('\0' != si->si_full_name[0]) {
|
||||
strcat(si->si_full_name, "_");
|
||||
}
|
||||
strcat(si->si_full_name, syn_component_name);
|
||||
}
|
||||
if (NULL != syn_param_name) {
|
||||
if ('\0' != si->si_full_name[0]) {
|
||||
strcat(si->si_full_name, "_");
|
||||
}
|
||||
strcat(si->si_full_name, syn_param_name);
|
||||
}
|
||||
|
||||
/* Create the environment name */
|
||||
len = strlen(si->si_full_name) + strlen(mca_prefix) + 16;
|
||||
si->si_env_var_name = (char*) malloc(len);
|
||||
if (NULL == si->si_env_var_name) {
|
||||
OBJ_RELEASE(si);
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
snprintf(si->si_env_var_name, len, "%s%s", mca_prefix,
|
||||
si->si_full_name);
|
||||
|
||||
/* Find the param entry; add this syn_info to its list of
|
||||
synonyms */
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
if (NULL == array[index_orig].mbp_synonyms) {
|
||||
array[index_orig].mbp_synonyms = OBJ_NEW(opal_list_t);
|
||||
}
|
||||
opal_list_append(array[index_orig].mbp_synonyms, &(si->super));
|
||||
|
||||
/* All done */
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set an override
|
||||
*/
|
||||
@ -1571,6 +1799,8 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
|
||||
opal_show_help("help-mca-param.txt", "read-only-param-set",
|
||||
true, array[index].mbp_full_name);
|
||||
}
|
||||
|
||||
/* First look at the "real" name of this param */
|
||||
if (lookup_default(&array[index], storage)) {
|
||||
source = MCA_BASE_PARAM_SOURCE_DEFAULT;
|
||||
}
|
||||
@ -1709,21 +1939,61 @@ static bool lookup_keyvals(mca_base_param_t *param,
|
||||
static bool lookup_env(mca_base_param_t *param,
|
||||
mca_base_param_storage_t *storage)
|
||||
{
|
||||
char *env;
|
||||
char *env = NULL;
|
||||
opal_list_item_t *item;
|
||||
syn_info_t *si;
|
||||
char *deprecated_name;
|
||||
bool print_deprecated_warning = false;
|
||||
|
||||
if (NULL != param->mbp_env_var_name &&
|
||||
NULL != (env = getenv(param->mbp_env_var_name))) {
|
||||
/* Look for the primary param name */
|
||||
if (NULL != param->mbp_env_var_name) {
|
||||
env = getenv(param->mbp_env_var_name);
|
||||
print_deprecated_warning =
|
||||
param->mbp_deprecated & !param->mbp_deprecated_warning_shown;
|
||||
deprecated_name = param->mbp_full_name;
|
||||
/* Regardless of whether we want to show the deprecated
|
||||
warning or not, we can skip this check the next time
|
||||
through on this parameter */
|
||||
param->mbp_deprecated_warning_shown = true;
|
||||
}
|
||||
|
||||
/* If we didn't find the primary name, look in all the synonyms */
|
||||
if (NULL == env && NULL != param->mbp_synonyms &&
|
||||
!opal_list_is_empty(param->mbp_synonyms)) {
|
||||
for (item = opal_list_get_first(param->mbp_synonyms);
|
||||
NULL == env && opal_list_get_end(param->mbp_synonyms) != item;
|
||||
item = opal_list_get_next(item)) {
|
||||
si = (syn_info_t*) item;
|
||||
env = getenv(si->si_env_var_name);
|
||||
if (NULL != env &&
|
||||
((si->si_deprecated &&
|
||||
!si->si_deprecated_warning_shown) ||
|
||||
(param->mbp_deprecated &&
|
||||
!param->mbp_deprecated_warning_shown))) {
|
||||
print_deprecated_warning =
|
||||
si->si_deprecated_warning_shown =
|
||||
param->mbp_deprecated_warning_shown = true;
|
||||
deprecated_name = si->si_full_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we found it, react */
|
||||
if (NULL != env) {
|
||||
if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {
|
||||
storage->intval = (int)strtol(env,(char**)NULL,0);
|
||||
} else if (MCA_BASE_PARAM_TYPE_STRING == param->mbp_type) {
|
||||
storage->stringval = strdup(env);
|
||||
}
|
||||
|
||||
if (print_deprecated_warning) {
|
||||
opal_show_help("help-mca-param.txt", "deprecated mca param env",
|
||||
true, deprecated_name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Didn't find it */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1734,8 +2004,12 @@ static bool lookup_env(mca_base_param_t *param,
|
||||
static bool lookup_file(mca_base_param_t *param,
|
||||
mca_base_param_storage_t *storage)
|
||||
{
|
||||
bool found = false;
|
||||
syn_info_t *si;
|
||||
char *deprecated_name;
|
||||
opal_list_item_t *item;
|
||||
mca_base_param_file_value_t *fv;
|
||||
bool print_deprecated_warning = false;
|
||||
|
||||
/* See if we previously found a match from a file. If so, just
|
||||
return that */
|
||||
@ -1752,10 +2026,46 @@ static bool lookup_file(mca_base_param_t *param,
|
||||
opal_list_get_end(&mca_base_param_file_values) != item;
|
||||
item = opal_list_get_next(item)) {
|
||||
fv = (mca_base_param_file_value_t *) item;
|
||||
/* If it doesn't match the parameter's real name, check its
|
||||
synonyms */
|
||||
if (0 == strcmp(fv->mbpfv_param, param->mbp_full_name)) {
|
||||
found = true;
|
||||
print_deprecated_warning =
|
||||
param->mbp_deprecated & !param->mbp_deprecated_warning_shown;
|
||||
deprecated_name = param->mbp_full_name;
|
||||
/* Regardless of whether we want to show the deprecated
|
||||
warning or not, we can skip this check the next time
|
||||
through on this parameter */
|
||||
param->mbp_deprecated_warning_shown = true;
|
||||
} else if (NULL != param->mbp_synonyms &&
|
||||
!opal_list_is_empty(param->mbp_synonyms)) {
|
||||
/* Check all the synonyms on this parameter and see if the
|
||||
file value matches */
|
||||
for (item = opal_list_get_first(param->mbp_synonyms);
|
||||
opal_list_get_end(param->mbp_synonyms) != item;
|
||||
item = opal_list_get_next(item)) {
|
||||
si = (syn_info_t*) item;
|
||||
if (0 == strcmp(fv->mbpfv_param, si->si_full_name)) {
|
||||
found = true;
|
||||
if ((si->si_deprecated &&
|
||||
!si->si_deprecated_warning_shown) ||
|
||||
(param->mbp_deprecated &&
|
||||
!param->mbp_deprecated_warning_shown)) {
|
||||
print_deprecated_warning =
|
||||
si->si_deprecated_warning_shown =
|
||||
param->mbp_deprecated_warning_shown = true;
|
||||
deprecated_name = si->si_full_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we find it? */
|
||||
if (found) {
|
||||
if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {
|
||||
if (NULL != fv->mbpfv_value) {
|
||||
param->mbp_file_value.intval = (int)strtol(fv->mbpfv_value,(char**)NULL,0);
|
||||
param->mbp_file_value.intval =
|
||||
(int)strtol(fv->mbpfv_value,(char**)NULL,0);
|
||||
} else {
|
||||
param->mbp_file_value.intval = 0;
|
||||
}
|
||||
@ -1773,6 +2083,13 @@ static bool lookup_file(mca_base_param_t *param,
|
||||
(opal_list_item_t *) fv);
|
||||
OBJ_RELEASE(fv);
|
||||
|
||||
/* Print the deprecated warning, if applicable */
|
||||
if (print_deprecated_warning) {
|
||||
opal_show_help("help-mca-param.txt",
|
||||
"deprecated mca param file",
|
||||
true, deprecated_name);
|
||||
}
|
||||
|
||||
return set(param->mbp_type, storage, ¶m->mbp_file_value);
|
||||
}
|
||||
}
|
||||
@ -1824,6 +2141,8 @@ static void param_constructor(mca_base_param_t *p)
|
||||
p->mbp_type = MCA_BASE_PARAM_TYPE_MAX;
|
||||
p->mbp_internal = false;
|
||||
p->mbp_read_only = false;
|
||||
p->mbp_deprecated = false;
|
||||
p->mbp_deprecated_warning_shown = false;
|
||||
|
||||
p->mbp_type_name = NULL;
|
||||
p->mbp_component_name = NULL;
|
||||
@ -1839,6 +2158,8 @@ static void param_constructor(mca_base_param_t *p)
|
||||
p->mbp_file_value.stringval = NULL;
|
||||
p->mbp_override_value_set = false;
|
||||
p->mbp_override_value.stringval = NULL;
|
||||
|
||||
p->mbp_synonyms = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1847,6 +2168,8 @@ static void param_constructor(mca_base_param_t *p)
|
||||
*/
|
||||
static void param_destructor(mca_base_param_t *p)
|
||||
{
|
||||
opal_list_item_t *item;
|
||||
|
||||
if (NULL != p->mbp_type_name) {
|
||||
free(p->mbp_type_name);
|
||||
}
|
||||
@ -1878,7 +2201,20 @@ static void param_destructor(mca_base_param_t *p)
|
||||
free(p->mbp_override_value.stringval);
|
||||
}
|
||||
}
|
||||
|
||||
/* Destroy any synonyms that are on the list */
|
||||
if (NULL != p->mbp_synonyms) {
|
||||
for (item = opal_list_remove_first(p->mbp_synonyms);
|
||||
NULL != item; item = opal_list_remove_first(p->mbp_synonyms)) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_RELEASE(p->mbp_synonyms);
|
||||
}
|
||||
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
/* Cheap trick to reset everything to NULL */
|
||||
param_constructor(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1910,14 +2246,51 @@ static void info_constructor(mca_base_param_info_t *p)
|
||||
p->mbpp_param_name = NULL;
|
||||
p->mbpp_full_name = NULL;
|
||||
|
||||
p->mbpp_deprecated = false;
|
||||
|
||||
p->mbpp_synonyms = NULL;
|
||||
p->mbpp_synonyms_len = 0;
|
||||
p->mbpp_synonym_parent = NULL;
|
||||
|
||||
p->mbpp_read_only = false;
|
||||
p->mbpp_help_msg = NULL;
|
||||
}
|
||||
|
||||
static void info_destructor(mca_base_param_info_t *p)
|
||||
{
|
||||
if (NULL != p->mbpp_synonyms) {
|
||||
free(p->mbpp_synonyms);
|
||||
}
|
||||
/* No need to free any of the strings -- the pointers were copied
|
||||
by value from their corresponding parameter registration */
|
||||
|
||||
info_constructor(p);
|
||||
}
|
||||
|
||||
static void syn_info_constructor(syn_info_t *si)
|
||||
{
|
||||
si->si_type_name = si->si_component_name = si->si_param_name =
|
||||
si->si_full_name = si->si_env_var_name = NULL;
|
||||
si->si_deprecated = si->si_deprecated_warning_shown = false;
|
||||
}
|
||||
|
||||
static void syn_info_destructor(syn_info_t *si)
|
||||
{
|
||||
if (NULL != si->si_type_name) {
|
||||
free(si->si_type_name);
|
||||
}
|
||||
if (NULL != si->si_component_name) {
|
||||
free(si->si_component_name);
|
||||
}
|
||||
if (NULL != si->si_param_name) {
|
||||
free(si->si_param_name);
|
||||
}
|
||||
if (NULL != si->si_full_name) {
|
||||
free(si->si_full_name);
|
||||
}
|
||||
if (NULL != si->si_env_var_name) {
|
||||
free(si->si_env_var_name);
|
||||
}
|
||||
|
||||
syn_info_constructor(si);
|
||||
}
|
||||
|
@ -123,6 +123,17 @@ struct mca_base_param_info_t {
|
||||
/** Full, assembled parameter name */
|
||||
char *mbpp_full_name;
|
||||
|
||||
/** Is this value deprecated? */
|
||||
bool mbpp_deprecated;
|
||||
|
||||
/** Array of pointers of synonyms of this parameter */
|
||||
struct mca_base_param_info_t **mbpp_synonyms;
|
||||
/** Length of mbpp_synonyms array */
|
||||
int mbpp_synonyms_len;
|
||||
/** Back pointer to another mca_base_param_info_t that *this*
|
||||
param is a synonym of (or NULL) */
|
||||
struct mca_base_param_info_t *mbpp_synonym_parent;
|
||||
|
||||
/** Is this value changable? */
|
||||
bool mbpp_read_only;
|
||||
/** Help message associated with this parameter */
|
||||
@ -170,8 +181,8 @@ extern "C" {
|
||||
/**
|
||||
* Register an integer MCA parameter.
|
||||
*
|
||||
* @param component [in] Pointer to the componet for which the
|
||||
* parameter is being registered (string), or NULL.
|
||||
* @param component [in] Pointer to the component for which the
|
||||
* parameter is being registered.
|
||||
* @param param_name [in] The name of the parameter being
|
||||
* registered (string).
|
||||
* @param help_msg [in] A string describing the use and valid
|
||||
@ -269,7 +280,7 @@ extern "C" {
|
||||
*
|
||||
* Note that the type should always be a framework or a level name
|
||||
* (e.g., "btl" or "mpi") -- it should not include the component
|
||||
* name, even if the componet is the base of a framework. Hence,
|
||||
* name, even if the component is the base of a framework. Hence,
|
||||
* "btl_base" is not a valid type name. Specifically, registering
|
||||
* a parameter with an unrecognized type is not an error, but
|
||||
* ompi_info has a hard-coded list of frameworks and levels;
|
||||
@ -292,8 +303,8 @@ extern "C" {
|
||||
/**
|
||||
* Register a string MCA parameter.
|
||||
*
|
||||
* @param component [in] Pointer to the componet for which the
|
||||
* parameter is being registered (string), or NULL.
|
||||
* @param component [in] Pointer to the component for which the
|
||||
* parameter is being registered.
|
||||
* @param param_name [in] The name of the parameter being
|
||||
* registered (string).
|
||||
* @param help_msg [in] A string describing the use and valid
|
||||
@ -377,7 +388,7 @@ extern "C" {
|
||||
*
|
||||
* Note that the type should always be a framework or a level name
|
||||
* (e.g., "btl" or "mpi") -- it should not include the component
|
||||
* name, even if the componet is the base of a framework. Hence,
|
||||
* name, even if the component is the base of a framework. Hence,
|
||||
* "btl_base" is not a valid type name. Specifically, registering
|
||||
* a parameter with an unrecognized type is not an error, but
|
||||
* ompi_info has a hard-coded list of frameworks and levels;
|
||||
@ -397,6 +408,71 @@ extern "C" {
|
||||
const char *default_value,
|
||||
char **current_value);
|
||||
|
||||
/**
|
||||
* Register a synonym name for an MCA parameter.
|
||||
*
|
||||
* @param original_index [in] The index of the original parameter to
|
||||
* create a synonym for.
|
||||
* @param syn_component [in] Pointer to the component for which the
|
||||
* synonym is being registered.
|
||||
* @param syn_param_name [in] Parameter name of the synonym to be
|
||||
* created (string)
|
||||
* @param deprecated If true, a warning will be shown if this
|
||||
* synonym is used to set the parameter's value (unless the
|
||||
* warnings are silenced)
|
||||
*
|
||||
* @returns OPAL_SUCCESS Upon success.
|
||||
* @returns OPAL_ERR_BAD_PARAM If the index value is invalid.
|
||||
* @returns OPAL_ERROR Otherwise
|
||||
*
|
||||
* Upon success, this function creates a synonym MCA parameter
|
||||
* that will be treated almost exactly like the original. The
|
||||
* type (int or string) is irrelevant; this function simply
|
||||
* creates a new name that by which the same parameter value is
|
||||
* accessible.
|
||||
*
|
||||
* Note that the original parameter name has precendence over all
|
||||
* synonyms. For example, consider the case if parameter is
|
||||
* originally registered under the name "A" and is later
|
||||
* registered with synonyms "B" and "C". If the user sets values
|
||||
* for both MCA parameter names "A" and "B", the value associated
|
||||
* with the "A" name will be used and the value associated with
|
||||
* the "B" will be ignored (and will not even be visible by the
|
||||
* mca_base_param_*() API). If the user sets values for both MCA
|
||||
* parameter names "B" and "C" (and does *not* set a value for
|
||||
* "A"), it is undefined as to which value will be used.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_param_reg_syn(int orignal_index,
|
||||
const mca_base_component_t *syn_component,
|
||||
const char *syn_param_name,
|
||||
bool deprecated);
|
||||
|
||||
/**
|
||||
* Register an MCA parameter synonym that is not associated with a
|
||||
* component.
|
||||
*
|
||||
* @param original_index [in] The index of the original parameter to
|
||||
* create a synonym for.
|
||||
* @param type [in] Although this synonym is not associated with
|
||||
* a component, it still must have a string type name that will
|
||||
* act as a prefix (string).
|
||||
* @param syn_param_name [in] Parameter name of the synonym to be
|
||||
* created (string)
|
||||
* @param deprecated If true, a warning will be shown if this
|
||||
* synonym is used to set the parameter's value (unless the
|
||||
* warnings are silenced)
|
||||
*
|
||||
* Essentially the same as mca_base_param_reg_syn(), but using a
|
||||
* type name instead of a component.
|
||||
*
|
||||
* See mca_base_param_reg_int_name() for guidence on type string
|
||||
* values.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_param_reg_syn_name(int orignal_index,
|
||||
const char *syn_type,
|
||||
const char *syn_param_name,
|
||||
bool deprecated);
|
||||
|
||||
/**
|
||||
* Associate a communicator/datatype/window keyval with an MCA
|
||||
* parameter.
|
||||
|
@ -9,6 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -78,6 +79,15 @@ struct mca_base_param_t {
|
||||
<type>_<component>_<param> */
|
||||
char *mbp_full_name;
|
||||
|
||||
/** List of synonym names for this parameter. This *must* be a
|
||||
pointer (vs. a plain opal_list_t) because we copy this whole
|
||||
struct into a new param for permanent storage
|
||||
(opal_vale_array_append_item()), and the internal pointers in
|
||||
the opal_list_t will be invalid when that happens. Hence, we
|
||||
simply keep a pointer to an external opal_list_t. Synonyms
|
||||
are uncommon enough that this is not a big performance hit. */
|
||||
opal_list_t *mbp_synonyms;
|
||||
|
||||
/** Whether this is internal (not meant to be seen / modified by
|
||||
users) or not */
|
||||
bool mbp_internal;
|
||||
@ -85,6 +95,12 @@ struct mca_base_param_t {
|
||||
was registered (e.g., when true, useful for reporting values,
|
||||
like the value of the GM library that was linked against) */
|
||||
bool mbp_read_only;
|
||||
/** Whether this MCA parameter (*and* all of its synonyms) is
|
||||
deprecated or not */
|
||||
bool mbp_deprecated;
|
||||
/** Whether the warning message for the deprecated MCA param has
|
||||
been shown already or not */
|
||||
bool mbp_deprecated_warning_shown;
|
||||
/** Help message associated with this parameter */
|
||||
char *mbp_help_msg;
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user