1
1

Change and add new features to the MCA parameter system:

- new preferred API calls for registering MCA parameters are
  mca_base_param_reg_{int|string} and
  mca_base_param_reg_{int|string}_name.
- See opal/mca/base/mca_base_param.h for docs on new calls.  
- Can now register and lookup a value at the same time.
- Can now mark a parameter "read only" at registration time
- Can now mark a parameter "internal" at registration time
- Can now associate a help message with the parameter at registration
  time; displayed in the ompi_info output.

The old API calls are still available for backwards compatibility
(mca_base_param_register_{int|string}.  They will eventually be
removed -- all developers are encouraged to use the new APIs from here
on out and replace any old calls with the new API.

Some params were also renamed -- the previous convention of using
"base_" as a prefix for any param that was not associated with a
component is henceforth deprecated.  Instead, use one of the following
prefixes:

mca: for anything in the MCA base itself
opal: for anything in OPAL
orte: for anything in ORTE
mpi: for anything in OMPI

This commit was SVN r6698.
Этот коммит содержится в:
Jeff Squyres 2005-08-01 22:38:17 +00:00
родитель cfb0d9c0f7
Коммит 4c1dd716c7
15 изменённых файлов: 819 добавлений и 326 удалений

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

@ -66,14 +66,17 @@ int mca_io_base_open(void)
/* Create some parameters */
if (0 >
mca_base_param_register_int("io", "base", "freelist_initial_size",
NULL, 16) ||
mca_base_param_reg_int_name("io","base_freelist_initial_size",
"Initial MPI-2 IO request freelist size",
false, false, 16, NULL) ||
0 >
mca_base_param_register_int("io", "base", "freelist_max_size",
NULL, 64) ||
mca_base_param_reg_int_name("io", "base_freelist_max_size",
"Max size of the MPI-2 IO request freelist",
false, false, 64, NULL) ||
0 >
mca_base_param_register_int("io", "base", "freelist_increment",
NULL, 16)) {
mca_base_param_reg_int_name("io", "base_freelist_increment",
"Increment size of the MPI-2 IO request freelist",
false, false, 16, NULL)) {
return OMPI_ERROR;
}

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

@ -121,10 +121,15 @@ static int open_component(void)
/* Use a low priority, but allow other components to be lower */
priority_param =
mca_base_param_register_int("io", "romio", "priority", NULL, 10);
mca_base_param_reg_int(&mca_io_romio_component.io_version,
"priority",
"Priority of the io romio component",
false, false, 10, NULL);
delete_priority_param =
mca_base_param_register_int("io", "romio", "delete_priority",
NULL, 10);
mca_base_param_reg_int(&mca_io_romio_component.io_version,
"delete_priority",
"Delete priority of the io romio component",
false, false, 10, NULL);
/* Create the list of pending requests */

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

@ -26,3 +26,7 @@ developer):
%s
--> Returned value %d instead of OMPI_SUCCESS
[mpi-param-check-enabled-but-compiled-out]
WARNING: The MCA parameter mpi_param_check has been set to true, but
parameter checking has been compiled out of Open MPI. The
mpi_param_check value has therefore been ignored.

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

@ -17,10 +17,11 @@
#include "ompi_config.h"
#include "include/constants.h"
#include "opal/util/output.h"
#include "opal/util/show_help.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/runtime/mpiruntime.h"
#include "ompi/runtime/params.h"
#include "opal/util/output.h"
#include "mca/base/mca_base_param.h"
#include <time.h>
/*
@ -40,19 +41,13 @@ char *ompi_mpi_show_mca_params_file = NULL;
int ompi_mpi_register_params(void)
{
int param_check_param;
int show_leaks_param;
int no_free_param;
int show_mca_params;
int show_mca_params_file;
int value;
/* Whether we want MPI API function parameter checking or not */
param_check_param =
mca_base_param_register_int("mpi", NULL, "param_check", NULL,
MPI_PARAM_CHECK);
mca_base_param_lookup_int(param_check_param, &value);
mca_base_param_reg_int_name("mpi", "param_check",
"Whether you want MPI API parameters checked at run-time or not. Possible values are 0 (no checking) and 1 (perform checking at run-time)",
false, false, MPI_PARAM_CHECK, &value);
ompi_mpi_param_check = (bool) value;
if (ompi_mpi_param_check) {
value = 0;
@ -60,42 +55,49 @@ int ompi_mpi_register_params(void)
value = 1;
}
if (0 == value) {
opal_output(0, "WARNING: MCA parameter mpi_param_check set to true, but parameter checking");
opal_output(0, "WARNING: has been compiled out of Open MPI. mpi_param_check value ignored.");
opal_show_help("help-ompi-runtime.txt",
"mpi-param-check-enabled-but-compiled-out",
true);
ompi_mpi_param_check = false;
}
}
/*
* This string is going to be used in src/util/showstackframe.c
* This string is going to be used in opal/util/stacktrace.c
*/
mca_base_param_register_string("mpi", NULL, "signal", NULL, NULL);
mca_base_param_reg_string_name("mpi", "signal",
"If a signal is received, display the stack trace frame",
false, false, NULL, NULL);
/*
* opal_progress: decide whether to yield and the event library
* tick rate
*/
mca_base_param_register_int("mpi", NULL, "yield_when_idle", NULL, -1);
mca_base_param_register_int("mpi", NULL, "event_tick_rate", NULL, -1);
/* JMS: Need ORTE data here -- set this to 0 when
exactly/under-subscribed, or 1 when oversubscribed */
mca_base_param_reg_int_name("mpi", "yield_when_idle",
"Yield the processor when waiting for MPI communication (for MPI processes, will default to 1 when oversubscribing nodes)",
false, false, 0, NULL);
mca_base_param_reg_int_name("mpi", "event_tick_rate",
"How often to progress TCP communications (0 = never, all positive integers [N] indicate a fraction of progression time that is devoted to TCP progression [i.e., 1/N])",
false, false, -1, NULL);
/* Whether or not to show MPI handle leaks */
show_leaks_param =
mca_base_param_register_int("mpi", NULL, "show_handle_leaks", NULL,
(int) ompi_debug_show_handle_leaks);
mca_base_param_lookup_int(show_leaks_param, &value);
mca_base_param_reg_int_name("mpi", "show_handle_leaks",
"Whether MPI_FINALIZE shows all MPI handles that were not freed or not",
false, false,
(int) ompi_debug_show_handle_leaks, &value);
ompi_debug_show_handle_leaks = (bool) value;
/* Whether or not to free MPI handles. Useless without run-time
param checking, so implicitly set that to true if we don't want
to free the handles. */
no_free_param =
mca_base_param_register_int("mpi", NULL, "no_free_handles", NULL,
(int) ompi_debug_no_free_handles);
mca_base_param_lookup_int(no_free_param, &value);
mca_base_param_reg_int_name("mpi", "no_free_handles",
"Whether to actually free MPI objects when their handles are freed",
false, false,
(int) ompi_debug_no_free_handles, &value);
ompi_debug_no_free_handles = (bool) value;
if (ompi_debug_no_free_handles) {
ompi_mpi_param_check = true;
@ -111,21 +113,17 @@ int ompi_mpi_register_params(void)
}
/* Whether or not to print all MCA parameters in MPI_INIT */
show_mca_params =
mca_base_param_register_int("mpi", NULL,
"show_mca_params", NULL,
(int) ompi_mpi_show_mca_params);
mca_base_param_lookup_int(show_mca_params, &value);
mca_base_param_reg_int_name("mpi", "show_mca_params",
"Whether to show all MCA parameter value during MPI_INIT or not (good for reproducability of MPI jobs)",
false, false,
(int) ompi_mpi_show_mca_params, &value);
ompi_mpi_show_mca_params = (bool) value;
mca_base_param_set_internal(show_mca_params, false);
/* File to use when dumping the parameters */
ompi_mpi_show_mca_params_file = strdup("");
show_mca_params_file =
mca_base_param_register_string("mpi", NULL, "show_mca_params_file", NULL,
ompi_mpi_show_mca_params_file);
mca_base_param_lookup_string(show_mca_params_file, &ompi_mpi_show_mca_params_file);
mca_base_param_set_internal(show_mca_params_file, false);
mca_base_param_reg_string_name("mpi", "show_mca_params_file",
"If mpi_show_mca_params is true, setting this string to a valid filename tells Open MPI to dump all the MCA parameter values into a file suitable for reading via the mca_param_files parameter (good for reproducability of MPI jobs)",
false, false,
"", &ompi_mpi_show_mca_params_file);
/* All done */

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

@ -157,8 +157,9 @@ int main(int argc, char *argv[])
putenv(env[i]);
}
ompi_info::mca_types.push_back("base");
ompi_info::mca_types.push_back("mca");
ompi_info::mca_types.push_back("mpi");
ompi_info::mca_types.push_back("orte");
ompi_info::mca_types.push_back("allocator");
ompi_info::mca_types.push_back("coll");

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

@ -79,7 +79,7 @@ namespace ompi_info {
void do_params(bool want_all, bool want_internal);
void show_mca_params(const std::string& type, const std::string& component,
const std::string& param, bool want_internal);
bool want_internal);
void do_path(bool want_all, opal_cmd_line_t *cmd_line);
void show_path(const std::string& type, const std::string& value);

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

@ -19,6 +19,10 @@
#include <iostream>
#include <string>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "tools/ompi_info/ompi_info.h"
using namespace std;
@ -41,6 +45,15 @@ static int screen_width = 78;
void ompi_info::out(const string& pretty_message, const string &plain_message,
const string& value)
{
#ifdef HAVE_ISATTY
// If we have isatty(), if this is not a tty, then disable
// wrapping for grep-friendly behavior
if (0 == isatty(0)) {
screen_width = INT_MAX;
}
#endif
if (pretty) {
string::size_type pos, max_value_width;
string spaces;
@ -54,7 +67,11 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
max_value_width = screen_width - spaces.length() -
pretty_message.length() - 2;
filler = spaces + pretty_message + ": ";
if (!pretty_message.empty()) {
filler = spaces + pretty_message + ": ";
} else {
filler = spaces + " ";
}
while (true) {
if (v.length() < max_value_width) {
@ -95,7 +112,11 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
}
}
} else {
cout << plain_message << ":" << value << endl;
if (!plain_message.empty()) {
cout << plain_message << ":" << value << endl;
} else {
cout << value << endl;
}
}
}
@ -108,8 +129,16 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
{
if (ompi_info::pretty) {
string spaces(OMPI_max(centerpoint - pretty_message.length(), 0), ' ');
cout << spaces << pretty_message << ": " << value << endl;
if (!pretty_message.empty()) {
cout << spaces << pretty_message << ": " << value << endl;
} else {
cout << spaces << " " << value << endl;
}
} else {
cout << plain_message << ":" << value << endl;
if (!plain_message.empty()) {
cout << plain_message << ":" << value << endl;
} else {
cout << value << endl;
}
}
}

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

@ -89,7 +89,7 @@ void ompi_info::do_params(bool want_all, bool want_internal)
if (want_all) {
for (i = 0; i < mca_types.size(); ++i) {
show_mca_params(mca_types[i], component_all, param_all, want_internal);
show_mca_params(mca_types[i], component_all, want_internal);
}
} else {
for (i = 0; i < count; ++i) {
@ -110,107 +110,129 @@ void ompi_info::do_params(bool want_all, bool want_internal)
exit(1);
}
show_mca_params(type, component, param_all, want_internal);
show_mca_params(type, component, want_internal);
}
}
}
void ompi_info::show_mca_params(const string& type, const string& component,
const string& param, bool want_internal)
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;
string message, content, tmp;
int value_int;
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;
if (type == p->mbpp_type_name) {
if (NULL != p->mbpp_type_name && type == p->mbpp_type_name) {
if (component == component_all ||
NULL == p->mbpp_component_name ||
(NULL != p->mbpp_component_name &&
component == p->mbpp_component_name)) {
if (param == param_all || param == p->mbpp_param_name) {
// Make a string for the default value. Invoke a
// lookup because it may transform the string
// ("~/" -> "<home dir>/") or get the value from
// the environment, a file, etc.
// Make a string for the default value. Invoke a
// lookup because it may transform the string ("~/" ->
// "<home dir>/") or get the value from the
// environment, a file, etc.
if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
mca_base_param_lookup_string(p->mbpp_index,
&value_string);
if (MCA_BASE_PARAM_TYPE_STRING == p->mbpp_type) {
mca_base_param_lookup_string(p->mbpp_index,
&value_string);
// Can't let the string be NULL because we
// assign it to a std::string, below
if (NULL == value_string) {
value_string = empty;
}
} else {
mca_base_param_lookup_int(p->mbpp_index, &value_int);
asprintf(&value_string, "%d", value_int);
// Can't let the string be NULL because we
// assign it to a std::string, below
if (NULL == value_string) {
value_string = empty;
}
} else {
mca_base_param_lookup_int(p->mbpp_index, &value_int);
asprintf(&value_string, "%d", value_int);
}
content = value_string;
// Build up the strings to output.
if (pretty) {
message = "MCA ";
message += p->mbpp_type_name;
// Put in the real, full name (which may be
// different than the categorization).
content = p->mbpp_read_only ?
"information \"" : "parameter \"";
content += p->mbpp_full_name;
content += "\" (";
content += p->mbpp_read_only ?
"value: " : "current value: ";
if (strlen(value_string) == 0) {
content += "<none>)";
} else {
content += "\"";
content += value_string;
content += "\")";
}
out(message, message, content);
// If we have a help message, output it
if (NULL != p->mbpp_help_msg) {
out("", "", p->mbpp_help_msg);
}
} else {
tmp = "mca:";
tmp += p->mbpp_type_name;
tmp += ":";
if (p->mbpp_component_name != NULL) {
tmp += p->mbpp_component_name;
} else {
tmp += "base";
}
tmp += ":param:";
// Put in the real, full name (which may be
// different than the categorization).
tmp += p->mbpp_full_name;
tmp += ":";
// Output the value
message = tmp;
message += "value";
content = value_string;
// Build up the strings to output.
if (pretty) {
message = "MCA ";
message += p->mbpp_type_name;
// Put in the real, full name (which may be
// different than the categorization).
content = (p->mbpp_env_var_name != NULL) ?
"parameter \"" : "information \"";
content += p->mbpp_full_name;
content += (p->mbpp_env_var_name != NULL) ?
"\" (default: " : "\" (value: ";
if (strlen(value_string) == 0)
content += "<none>)";
else {
content += "\"";
content += value_string;
content += "\")";
}
out(message, message, content);
} else {
message = "mca:";
message += p->mbpp_type_name;
message += ":";
if (p->mbpp_component_name != NULL) {
message += p->mbpp_component_name;
} else {
message += "base";
}
message += (p->mbpp_env_var_name != NULL) ?
":param:" : ":info:";
// Put in the real, full name (which may be
// different than the categorization).
message += p->mbpp_full_name;
content = value_string;
out(message, message, content);
// Output whether it's read only or writable
message = tmp;
message += "status";
content = p->mbpp_read_only ? "read-only" : "writable";
out(message, message, content);
// If it has a help message, output that
if (NULL != p->mbpp_help_msg) {
message = tmp;
message += "help";
content = p->mbpp_help_msg;
out(message, message, content);
}
// If we allocated the string, then free it
if (value_string != empty) {
free(value_string);
}
}
// If we allocated the string, then free it
if (value_string != empty) {
free(value_string);
}
}
}

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

@ -29,7 +29,7 @@ EXTRA_DIST = $(pkgdata_DATA)
noinst_LTLIBRARIES = libmca_base.la
pkgdata_DATA = help-mca-base.txt
pkgdata_DATA = help-mca-base.txt help-mca-param.txt
# Source code files

23
opal/mca/base/help-mca-param.txt Обычный файл
Просмотреть файл

@ -0,0 +1,23 @@
# -*- text -*-
#
# Copyright (c) 2004-2005 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# This is the US/English help file for Open MPI MCA error messages.
#
[read-only-param-set]
WARNING: A user-supplied value attempted to override the read-only MCA
parameter named "%s".
The user-supplied value was ignored.

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

@ -134,7 +134,7 @@ int mca_base_component_find(const char *directory, const char *type,
/* Find any available dynamic components in the specified directory */
if (open_dso_components) {
int param, param_disable_dlopen;
param = mca_base_param_find("base", NULL, "component_disable_dlopen");
param = mca_base_param_find("mca", NULL, "component_disable_dlopen");
mca_base_param_lookup_int(param, &param_disable_dlopen);
if (0 == param_disable_dlopen) {
@ -342,7 +342,7 @@ static int open_component(component_file_item_t *target_file,
opal_output_verbose(40, 0, "mca: base: component_find: examining dyanmic %s MCA component \"%s\"",
target_file->type, target_file->name, NULL);
opal_output_verbose(40, 0, "mca: base: component_find: %s", target_file->filename, NULL);
param = mca_base_param_find("base", NULL, "component_show_load_errors");
param = mca_base_param_find("mca", NULL, "component_show_load_errors");
mca_base_param_lookup_int(param, &show_errors);
/* Was this component already loaded (e.g., via dependency)? */

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

@ -68,17 +68,21 @@ int mca_base_open(void)
asprintf(&value, "%s:~/.openmpi/components", OMPI_PKGLIBDIR);
#endif
mca_base_param_component_path =
mca_base_param_register_string("base", NULL, "component_path",
"component_path", value);
mca_base_param_reg_string_name("mca", "component_path",
"Path where to look for Open MPI and ORTE components",
false, false, value, NULL);
free(value);
param_index = mca_base_param_register_string("base", NULL, "verbose",
"verbose", NULL);
param_index = mca_base_param_reg_string_name("mca", "verbose",
"Top-level verbosity parameter",
false, false, NULL, NULL);
mca_base_param_register_int("base", NULL, "component_show_load_errors",
"component_show_load_errors", 0);
mca_base_param_reg_int_name("mca", "component_show_load_errors",
"Whether to show errors for components that failed to load or not",
false, false, 1, NULL);
mca_base_param_register_int("base", NULL, "component_disable_dlopen",
"component_disable_dlopen", 0);
mca_base_param_reg_int_name("mca", "component_disable_dlopen",
"Whether to attempt to disable opening dynamic components or not",
false, false, 0, NULL);
/* What verbosity level do we want? */

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

@ -23,6 +23,7 @@
#include "mpi.h"
#include "include/constants.h"
#include "opal/class/opal_value_array.h"
#include "opal/util/show_help.h"
#include "class/opal_hash_table.h"
#if 0
/* JMS commented out for now -- see lookup_keyvals() below for an
@ -58,13 +59,17 @@ static bool initialized = false;
* local functions
*/
static int read_files(char *file_list);
static int param_register(const char *type_name, const char *component_name,
static int param_register(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
const char *help_msg,
mca_base_param_type_t type,
bool internal,
bool read_only,
mca_base_param_storage_t *default_value,
mca_base_param_storage_t *file_value,
mca_base_param_storage_t *override_value);
mca_base_param_storage_t *override_value,
mca_base_param_storage_t *current_value);
static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
opal_hash_table_t *attrs);
static bool param_set_override(size_t index,
@ -136,8 +141,9 @@ int mca_base_param_init(void)
asprintf(&files,
"~/.openmpi/mca-params.conf:%s/openmpi-mca-params.conf",
OMPI_SYSCONFDIR);
id = mca_base_param_register_string("base", NULL, "param_files",
"param_files", files);
id = mca_base_param_reg_string_name("mca", "param_files",
"Path for MCA configuration files containing default parameter values",
false, false, files, NULL);
free(files);
/* Read in MCA parameters from files */
@ -154,22 +160,145 @@ int mca_base_param_init(void)
/*
* Register an integer MCA parameter
*/
int mca_base_param_reg_int(const mca_base_component_t *component,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
int default_value,
int *current_value)
{
int ret;
mca_base_param_storage_t storage;
mca_base_param_storage_t lookup;
storage.intval = default_value;
ret = param_register(component->mca_type_name,
component->mca_component_name,
param_name, help_msg,
MCA_BASE_PARAM_TYPE_INT, internal, read_only,
&storage, NULL, NULL, &lookup);
if (ret >= 0 && NULL != current_value) {
*current_value = lookup.intval;
}
return ret;
}
/*
* Register an integer MCA parameter that is not associated with a
* component
*/
int mca_base_param_reg_int_name(const char *type,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
int default_value,
int *current_value)
{
int ret;
mca_base_param_storage_t storage;
mca_base_param_storage_t lookup;
storage.intval = default_value;
ret = param_register(type, NULL, param_name, help_msg,
MCA_BASE_PARAM_TYPE_INT, internal, read_only,
&storage, NULL, NULL, &lookup);
if (ret >= 0 && NULL != current_value) {
*current_value = lookup.intval;
}
return ret;
}
/*
* Register a string MCA parameter.
*/
int mca_base_param_reg_string(const mca_base_component_t *component,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
const char *default_value,
char **current_value)
{
int ret;
mca_base_param_storage_t storage;
mca_base_param_storage_t lookup;
if (NULL != default_value) {
storage.stringval = (char *) default_value;
} else {
storage.stringval = NULL;
}
ret = param_register(component->mca_type_name,
component->mca_component_name,
param_name, help_msg,
MCA_BASE_PARAM_TYPE_STRING, internal, read_only,
&storage, NULL, NULL, &lookup);
if (ret >= 0 && NULL != current_value) {
*current_value = lookup.stringval;
}
return ret;
}
/*
* Register a string MCA parameter that is not associated with a
* component
*/
int mca_base_param_reg_string_name(const char *type,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
const char *default_value,
char **current_value)
{
int ret;
mca_base_param_storage_t storage;
mca_base_param_storage_t lookup;
if (NULL != default_value) {
storage.stringval = (char *) default_value;
} else {
storage.stringval = NULL;
}
ret = param_register(type, NULL, param_name, help_msg,
MCA_BASE_PARAM_TYPE_STRING, internal, read_only,
&storage, NULL, NULL, &lookup);
if (ret >= 0 && NULL != current_value) {
*current_value = lookup.stringval;
}
return ret;
}
/*
* Register an integer MCA parameter
* (deprecated)
*/
int mca_base_param_register_int(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
int default_value)
{
mca_base_param_storage_t storage;
int ret;
mca_base_param_storage_t storage;
storage.intval = default_value;
return param_register(type_name, component_name, param_name, mca_param_name,
MCA_BASE_PARAM_TYPE_INT, &storage, NULL, NULL);
storage.intval = default_value;
ret = param_register(type_name, component_name, param_name, NULL,
MCA_BASE_PARAM_TYPE_INT, false, false,
&storage, NULL, NULL, NULL);
return ret;
}
/*
* Register a string MCA parameter.
* (deprecated)
*/
int mca_base_param_register_string(const char *type_name,
const char *component_name,
@ -177,15 +306,18 @@ int mca_base_param_register_string(const char *type_name,
const char *mca_param_name,
const char *default_value)
{
mca_base_param_storage_t storage;
int ret;
mca_base_param_storage_t storage;
if (NULL != default_value) {
storage.stringval = (char *) default_value;
} else {
storage.stringval = NULL;
}
return param_register(type_name, component_name, param_name, mca_param_name,
MCA_BASE_PARAM_TYPE_STRING, &storage, NULL, NULL);
if (NULL != default_value) {
storage.stringval = (char *) default_value;
} else {
storage.stringval = NULL;
}
ret = param_register(type_name, component_name, param_name, NULL,
MCA_BASE_PARAM_TYPE_STRING, false, false,
&storage, NULL, NULL, NULL);
return ret;
}
@ -411,9 +543,6 @@ int mca_base_param_find(const char *type_name, const char *component_name,
if (!initialized) {
return OMPI_ERROR;
}
if (NULL == type_name) {
return OMPI_ERROR;
}
/* Loop through looking for a parameter of a given
type/component/param */
@ -421,7 +550,9 @@ int mca_base_param_find(const char *type_name, const char *component_name,
size = opal_value_array_get_size(&mca_base_params);
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
for (i = 0; i < size; ++i) {
if (0 == strcmp(type_name, array[i].mbp_type_name) &&
if (((NULL == type_name && NULL == array[i].mbp_type_name) ||
(NULL != type_name && NULL != array[i].mbp_type_name &&
(0 == strcmp(type_name, array[i].mbp_type_name)))) &&
((NULL == component_name && NULL == array[i].mbp_component_name) ||
(NULL != component_name && NULL != array[i].mbp_component_name &&
0 == strcmp(component_name, array[i].mbp_component_name))) &&
@ -498,11 +629,10 @@ int mca_base_param_dump(opal_list_t **info, bool internal)
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_type = array[i].mbp_type;
/* JMS to be removed? */
p->mbpp_env_var_name = array[i].mbp_env_var_name;
p->mbpp_full_name = array[i].mbp_full_name;
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;
opal_list_append(*info, (opal_list_item_t*) p);
}
@ -649,12 +779,17 @@ static int read_files(char *file_list)
}
static int param_register(const char *type_name, const char *component_name,
const char *param_name, const char *mca_param_name,
static int param_register(const char *type_name,
const char *component_name,
const char *param_name,
const char *help_msg,
mca_base_param_type_t type,
bool internal,
bool read_only,
mca_base_param_storage_t *default_value,
mca_base_param_storage_t *file_value,
mca_base_param_storage_t *override_value)
mca_base_param_storage_t *override_value,
mca_base_param_storage_t *current_value)
{
int ret;
size_t i, len;
@ -666,82 +801,76 @@ static int param_register(const char *type_name, const char *component_name,
mca_base_param_init();
}
/* Error check */
if (NULL == type_name) {
return OMPI_ERR_BAD_PARAM;
}
/* Create a parameter entry. If a keyval is to be used, it will be
registered elsewhere. We simply assign -1 here. */
OBJ_CONSTRUCT(&param, mca_base_param_t);
param.mbp_type = type;
param.mbp_keyval = MPI_KEYVAL_INVALID;
param.mbp_internal = false;
param.mbp_internal = internal;
param.mbp_read_only = read_only;
if (NULL != help_msg) {
param.mbp_help_msg = strdup(help_msg);
}
param.mbp_type_name = strdup(type_name);
if (NULL == param.mbp_type_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
if (NULL != type_name) {
param.mbp_type_name = strdup(type_name);
if (NULL == param.mbp_type_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
if (NULL != component_name) {
param.mbp_component_name = strdup(component_name);
if (NULL == param.mbp_component_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
}
} else {
param.mbp_param_name = NULL;
param.mbp_component_name = strdup(component_name);
if (NULL == param.mbp_component_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
param.mbp_param_name = NULL;
if (NULL != param_name) {
param.mbp_param_name = strdup(param_name);
if (NULL == param.mbp_param_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
}
} else {
param.mbp_param_name = NULL;
param.mbp_param_name = strdup(param_name);
if (NULL == param.mbp_param_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERR_OUT_OF_RESOURCE;
}
}
/* The full parameter name may have been specified by the caller.
If it was, use that (only for backwards compatability).
Otherwise, derive it from the type, component, and parameter
name. */
param.mbp_env_var_name = NULL;
if (NULL != mca_param_name) {
param.mbp_full_name = strdup(mca_param_name);
if (NULL == param.mbp_full_name) {
len = 16;
if (NULL != type_name) {
len += strlen(type_name);
}
if (NULL != param.mbp_component_name) {
len += strlen(param.mbp_component_name);
}
if (NULL != param.mbp_param_name) {
len += strlen(param.mbp_param_name);
}
param.mbp_full_name = malloc(len);
if (NULL == param.mbp_full_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERROR;
}
} else {
len = 16 + strlen(type_name);
if (NULL != component_name) {
len += strlen(component_name);
}
if (NULL != param_name) {
len += strlen(param_name);
}
param.mbp_full_name = malloc(len);
if (NULL == param.mbp_full_name) {
OBJ_DESTRUCT(&param);
return OMPI_ERROR;
}
/* Copy the name over in parts */
strncpy(param.mbp_full_name, type_name, len);
if (NULL != component_name) {
strcat(param.mbp_full_name, "_");
}
/* Copy the name over in parts */
param.mbp_full_name[0] = '\0';
if (NULL != type_name) {
strncat(param.mbp_full_name, type_name, len);
}
if (NULL != component_name) {
if ('\0' != param.mbp_full_name[0]) {
strcat(param.mbp_full_name, "_");
}
strcat(param.mbp_full_name, component_name);
}
if (NULL != param_name) {
strcat(param.mbp_full_name, "_");
}
if (NULL != param_name) {
if ('\0' != param.mbp_full_name[0]) {
strcat(param.mbp_full_name, "_");
}
strcat(param.mbp_full_name, param_name);
}
}
/* Create the environment name */
@ -942,7 +1071,19 @@ static int param_register(const char *type_name, const char *component_name,
(ret = opal_value_array_append_item(&mca_base_params, &param))) {
return ret;
}
return opal_value_array_get_size(&mca_base_params) - 1;
ret = opal_value_array_get_size(&mca_base_params) - 1;
/* Finally, if we have a lookup value, look it up */
if (NULL != current_value) {
if (!param_lookup(ret, current_value, NULL)) {
return OMPI_ERR_NOT_FOUND;
}
}
/* All done */
return ret;
}
@ -992,6 +1133,7 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
size_t size;
mca_base_param_t *array;
char *p, *q;
bool found;
/* Lookup the index and see if it's valid */
@ -1012,13 +1154,26 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
}
/* Check all the places that the param may be hiding, in priority
order */
if (lookup_override(&array[index], storage) ||
lookup_keyvals(&array[index], storage, attrs) ||
lookup_env(&array[index], storage) ||
lookup_file(&array[index], storage) ||
lookup_default(&array[index], storage)) {
order -- but if read_only is true, then only look at the
default location. */
if (array[index].mbp_read_only) {
if (lookup_override(&array[index], storage) ||
lookup_keyvals(&array[index], storage, attrs) ||
lookup_env(&array[index], storage) ||
lookup_file(&array[index], storage)) {
opal_show_help("help-mca-param.txt", "read-only-param-set",
true, array[index].mbp_full_name);
}
found = lookup_default(&array[index], storage);
} else {
found = (lookup_override(&array[index], storage) ||
lookup_keyvals(&array[index], storage, attrs) ||
lookup_env(&array[index], storage) ||
lookup_file(&array[index], storage) ||
lookup_default(&array[index], storage));
}
if (found) {
/* If we're returning a string, replace all instances of "~/"
with the user's home directory */
@ -1243,11 +1398,13 @@ 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_type_name = NULL;
p->mbp_component_name = NULL;
p->mbp_param_name = NULL;
p->mbp_full_name = NULL;
p->mbp_help_msg = NULL;
p->mbp_keyval = -1;
p->mbp_env_var_name = NULL;
@ -1280,6 +1437,9 @@ static void param_destructor(mca_base_param_t *p)
if (NULL != p->mbp_full_name) {
free(p->mbp_full_name);
}
if (NULL != p->mbp_help_msg) {
free(p->mbp_help_msg);
}
if (MCA_BASE_PARAM_TYPE_STRING == p->mbp_type) {
if (NULL != p->mbp_default_value.stringval) {
free(p->mbp_default_value.stringval);
@ -1318,14 +1478,15 @@ static void fv_destructor(mca_base_param_file_value_t *f)
static void info_constructor(mca_base_param_info_t *p)
{
p->mbpp_index = -1;
p->mbpp_type = MCA_BASE_PARAM_TYPE_MAX;
p->mbpp_type_name = NULL;
p->mbpp_component_name = NULL;
p->mbpp_param_name = NULL;
p->mbpp_type = MCA_BASE_PARAM_TYPE_MAX;
/* JMS to be removed? */
p->mbpp_env_var_name = NULL;
p->mbpp_full_name = NULL;
p->mbpp_read_only = false;
p->mbpp_help_msg = NULL;
}
static void info_destructor(mca_base_param_info_t *p)

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

@ -60,7 +60,9 @@
#include "opal/class/opal_value_array.h"
#include "opal/class/opal_list.h"
#include "class/opal_hash_table.h"
#include "opal/class/opal_hash_table.h"
#include "opal/mca/mca.h"
/**
* The types of MCA parameters.
@ -86,19 +88,22 @@ struct mca_base_param_info_t {
/** Index of this parameter */
int mbpp_index;
/** String name of the type of the parameter */
/** Enum indicating the back-end type of the parameter */
mca_base_param_type_t mbpp_type;
/** String name of the type of this component */
char *mbpp_type_name;
/** String name of the component of the parameter */
char *mbpp_component_name;
/** String name of the parameter of the parameter */
char *mbpp_param_name;
/** Enum indicating the back-end type of the parameter */
mca_base_param_type_t mbpp_type;
/** JMS To be removed? */
char *mbpp_env_var_name;
/** JMS To be removed? */
/** Full, assembled parameter name */
char *mbpp_full_name;
/** Is this value changable? */
bool mbpp_read_only;
/** Help message associated with this parameter */
char *mbpp_help_msg;
};
/**
* Convenience typedef
@ -131,14 +136,21 @@ extern "C" {
/**
* Register an integer MCA parameter.
*
* @param type_name[in] The MCA type (string).
* @param component_name[in] The name of the component (string).
* @param param_name[in] The name of the parameter being registered
* (string).
* @param mca_param_name[in] Optional parameter to override the
* user-visible name of this parameter (string).
* @param default_value[in] The value that is used for this
* @param component [in] Pointer to the componet for which the
* parameter is being registered (string), or NULL.
* @param param_name [in] The name of the parameter being
* registered (string).
* @param help_msg [in] A string describing the use and valid
* values of the parameter (string).
* @param internal [in] Indicates whether the parameter is internal
* (i.e., not to be shown to users) or not (bool).
* @param read_only [in] Indicates whether the parameter value can
* ever change (bool).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
* @param current_value [out] After registering the parameter, look
* up its current value and return it unless current_value is
* NULL.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
@ -147,46 +159,104 @@ extern "C" {
* This function registers an integer MCA parameter and associates it
* with a specific component.
*
* The default resulting MCA parameter name is
* {type_name}[_{component_name}][_{param_name}].
* If the {component} pointer is not NULL, the type name and
* component name are automatically prefixed to the parameter
* name. Otherwise, the {param_name} is used as the full
* parameter name.
*
* {component_name} is only included if it is non-NULL. All
* components an should include their name; component frameworks
* should pass "base". It is only permissible for the MCA base
* itself to pass NULL for the component_name.
* The {help_msg} is a string of arbitrary length (verbose is
* good!) for explaining what the parameter is for and what its
* valid values are. This message is used in help messages, such
* as the output from the ompi_info executable.
*
* Likewise, {param_name} is also only included if it is non-NULL.
* Components and frameworks can pass NULL for this parameter if
* they wish.
* If {internal} is set to true, this parameter is now shown by
* default in the output of ompi_info. That is, this parameter is
* considered internal to the Open MPI implementation and is not
* supposed to be viewed / changed by the user.
*
* In most cases, mca_param_name should be NULL, in which case the
* user-visible name of this parameter will be the default form (as
* described above). Only in rare cases is it necessary (or
* advisable) to override the default name -- its use is strongly
* discouraged.
* If {read_only} is true, then the registered {default_value}
* will be the only value ever returned when this parameter is
* looked up. That is, command line, environment, and file
* overrides will be ignored. This is useful, for example, for
* reporting information to the user (e.g., the version of the GM
* library that was linked against).
*
* It is permissable to register a (type_name, component_name,
* param_name) triple more than once; the same index value will be
* returned, but the default value will be changed to reflect the
* last registration.
* If the {current_value} is not NULL, when the registration is
* complete, the parameter system will look up the current value
* of the parameter and return it in {current_value}.
*/
OMPI_DECLSPEC int mca_base_param_register_int(const char *type_name,
const char *component_name,
OMPI_DECLSPEC int mca_base_param_reg_int(const mca_base_component_t *component,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
int default_value,
int *current_value);
/**
* Register an integer MCA parameter that is not associated with a
* component.
*
* @param type [in] Although this parameter is not associated with
* a component, it still must have a string type name that will
* act as a prefix (string).
* @param param_name [in] The name of the parameter being
* registered (string).
* @param help_msg [in] A string describing the use and valid
* values of the parameter (string).
* @param internal [in] Indicates whether the parameter is internal
* (i.e., not to be shown to users) or not (bool).
* @param read_only [in] Indicates whether the parameter value can
* ever change (bool).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
* @param current_value [out] After registering the parameter, look
* up its current value and return it unless current_value is
* NULL.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
* mca_base_param_lookup_string() to retrieve the value of the
* parameter.
*
* This function is identical to mca_base_param_reg_int() except
* that it registers parameters that are not associated with
* components. For example, it can be used to register parameters
* associated with a framework base or an overall layer (e.g., the
* MPI layer, or the MCA base system framework itself). Typical
* "type" strings are:
*
* * "mca": for the MCA base framework itself
* * framework name: for any given framework
* * "mpi": for parameters that apply to the overall MPI layer
* * "orte": for parameters that apply to the overall ORTE layer
*/
OMPI_DECLSPEC int mca_base_param_reg_int_name(const char *type,
const char *param_name,
const char *mca_param_name,
int default_value);
const char *help_msg,
bool internal,
bool read_only,
int default_value,
int *current_value);
/**
* Register a string MCA parameter.
*
* @param type_name[in] The MCA type (string).
* @param component_name[in] The name of the component (string).
* @param param_name[in] The name of the parameter being registered
* (string).
* @param mca_param_name[in] Optional parameter to override the
* user-visible name of this parameter (string).
* @param default_value[in] The value that is used for this
* @param component [in] Pointer to the componet for which the
* parameter is being registered (string), or NULL.
* @param param_name [in] The name of the parameter being
* registered (string).
* @param help_msg [in] A string describing the use and valid
* values of the parameter (string).
* @param internal [in] Indicates whether the parameter is internal
* (i.e., not to be shown to users) or not (bool).
* @param read_only [in] Indicates whether the parameter value can
* ever change (bool).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
* @param current_value [out] After registering the parameter, look
* up its current value and return it unless current_value is
* NULL.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
@ -197,16 +267,69 @@ extern "C" {
* never be NULL. It will always have a value, even if that value is
* the empty string.
*
* This function is identical to mca_base_param_register_int()
* except that you are registering a string parameter with an
* associated string default value (which is \em not allowed to be NULL).
* See mca_base_param_register_int() for all other details.
* This function is identical to mca_base_param_reg_int() except
* that you are registering a string parameter with an associated
* string default value (which is \em not allowed to be NULL).
* See mca_base_param_reg_int() for all other details.
*/
OMPI_DECLSPEC int mca_base_param_register_string(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
const char *default_value);
OMPI_DECLSPEC int mca_base_param_reg_string(const mca_base_component_t *component,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
const char *default_value,
char **current_value);
/**
* Register a string MCA parameter that is not associated with a
* component.
*
* @param type [in] Although this parameter is not associated with
* a component, it still must have a string type name that will
* act as a prefix (string).
* @param param_name [in] The name of the parameter being
* registered (string).
* @param help_msg [in] A string describing the use and valid
* values of the parameter (string).
* @param internal [in] Indicates whether the parameter is internal
* (i.e., not to be shown to users) or not (bool).
* @param read_only [in] Indicates whether the parameter value can
* ever change (bool).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
* @param current_value [out] After registering the parameter, look
* up its current value and return it unless current_value is
* NULL.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
* mca_base_param_lookup_string() to retrieve the value of the
* parameter.
*
* Note that if a string value is read in from a file then it will
* never be NULL. It will always have a value, even if that value is
* the empty string.
*
* This function is identical to mca_base_param_reg_string()
* except that it registers parameters that are not associated
* with components. For example, it can be used to register
* parameters associated with a framework base or an overall layer
* (e.g., the MPI layer, or the MCA base system framework itself).
* Typical "type" strings are:
*
* * "mca": for the MCA base framework itself
* * framework name: for any given framework
* * "mpi": for parameters that apply to the overall MPI layer
* * "orte": for parameters that apply to the overall ORTE layer
*/
OMPI_DECLSPEC int mca_base_param_reg_string_name(const char *type,
const char *param_name,
const char *help_msg,
bool internal,
bool read_only,
const char *default_value,
char **current_value);
/**
* Associate a communicator/datatype/window keyval with an MCA
@ -241,9 +364,9 @@ extern "C" {
* @param value Pointer to int where the parameter value will be
* stored.
*
* @retvalue OMPI_ERROR Upon failure. The contents of value are
* @return OMPI_ERROR Upon failure. The contents of value are
* undefined.
* @retvalue OMPI_SUCCESS Upon success. value will be filled with the
* @return OMPI_SUCCESS Upon success. value will be filled with the
* parameter's current value.
*
* The value of a specific MCA parameter can be looked up using the
@ -257,13 +380,13 @@ extern "C" {
*
* @param index Index previous returned from
* mca_base_param_register_int().
* @param attr Object containing attributes to be searched.
* @param attrs Object containing attributes to be searched.
* @param value Pointer to int where the parameter value will
* be stored.
*
* @retvalue OMPI_ERROR Upon failure. The contents of value are
* @return OMPI_ERROR Upon failure. The contents of value are
* undefined.
* @retvalue OMPI_SUCCESS Upon success. value will be filled with the
* @return OMPI_SUCCESS Upon success. value will be filled with the
* parameter's current value.
*
* This function is identical to mca_base_param_lookup_int() except
@ -283,9 +406,9 @@ extern "C" {
* @param value Pointer to (char *) where the parameter value will be
* stored.
*
* @retvalue OMPI_ERROR Upon failure. The contents of value are
* @return OMPI_ERROR Upon failure. The contents of value are
* undefined.
* @retvalue OMPI_SUCCESS Upon success. value will be filled with the
* @return OMPI_SUCCESS Upon success. value will be filled with the
* parameter's current value.
*
* Note that if a string value is read in from a file then it will
@ -303,15 +426,15 @@ extern "C" {
/**
* Look up a string MCA parameter, to include looking in attributes.
*
* @param index[in] Index previous returned from
* @param index [in] Index previous returned from
* mca_base_param_register_string().
* @param attr[in] Object containing attributes to be searched.
* @param value[out] Pointer to (char *) where the parameter value
* @param attrs [in] Object containing attributes to be searched.
* @param value [out] Pointer to (char *) where the parameter value
* will be stored.
*
* @retvalue OMPI_ERROR Upon failure. The contents of value are
* @return OMPI_ERROR Upon failure. The contents of value are
* undefined.
* @retvalue OMPI_SUCCESS Upon success. value will be filled with the
* @return OMPI_SUCCESS Upon success. value will be filled with the
* parameter's current value.
*
* This function is identical to mca_base_param_lookup_string()
@ -326,8 +449,8 @@ extern "C" {
/**
* Sets an "override" value for an integer MCA parameter.
*
* @param index[in] Index of MCA parameter to set
* @param value[in] The integer value to set
* @param index [in] Index of MCA parameter to set
* @param value [in] The integer value to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
@ -346,8 +469,8 @@ extern "C" {
/**
* Sets an "override" value for an string MCA parameter.
*
* @param index[in] Index of MCA parameter to set
* @param value[in] The string value to set
* @param index [in] Index of MCA parameter to set
* @param value [in] The string value to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
@ -371,7 +494,7 @@ extern "C" {
* Unset a parameter that was previously set by
* mca_base_param_set_int() or mca_base_param_set_string().
*
* @param index[in] Index of MCA parameter to set
* @param index [in] Index of MCA parameter to set
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval OMPI_SUCCESS Upon success.
@ -385,9 +508,7 @@ extern "C" {
* Get the string name corresponding to the MCA parameter
* value in the environment.
*
* @param type_name Name of the type containing the parameter.
* @param component_name Name of the component containing the parameter.
* @param param_name Name of the parameter.
* @param param_name Name of the type containing the parameter.
*
* @retval string A string suitable for setenv() or appending to
* an environ-style string array.
@ -396,16 +517,14 @@ extern "C" {
* The string that is returned is owned by the caller; if
* appropriate, it must be eventually freed by the caller.
*/
OMPI_DECLSPEC char *mca_base_param_environ_variable(const char *type,
const char *component,
const char *param);
OMPI_DECLSPEC char *mca_base_param_env_var(const char *param_name);
/**
* Find the index for an MCA parameter based on its names.
*
* @param type_name Name of the type containing the parameter.
* @param component_name Name of the component containing the parameter.
* @param param_name Name of the parameter.
* @param type Name of the type containing the parameter.
* @param component Name of the component containing the parameter.
* @param param Name of the parameter.
*
* @retval OMPI_ERROR If the parameter was not found.
* @retval index If the parameter was found.
@ -426,9 +545,9 @@ extern "C" {
/**
* Set the "internal" flag on an MCA parameter to true or false.
*
* @param index[in] Index previous returned from
* @param index [in] Index previous returned from
* mca_base_param_register_string() or mca_base_param_register_int().
* @param internal[in] Boolean indicating whether the MCA
* @param internal [in] Boolean indicating whether the MCA
* parameter is internal (private) or public.
*
* @returns OMPI_SUCCESS If it can find the parameter to reset
@ -448,9 +567,9 @@ extern "C" {
* Obtain a list of all the MCA parameters currently defined as
* well as their types.
*
* @param info[out] An opal_list_t of mca_base_param_info_t
* @param info [out] An opal_list_t of mca_base_param_info_t
* instances.
* @param internal[in] Whether to include the internal parameters
* @param internal [in] Whether to include the internal parameters
* or not.
*
* @retval OMPI_SUCCESS Upon success.
@ -474,11 +593,11 @@ extern "C" {
* Obtain a list of all the MCA parameters currently defined as
* well as their types.
*
* @param env[out] A pointer to an argv-style array of key=value
* @param env [out] A pointer to an argv-style array of key=value
* strings, suitable for use in an environment
* @param num_env[out] A pointer to an int, containing the length
* @param num_env [out] A pointer to an int, containing the length
* of the env array (not including the final NULL entry).
* @param internal[in] Whether to include the internal parameters
* @param internal [in] Whether to include the internal parameters
* or not.
*
* @retval OMPI_SUCCESS Upon success.
@ -488,13 +607,14 @@ extern "C" {
* its output is in terms of an argv-style array of key=value
* strings, suitable for using in an environment.
*/
OMPI_DECLSPEC int mca_base_param_build_env(char ***env, int *num_env, bool internal);
OMPI_DECLSPEC int mca_base_param_build_env(char ***env, int *num_env,
bool internal);
/**
* Release the memory associated with the info list returned from
* mca_base_param_dump().
*
* @param info[in/out] An opal_list_t previously returned from
* @param info [in/out] An opal_list_t previously returned from
* mca_base_param_dump().
*
* @retval OMPI_SUCCESS Upon success.
@ -525,6 +645,123 @@ extern "C" {
*/
OMPI_DECLSPEC int mca_base_param_finalize(void);
/***************************************************************
* Deprecated interface
***************************************************************/
/**
* \deprecated
*
* Register an integer MCA parameter (deprecated).
*
* @param type_name [in] The MCA type (string).
* @param component_name [in] The name of the component (string).
* @param param_name [in] The name of the parameter being registered
* (string).
* @param mca_param_name [in] Optional parameter to override the
* user-visible name of this parameter (string).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
* mca_base_param_lookup_int() to retrieve the value of the parameter.
*
* This function is deprecated. Use mca_base_param_reg_int() instead.
*
* This function registers an integer MCA parameter and associates it
* with a specific component.
*
* The default resulting MCA parameter name is
* {type_name}[_{component_name}][_{param_name}].
*
* {component_name} is only included if it is non-NULL. All
* components an should include their name; component frameworks
* should pass "base". It is only permissible for the MCA base
* itself to pass NULL for the component_name.
*
* Likewise, {param_name} is also only included if it is non-NULL.
* Components and frameworks can pass NULL for this parameter if
* they wish.
*
* In most cases, mca_param_name should be NULL, in which case the
* user-visible name of this parameter will be the default form (as
* described above). Only in rare cases is it necessary (or
* advisable) to override the default name -- its use is strongly
* discouraged.
*
* It is permissable to register a (type_name, component_name,
* param_name) triple more than once; the same index value will be
* returned, but the default value will be changed to reflect the
* last registration.
*/
OMPI_DECLSPEC int mca_base_param_register_int(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
int default_value);
/**
* \deprecated
*
* Register a string MCA parameter (deprecated).
*
* @param type_name [in] The MCA type (string).
* @param component_name [in] The name of the component (string).
* @param param_name [in] The name of the parameter being registered
* (string).
* @param mca_param_name [in] Optional parameter to override the
* user-visible name of this parameter (string).
* @param default_value [in] The value that is used for this
* parameter if the user does not supply one.
*
* @retval OMPI_ERROR Upon failure to register the parameter.
* @retval index Index value that can be used with
* mca_base_param_lookup_string() to retrieve the value of the
* parameter.
*
* This function is deprecated. Use mca_base_param_reg_string()
* instead.
*
* Note that if a string value is read in from a file then it will
* never be NULL. It will always have a value, even if that value is
* the empty string.
*
* This function is identical to mca_base_param_register_int()
* except that you are registering a string parameter with an
* associated string default value (which is \em not allowed to be NULL).
* See mca_base_param_register_int() for all other details.
*/
OMPI_DECLSPEC int mca_base_param_register_string(const char *type_name,
const char *component_name,
const char *param_name,
const char *mca_param_name,
const char *default_value);
/**
* \deprecated
*
* Get the string name corresponding to the MCA parameter
* value in the environment (deprecated).
*
* @param type Name of the type containing the parameter.
* @param comp Name of the component containing the parameter.
* @param param Name of the parameter.
*
* @retval string A string suitable for setenv() or appending to
* an environ-style string array.
* @retval NULL Upon failure.
*
* This function is deprecated. Use mca_base_param_env_var()
* instead.
*
* The string that is returned is owned by the caller; if
* appropriate, it must be eventually freed by the caller.
*/
OMPI_DECLSPEC char *mca_base_param_environ_variable(const char *type,
const char *comp,
const char *param);
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif

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

@ -75,6 +75,12 @@ struct mca_base_param_t {
/** Whether this is internal (not meant to be seen / modified by
users) or not */
bool mbp_internal;
/** Whether this value is changable from the default value that
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;
/** Help message associated with this parameter */
char *mbp_help_msg;
/** Keyval value for MPI attribute parameters */
int mbp_keyval;