Per RFC: remove old MCA parameter system.
This commit was SVN r28541.
Этот коммит содержится в:
родитель
889bf60c64
Коммит
721779d7ab
@ -26,7 +26,6 @@
|
|||||||
#include "ompi/constants.h"
|
#include "ompi/constants.h"
|
||||||
#include "opal/util/output.h"
|
#include "opal/util/output.h"
|
||||||
|
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
|
||||||
#include "ompi/mca/btl/base/btl_base_error.h"
|
#include "ompi/mca/btl/base/btl_base_error.h"
|
||||||
|
|
||||||
#include "btl_vader.h"
|
#include "btl_vader.h"
|
||||||
|
@ -35,8 +35,6 @@ headers = \
|
|||||||
mca_base_var.h \
|
mca_base_var.h \
|
||||||
mca_base_var_enum.h \
|
mca_base_var_enum.h \
|
||||||
mca_base_vari.h \
|
mca_base_vari.h \
|
||||||
mca_base_param.h \
|
|
||||||
mca_base_param_internal.h \
|
|
||||||
mca_base_framework.h
|
mca_base_framework.h
|
||||||
|
|
||||||
# Library
|
# Library
|
||||||
@ -53,7 +51,6 @@ libmca_base_la_SOURCES = \
|
|||||||
mca_base_components_select.c \
|
mca_base_components_select.c \
|
||||||
mca_base_list.c \
|
mca_base_list.c \
|
||||||
mca_base_open.c \
|
mca_base_open.c \
|
||||||
mca_base_param.c \
|
|
||||||
mca_base_var.c \
|
mca_base_var.c \
|
||||||
mca_base_var_enum.c \
|
mca_base_var_enum.c \
|
||||||
mca_base_parse_paramfile.c \
|
mca_base_parse_paramfile.c \
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
* These units are large enough to warrant their own .h files
|
* These units are large enough to warrant their own .h files
|
||||||
*/
|
*/
|
||||||
#include "opal/mca/mca.h"
|
#include "opal/mca/mca.h"
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
|
||||||
#include "opal/mca/base/mca_base_var.h"
|
#include "opal/mca/base/mca_base_var.h"
|
||||||
#include "opal/mca/base/mca_base_framework.h"
|
#include "opal/mca/base/mca_base_framework.h"
|
||||||
#include "opal/util/cmd_line.h"
|
#include "opal/util/cmd_line.h"
|
||||||
|
@ -1,843 +0,0 @@
|
|||||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
|
||||||
* University Research and Technology
|
|
||||||
* Corporation. All rights reserved.
|
|
||||||
* Copyright (c) 2004-2012 The University of Tennessee and The University
|
|
||||||
* of Tennessee Research Foundation. 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 (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
|
|
||||||
* reserved.
|
|
||||||
* $COPYRIGHT$
|
|
||||||
*
|
|
||||||
* Additional copyrights may follow
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "opal_config.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "opal/mca/installdirs/installdirs.h"
|
|
||||||
#include "opal/util/os_path.h"
|
|
||||||
#include "opal/util/path.h"
|
|
||||||
#include "opal/class/opal_value_array.h"
|
|
||||||
#include "opal/util/show_help.h"
|
|
||||||
#include "opal/class/opal_hash_table.h"
|
|
||||||
#include "opal/util/printf.h"
|
|
||||||
#include "opal/util/argv.h"
|
|
||||||
#include "opal/mca/mca.h"
|
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
|
||||||
#include "opal/mca/base/mca_base_param_internal.h"
|
|
||||||
#include "opal/constants.h"
|
|
||||||
#include "opal/util/output.h"
|
|
||||||
#include "opal/util/opal_environ.h"
|
|
||||||
#include "opal/runtime/opal.h"
|
|
||||||
|
|
||||||
#include "opal/mca/base/mca_base_var.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* local variables
|
|
||||||
*/
|
|
||||||
static opal_value_array_t mca_base_params;
|
|
||||||
static const char *mca_prefix = "OMPI_MCA_";
|
|
||||||
static bool initialized = false;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* local functions
|
|
||||||
*/
|
|
||||||
static void param_constructor(mca_base_param_t *p);
|
|
||||||
static void param_destructor(mca_base_param_t *p);
|
|
||||||
static void info_constructor(mca_base_param_info_t *p);
|
|
||||||
static void info_destructor(mca_base_param_info_t *p);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make the class instance for mca_base_param_t
|
|
||||||
*/
|
|
||||||
OBJ_CLASS_INSTANCE(mca_base_param_t, opal_object_t,
|
|
||||||
param_constructor, param_destructor);
|
|
||||||
OBJ_CLASS_INSTANCE(mca_base_param_info_t, opal_list_item_t,
|
|
||||||
info_constructor, info_destructor);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set it up
|
|
||||||
*/
|
|
||||||
int mca_base_param_init(void)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (!initialized) {
|
|
||||||
initialized = true;
|
|
||||||
|
|
||||||
OBJ_CONSTRUCT(&mca_base_params, opal_value_array_t);
|
|
||||||
opal_value_array_init (&mca_base_params, sizeof (mca_base_param_t));
|
|
||||||
|
|
||||||
ret = mca_base_var_init ();
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Leave file caching up to the variable system */
|
|
||||||
int mca_base_param_recache_files(bool rel_path_search)
|
|
||||||
{
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register an MCA parameter
|
|
||||||
*/
|
|
||||||
static int register_param (const char *type_name, const char *component_name,
|
|
||||||
const char *param_name, const char *help_msg,
|
|
||||||
bool internal, bool read_only, mca_base_param_type_t type,
|
|
||||||
void *default_value, void *current_value)
|
|
||||||
{
|
|
||||||
mca_base_var_flag_t flags = 0;
|
|
||||||
mca_base_var_type_t var_type;
|
|
||||||
mca_base_param_t param;
|
|
||||||
int ret, var_index;
|
|
||||||
|
|
||||||
if (!initialized) {
|
|
||||||
mca_base_param_init ();
|
|
||||||
}
|
|
||||||
|
|
||||||
OBJ_CONSTRUCT(¶m, mca_base_param_t);
|
|
||||||
|
|
||||||
if (internal) {
|
|
||||||
flags |= MCA_BASE_VAR_FLAG_INTERNAL;
|
|
||||||
}
|
|
||||||
if (read_only) {
|
|
||||||
flags |= MCA_BASE_VAR_FLAG_DEFAULT_ONLY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a backing store for this parameter (needs to be malloc since the param
|
|
||||||
will be memcpy'd into the parameter list) */
|
|
||||||
param.param_value = calloc (1, sizeof (*param.param_value));
|
|
||||||
if (NULL == param.param_value) {
|
|
||||||
OBJ_DESTRUCT(¶m);
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case MCA_BASE_PARAM_TYPE_INT:
|
|
||||||
var_type = MCA_BASE_VAR_TYPE_INT;
|
|
||||||
param.param_value->intval = ((int *)default_value)[0];
|
|
||||||
break;
|
|
||||||
case MCA_BASE_PARAM_TYPE_STRING:
|
|
||||||
var_type = MCA_BASE_VAR_TYPE_STRING;
|
|
||||||
if (default_value) {
|
|
||||||
param.param_value->stringval = (char *) default_value;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MCA_BASE_PARAM_TYPE_MAX:
|
|
||||||
OBJ_DESTRUCT(¶m);
|
|
||||||
return OPAL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
var_index = mca_base_var_register (NULL, type_name, component_name,
|
|
||||||
param_name, help_msg, var_type, NULL,
|
|
||||||
0, flags, OPAL_INFO_LVL_9,
|
|
||||||
MCA_BASE_VAR_SCOPE_READONLY,
|
|
||||||
param.param_value);
|
|
||||||
|
|
||||||
param.var_index = var_index;
|
|
||||||
|
|
||||||
if (0 > var_index) {
|
|
||||||
return OPAL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = opal_value_array_append_item (&mca_base_params, ¶m);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (current_value) {
|
|
||||||
switch (type) {
|
|
||||||
case MCA_BASE_PARAM_TYPE_INT:
|
|
||||||
((int *) current_value)[0] = param.param_value->intval;
|
|
||||||
break;
|
|
||||||
case MCA_BASE_PARAM_TYPE_STRING:
|
|
||||||
|
|
||||||
if (NULL != param.param_value->stringval) {
|
|
||||||
((char **) current_value)[0] = strdup (param.param_value->stringval);
|
|
||||||
} else {
|
|
||||||
((char **) current_value)[0] = NULL;
|
|
||||||
}
|
|
||||||
case MCA_BASE_PARAM_TYPE_MAX:
|
|
||||||
/* Impossible */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return var_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
return register_param (component->mca_type_name, component->mca_component_name,
|
|
||||||
param_name, help_msg, internal, read_only,
|
|
||||||
MCA_BASE_PARAM_TYPE_INT, (void *) &default_value,
|
|
||||||
(void *) current_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
return register_param (type, NULL, param_name, help_msg, internal, read_only,
|
|
||||||
MCA_BASE_PARAM_TYPE_INT, (void *) &default_value,
|
|
||||||
(void *) current_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
return register_param (component->mca_type_name, component->mca_component_name,
|
|
||||||
param_name, help_msg, internal, read_only,
|
|
||||||
MCA_BASE_PARAM_TYPE_STRING, (void *) default_value,
|
|
||||||
(void *) current_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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)
|
|
||||||
{
|
|
||||||
return register_param (type, NULL, param_name, help_msg, internal, read_only,
|
|
||||||
MCA_BASE_PARAM_TYPE_STRING, (void *) default_value,
|
|
||||||
(void *) current_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register a synonym name for an existing MCA parameter
|
|
||||||
*/
|
|
||||||
static int reg_syn (int index_orig, const char *type_name, const char *component_name,
|
|
||||||
const char *syn_param_name, bool deprecated)
|
|
||||||
{
|
|
||||||
return mca_base_var_register_synonym (index_orig, NULL, type_name,
|
|
||||||
component_name, syn_param_name,
|
|
||||||
deprecated ? MCA_BASE_VAR_SYN_FLAG_DEPRECATED : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_reg_syn(int index_orig,
|
|
||||||
const mca_base_component_t *syn_component,
|
|
||||||
const char *syn_param_name, bool deprecated)
|
|
||||||
{
|
|
||||||
return reg_syn (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 reg_syn (index_orig, syn_type_name, NULL, syn_param_name,
|
|
||||||
deprecated);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Look up an integer MCA parameter.
|
|
||||||
*/
|
|
||||||
int mca_base_param_lookup_int(int index, int *value)
|
|
||||||
{
|
|
||||||
const mca_base_var_t *var;
|
|
||||||
const mca_base_var_storage_t *tmp;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = mca_base_var_get (index, &var);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mca_base_var_get_value (index, &tmp, NULL, NULL);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MCA_BASE_VAR_TYPE_BOOL == var->mbv_type) {
|
|
||||||
*value = tmp->boolval;
|
|
||||||
} else if (MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG == var->mbv_type) {
|
|
||||||
*value = (int) tmp->ullval;
|
|
||||||
} else if (MCA_BASE_VAR_TYPE_SIZE_T == var->mbv_type) {
|
|
||||||
*value = (int) tmp->sizetval;
|
|
||||||
} else {
|
|
||||||
*value = tmp->intval;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set an integer parameter
|
|
||||||
*/
|
|
||||||
int mca_base_param_set_int(int index, int value)
|
|
||||||
{
|
|
||||||
const mca_base_var_t *var;
|
|
||||||
mca_base_var_storage_t tmp;
|
|
||||||
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = mca_base_var_get (index, &var);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MCA_BASE_VAR_TYPE_BOOL == var->mbv_type) {
|
|
||||||
tmp.boolval = !!value;
|
|
||||||
} else if (MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG == var->mbv_type) {
|
|
||||||
tmp.ullval = (unsigned long long) value;
|
|
||||||
} else if (MCA_BASE_VAR_TYPE_SIZE_T == var->mbv_type) {
|
|
||||||
tmp.sizetval = (size_t) value;
|
|
||||||
} else {
|
|
||||||
tmp.intval = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mca_base_var_set_value (index, &tmp, sizeof (tmp),
|
|
||||||
MCA_BASE_VAR_SOURCE_SET, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Deregister a parameter
|
|
||||||
*/
|
|
||||||
int mca_base_param_deregister(int index)
|
|
||||||
{
|
|
||||||
return mca_base_var_deregister (index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Look up a string MCA parameter.
|
|
||||||
*/
|
|
||||||
int mca_base_param_lookup_string(int index, char **value)
|
|
||||||
{
|
|
||||||
const char **tmp;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
*value = NULL;
|
|
||||||
|
|
||||||
ret = mca_base_var_get_value (index, &tmp, NULL, NULL);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MCA param users expect us to return a copy of the string */
|
|
||||||
if (tmp && tmp[0]) {
|
|
||||||
*value = strdup (tmp[0]);
|
|
||||||
if (NULL == *value) {
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Set an string parameter
|
|
||||||
*/
|
|
||||||
int mca_base_param_set_string(int index, char *value)
|
|
||||||
{
|
|
||||||
return mca_base_var_set_value (index, value, value ? strlen (value) : 0,
|
|
||||||
MCA_BASE_VAR_SOURCE_SET, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Lookup the source of an MCA param's value
|
|
||||||
*/
|
|
||||||
int mca_base_param_lookup_source(int index, mca_base_param_source_t *source, const char **source_file)
|
|
||||||
{
|
|
||||||
mca_base_var_source_t var_source;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = mca_base_var_get_value (index, NULL, &var_source, source_file);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != source) {
|
|
||||||
switch (var_source) {
|
|
||||||
case MCA_BASE_VAR_SOURCE_ENV:
|
|
||||||
case MCA_BASE_VAR_SOURCE_COMMAND_LINE:
|
|
||||||
*source = MCA_BASE_PARAM_SOURCE_ENV;
|
|
||||||
break;
|
|
||||||
case MCA_BASE_VAR_SOURCE_FILE:
|
|
||||||
case MCA_BASE_VAR_SOURCE_OVERRIDE:
|
|
||||||
*source = MCA_BASE_PARAM_SOURCE_FILE;
|
|
||||||
break;
|
|
||||||
case MCA_BASE_VAR_SOURCE_SET:
|
|
||||||
*source = MCA_BASE_PARAM_SOURCE_OVERRIDE;
|
|
||||||
break;
|
|
||||||
case MCA_BASE_VAR_SOURCE_DEFAULT:
|
|
||||||
*source = MCA_BASE_PARAM_SOURCE_DEFAULT;
|
|
||||||
break;
|
|
||||||
case MCA_BASE_VAR_SOURCE_MAX:
|
|
||||||
return OPAL_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Unset a parameter
|
|
||||||
*/
|
|
||||||
int mca_base_param_unset(int index)
|
|
||||||
{
|
|
||||||
/* It is possible to support the semantics of unset by:
|
|
||||||
* 1) When registering the parameter, save the default.
|
|
||||||
* 2) On calling unset, lookup the default (can only be done for
|
|
||||||
* parameters that use the old system).
|
|
||||||
* 3) Deregister the parameter
|
|
||||||
* 4) Set the default
|
|
||||||
* 5) Register the parameter.
|
|
||||||
*
|
|
||||||
* The mca_base_var system will ensure the parameter keeps the
|
|
||||||
* same index and will do the lookup (env, file, default) again.
|
|
||||||
*/
|
|
||||||
return OPAL_ERR_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char *mca_base_param_env_var(const char *param_name)
|
|
||||||
{
|
|
||||||
char *var_name;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = mca_base_var_env_name (param_name, &var_name);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return var_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the index for an MCA parameter based on its names.
|
|
||||||
*/
|
|
||||||
int mca_base_param_find(const char *type_name, const char *component_name,
|
|
||||||
const char *param_name)
|
|
||||||
{
|
|
||||||
return mca_base_var_find (NULL, type_name, component_name, param_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_set_internal (int index, bool internal)
|
|
||||||
{
|
|
||||||
return mca_base_var_set_flag (index, MCA_BASE_VAR_FLAG_INTERNAL, internal);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return a list of info of all currently registered parameters
|
|
||||||
*/
|
|
||||||
int mca_base_param_dump(opal_list_t **info, bool internal)
|
|
||||||
{
|
|
||||||
mca_base_param_info_t *p, *q;
|
|
||||||
size_t i, j, len;
|
|
||||||
int *synonyms;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Check for bozo cases */
|
|
||||||
|
|
||||||
if (!initialized || NULL == info) {
|
|
||||||
return OPAL_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
*info = OBJ_NEW(opal_list_t);
|
|
||||||
if (NULL == *info) {
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Iterate through all the registered parameters */
|
|
||||||
|
|
||||||
len = mca_base_var_get_count ();
|
|
||||||
|
|
||||||
for (i = 0; i < len; ++i) {
|
|
||||||
const mca_base_var_t *var, *syn;
|
|
||||||
|
|
||||||
ret = mca_base_var_get (i, &var);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Dump this variable only if it is not a synonym and either it
|
|
||||||
is not internal or internal variables were requested */
|
|
||||||
if ((internal || !(var->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL)) &&
|
|
||||||
0 > var->mbv_synonym_for) {
|
|
||||||
const mca_base_var_group_t *group;
|
|
||||||
|
|
||||||
ret = mca_base_var_group_get (var->mbv_group_index, &group);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = OBJ_NEW(mca_base_param_info_t);
|
|
||||||
if (NULL == p) {
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->mbpp_index = i;
|
|
||||||
p->mbpp_type_name = group->group_framework;
|
|
||||||
p->mbpp_component_name = group->group_component;
|
|
||||||
p->mbpp_param_name = var->mbv_variable_name;
|
|
||||||
p->mbpp_full_name = var->mbv_full_name;
|
|
||||||
p->mbpp_deprecated = !!(var->mbv_flags & MCA_BASE_VAR_FLAG_DEPRECATED);
|
|
||||||
p->mbpp_internal = !!(var->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL);
|
|
||||||
p->mbpp_read_only = !!(var->mbv_flags & MCA_BASE_VAR_FLAG_DEFAULT_ONLY);
|
|
||||||
if (var->mbv_type == MCA_BASE_VAR_TYPE_INT ||
|
|
||||||
var->mbv_type == MCA_BASE_VAR_TYPE_UNSIGNED_INT ||
|
|
||||||
var->mbv_type == MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG ||
|
|
||||||
var->mbv_type == MCA_BASE_VAR_TYPE_SIZE_T ||
|
|
||||||
var->mbv_type == MCA_BASE_VAR_TYPE_BOOL) {
|
|
||||||
p->mbpp_type = MCA_BASE_PARAM_TYPE_INT;
|
|
||||||
} else {
|
|
||||||
p->mbpp_type = MCA_BASE_PARAM_TYPE_STRING;
|
|
||||||
}
|
|
||||||
p->mbpp_help_msg = var->mbv_description;
|
|
||||||
|
|
||||||
/* Save this entry to the list */
|
|
||||||
opal_list_append(*info, &p->super);
|
|
||||||
|
|
||||||
p->mbpp_synonyms_len = opal_value_array_get_size ((opal_value_array_t *) &var->mbv_synonyms);
|
|
||||||
|
|
||||||
if (p->mbpp_synonyms_len) {
|
|
||||||
p->mbpp_synonyms = calloc(p->mbpp_synonyms_len,
|
|
||||||
sizeof (mca_base_param_info_t *));
|
|
||||||
if (NULL == p->mbpp_synonyms) {
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
synonyms = OPAL_VALUE_ARRAY_GET_BASE(&var->mbv_synonyms, int);
|
|
||||||
|
|
||||||
for (j = 0 ; j < (size_t) p->mbpp_synonyms_len ; ++j) {
|
|
||||||
ret = mca_base_var_get (synonyms[j], &syn);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
p->mbpp_synonyms[j] = NULL;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = mca_base_var_group_get (syn->mbv_group_index, &group);
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
q = OBJ_NEW(mca_base_param_info_t);
|
|
||||||
if (NULL == q) {
|
|
||||||
p->mbpp_synonyms_len = j;
|
|
||||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
q->mbpp_index = (int) i;
|
|
||||||
q->mbpp_type_name = group->group_framework;
|
|
||||||
q->mbpp_component_name = group->group_component;
|
|
||||||
q->mbpp_param_name = syn->mbv_variable_name;
|
|
||||||
q->mbpp_full_name = syn->mbv_full_name;
|
|
||||||
q->mbpp_deprecated = !!(syn->mbv_flags & MCA_BASE_VAR_FLAG_DEPRECATED);
|
|
||||||
q->mbpp_internal = !!(syn->mbv_flags & MCA_BASE_VAR_FLAG_INTERNAL);
|
|
||||||
q->mbpp_read_only = !!(syn->mbv_flags & MCA_BASE_VAR_FLAG_DEFAULT_ONLY);
|
|
||||||
q->mbpp_type = syn->mbv_type;
|
|
||||||
q->mbpp_help_msg = syn->mbv_description;
|
|
||||||
|
|
||||||
/* 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, &q->super);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All done */
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make an argv-style list of strings suitable for an environment
|
|
||||||
*/
|
|
||||||
int mca_base_param_build_env(char ***env, int *num_env, bool internal)
|
|
||||||
{
|
|
||||||
return mca_base_var_build_env (env, num_env, internal);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Free a list -- and all associated memory -- that was previously
|
|
||||||
* returned from mca_base_param_dump()
|
|
||||||
*/
|
|
||||||
int mca_base_param_dump_release(opal_list_t *info)
|
|
||||||
{
|
|
||||||
opal_list_item_t *item;
|
|
||||||
|
|
||||||
while (NULL != (item = opal_list_remove_first(info))) {
|
|
||||||
OBJ_RELEASE(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
OBJ_RELEASE(info);
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Shut down the MCA parameter system (normally only invoked by the
|
|
||||||
* MCA framework itself).
|
|
||||||
*/
|
|
||||||
int mca_base_param_finalize(void)
|
|
||||||
{
|
|
||||||
mca_base_param_t *array;
|
|
||||||
size_t size, i;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (initialized) {
|
|
||||||
ret = mca_base_var_finalize ();
|
|
||||||
if (OPAL_SUCCESS != ret) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
OBJ_DESTRUCT(&array[i]);
|
|
||||||
}
|
|
||||||
OBJ_DESTRUCT(&mca_base_params);
|
|
||||||
|
|
||||||
initialized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* All done */
|
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create an empty param container
|
|
||||||
*/
|
|
||||||
static void param_constructor(mca_base_param_t *p)
|
|
||||||
{
|
|
||||||
memset ((char *) p + sizeof (p->super), 0, sizeof (*p) - sizeof (p->super));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Free all the contents of a param container
|
|
||||||
*/
|
|
||||||
static void param_destructor(mca_base_param_t *p)
|
|
||||||
{
|
|
||||||
if (NULL != p->param_value) {
|
|
||||||
free (p->param_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OPAL_ENABLE_DEBUG
|
|
||||||
/* Cheap trick to reset everything to NULL */
|
|
||||||
param_constructor(p);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
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_full_name = NULL;
|
|
||||||
|
|
||||||
p->mbpp_deprecated = false;
|
|
||||||
|
|
||||||
p->mbpp_synonyms = NULL;
|
|
||||||
p->mbpp_synonyms_len = 0;
|
|
||||||
p->mbpp_synonym_parent = NULL;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_find_int(const mca_base_component_t *component,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
int *current_value)
|
|
||||||
{
|
|
||||||
char *tmp, *ptr;
|
|
||||||
int len, i;
|
|
||||||
int rc=OPAL_ERR_NOT_FOUND;
|
|
||||||
|
|
||||||
if (NULL == env) {
|
|
||||||
return OPAL_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
asprintf(&tmp, "%s%s_%s_%s", mca_prefix, component->mca_type_name,
|
|
||||||
component->mca_component_name, param_name);
|
|
||||||
len = strlen(tmp);
|
|
||||||
for (i=0; NULL != env[i]; i++) {
|
|
||||||
if (0 == strncmp(tmp, env[i], len)) {
|
|
||||||
ptr = strchr(env[i], '=');
|
|
||||||
ptr++;
|
|
||||||
*current_value = strtol(ptr, NULL, 10);
|
|
||||||
rc = OPAL_SUCCESS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_find_int_name(const char *type,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
int *current_value)
|
|
||||||
{
|
|
||||||
char *tmp, *ptr;
|
|
||||||
int len, i;
|
|
||||||
int rc=OPAL_ERR_NOT_FOUND;
|
|
||||||
|
|
||||||
if (NULL == env) {
|
|
||||||
return OPAL_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
asprintf(&tmp, "%s%s_%s", mca_prefix, type, param_name);
|
|
||||||
len = strlen(tmp);
|
|
||||||
for (i=0; NULL != env[i]; i++) {
|
|
||||||
if (0 == strncmp(tmp, env[i], len)) {
|
|
||||||
ptr = strchr(env[i], '=');
|
|
||||||
ptr++;
|
|
||||||
*current_value = strtol(ptr, NULL, 10);
|
|
||||||
rc = OPAL_SUCCESS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_find_string(const mca_base_component_t *component,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
char **current_value)
|
|
||||||
{
|
|
||||||
char *tmp, *ptr;
|
|
||||||
int len, i;
|
|
||||||
int rc=OPAL_ERR_NOT_FOUND;
|
|
||||||
|
|
||||||
if (NULL == env) {
|
|
||||||
return OPAL_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
asprintf(&tmp, "%s%s_%s_%s", mca_prefix, component->mca_type_name,
|
|
||||||
component->mca_component_name, param_name);
|
|
||||||
len = strlen(tmp);
|
|
||||||
for (i=0; NULL != env[i]; i++) {
|
|
||||||
if (0 == strncmp(tmp, env[i], len)) {
|
|
||||||
ptr = strchr(env[i], '=');
|
|
||||||
ptr++;
|
|
||||||
*current_value = ptr;
|
|
||||||
rc = OPAL_SUCCESS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_find_string_name(const char *type,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
char **current_value)
|
|
||||||
{
|
|
||||||
char *tmp, *ptr;
|
|
||||||
int len, i;
|
|
||||||
int rc=OPAL_ERR_NOT_FOUND;
|
|
||||||
|
|
||||||
if (NULL == env) {
|
|
||||||
return OPAL_ERR_NOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
asprintf(&tmp, "%s%s_%s", mca_prefix, type, param_name);
|
|
||||||
len = strlen(tmp);
|
|
||||||
for (i=0; NULL != env[i]; i++) {
|
|
||||||
if (0 == strncmp(tmp, env[i], len)) {
|
|
||||||
ptr = strchr(env[i], '=');
|
|
||||||
ptr++;
|
|
||||||
*current_value = ptr;
|
|
||||||
rc = OPAL_SUCCESS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(tmp);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int mca_base_param_check_exclusive_string(const char *type_a,
|
|
||||||
const char *component_a,
|
|
||||||
const char *param_a,
|
|
||||||
const char *type_b,
|
|
||||||
const char *component_b,
|
|
||||||
const char *param_b)
|
|
||||||
{
|
|
||||||
return mca_base_var_check_exclusive (NULL, type_a, component_a,
|
|
||||||
param_a, type_b, component_b,
|
|
||||||
param_b);
|
|
||||||
}
|
|
@ -1,860 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
||||||
* University Research and Technology
|
|
||||||
* Corporation. All rights reserved.
|
|
||||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
||||||
* of Tennessee Research Foundation. 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 (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
|
|
||||||
* $COPYRIGHT$
|
|
||||||
*
|
|
||||||
* Additional copyrights may follow
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** @file
|
|
||||||
* \deprecated The entire mca_base_param system has been deprectated for
|
|
||||||
* 1.7 (removed in 1.9). Please use the mca_base_var system instead.
|
|
||||||
*
|
|
||||||
* This file presents the MCA parameter interface.
|
|
||||||
*
|
|
||||||
* Note that there are two scopes for MCA parameters: "normal" and
|
|
||||||
* attributes. Specifically, all MCA parameters are "normal" -- some
|
|
||||||
* are special and may also be found on attributes on communicators,
|
|
||||||
* datatypes, or windows.
|
|
||||||
*
|
|
||||||
* In general, these functions are intended to be used as follows:
|
|
||||||
*
|
|
||||||
* - Creating MCA parameters
|
|
||||||
* -# Register a parameter, get an index back
|
|
||||||
* - Using MCA parameters
|
|
||||||
* -# Lookup a "normal" parameter value on a specific index, or
|
|
||||||
* -# Lookup an attribute parameter on a specific index and
|
|
||||||
* communicator / datatype / window.
|
|
||||||
*
|
|
||||||
* MCA parameters can be defined in multiple different places. As
|
|
||||||
* such, parameters are \em resolved to find their value. The order
|
|
||||||
* of resolution is as follows:
|
|
||||||
*
|
|
||||||
* - An "override" location that is only available to be set via the
|
|
||||||
* mca_base_param API.
|
|
||||||
* - Look for an environment variable corresponding to the MCA
|
|
||||||
* parameter.
|
|
||||||
* - See if a file contains the MCA parameter (MCA parameter files are
|
|
||||||
* read only once -- when the first time any mca_param_t function is
|
|
||||||
* invoked).
|
|
||||||
* - If nothing else was found, use the parameter's default value.
|
|
||||||
*
|
|
||||||
* Note that there is a second header file (mca_base_param_internal.h)
|
|
||||||
* that contains several internal type delcarations for the parameter
|
|
||||||
* system. The internal file is only used within the parameter system
|
|
||||||
* itself; it should not be required by any other Open MPI entities.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OPAL_MCA_BASE_PARAM_H
|
|
||||||
#define OPAL_MCA_BASE_PARAM_H
|
|
||||||
|
|
||||||
#include "opal_config.h"
|
|
||||||
|
|
||||||
#include "opal/class/opal_list.h"
|
|
||||||
#include "opal/mca/mca.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The types of MCA parameters.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
/** The parameter is of type integer. */
|
|
||||||
MCA_BASE_PARAM_TYPE_INT,
|
|
||||||
/** The parameter is of type string. */
|
|
||||||
MCA_BASE_PARAM_TYPE_STRING,
|
|
||||||
|
|
||||||
/** Maximum parameter type. */
|
|
||||||
MCA_BASE_PARAM_TYPE_MAX
|
|
||||||
} mca_base_param_type_t;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Source of an MCA parameter's value
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
/** The default value */
|
|
||||||
MCA_BASE_PARAM_SOURCE_DEFAULT,
|
|
||||||
/** The value came from the environment (or command line!) */
|
|
||||||
MCA_BASE_PARAM_SOURCE_ENV,
|
|
||||||
/** The value came from a file */
|
|
||||||
MCA_BASE_PARAM_SOURCE_FILE,
|
|
||||||
/** The value came a "set" API call */
|
|
||||||
MCA_BASE_PARAM_SOURCE_OVERRIDE,
|
|
||||||
|
|
||||||
/** Maximum source type */
|
|
||||||
MCA_BASE_PARAM_SOURCE_MAX
|
|
||||||
} mca_base_param_source_t;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Struct for holding name/type info. Used in mca_base_param_dump(),
|
|
||||||
* below.
|
|
||||||
*/
|
|
||||||
struct mca_base_param_info_t {
|
|
||||||
/** So that we can be in a list */
|
|
||||||
opal_list_item_t super;
|
|
||||||
|
|
||||||
/** Index of this parameter */
|
|
||||||
int mbpp_index;
|
|
||||||
/** Enum indicating the back-end type of the parameter */
|
|
||||||
mca_base_param_type_t mbpp_type;
|
|
||||||
|
|
||||||
/** String name of the type of this component */
|
|
||||||
const char *mbpp_type_name;
|
|
||||||
/** String name of the component of the parameter */
|
|
||||||
const char *mbpp_component_name;
|
|
||||||
/** String name of the parameter of the parameter */
|
|
||||||
const char *mbpp_param_name;
|
|
||||||
/** Full, assembled parameter name */
|
|
||||||
const char *mbpp_full_name;
|
|
||||||
|
|
||||||
/** Is this parameter 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 parameter internal? */
|
|
||||||
bool mbpp_internal;
|
|
||||||
/** Is this parameter changable? */
|
|
||||||
bool mbpp_read_only;
|
|
||||||
/** Help message associated with this parameter */
|
|
||||||
const char *mbpp_help_msg;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* Convenience typedef
|
|
||||||
*/
|
|
||||||
typedef struct mca_base_param_info_t mca_base_param_info_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Global functions for MCA
|
|
||||||
*/
|
|
||||||
|
|
||||||
BEGIN_C_DECLS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a real object for the info
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_param_info_t);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the MCA parameter system.
|
|
||||||
*
|
|
||||||
* @retval OPAL_SUCCESS
|
|
||||||
*
|
|
||||||
* This function initalizes the MCA parameter system. It is
|
|
||||||
* invoked internally (by mca_base_open()) and is only documented
|
|
||||||
* here for completeness.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recache the MCA param files
|
|
||||||
*
|
|
||||||
* @param rel_path_search If a relative path is found, search the path even
|
|
||||||
* if the relative path in pointing to the current working directory.
|
|
||||||
* @retval OPAL_SUCCESS
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_recache_files(bool rel_path_search) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register an integer MCA parameter.
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* 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 OPAL_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 registers an integer MCA parameter and associates it
|
|
||||||
* with a specific component.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* If {internal} is set to true, this parameter is not 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.
|
|
||||||
*
|
|
||||||
* 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).
|
|
||||||
*
|
|
||||||
* 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}.
|
|
||||||
*/
|
|
||||||
OPAL_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) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 OPAL_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
|
|
||||||
* "btl": for parameters to the OMPI BTL framework
|
|
||||||
* ...etc.
|
|
||||||
*
|
|
||||||
* 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 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;
|
|
||||||
* parameters that have recongized types, although they can be
|
|
||||||
* used by the user, will not be displayed by ompi_info.
|
|
||||||
*
|
|
||||||
* Note that if you use mca_base_param_find() to lookup the index
|
|
||||||
* of the registered parameter, the "component" argument should be
|
|
||||||
* NULL (because it is not specified in this registration
|
|
||||||
* function, and is therefore registered with a NULL value).
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC 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) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a string MCA parameter.
|
|
||||||
*
|
|
||||||
* @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
|
|
||||||
* 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 OPAL_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.
|
|
||||||
*
|
|
||||||
* NOTE: Strings returned in the \em current_value parameter should later
|
|
||||||
* be free()'ed.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
OPAL_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) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 OPAL_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
|
|
||||||
* "btl": for parameters to the OMPI BTL framework
|
|
||||||
* ...etc.
|
|
||||||
*
|
|
||||||
* 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 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;
|
|
||||||
* parameters that have recongized types, although they can be
|
|
||||||
* used by the user, will not be displayed by ompi_info.
|
|
||||||
*
|
|
||||||
* Note that if you use mca_base_param_find() to lookup the index
|
|
||||||
* of the registered parameter, the "component" argument should be
|
|
||||||
* NULL (because it is not specified in this registration
|
|
||||||
* function, and is therefore registered with a NULL value).
|
|
||||||
*/
|
|
||||||
OPAL_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) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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) __opal_attribute_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) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deregister a MCA parameter
|
|
||||||
*
|
|
||||||
* @param index Index returned from mca_base_param_register_init()
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_deregister(int index) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look up an integer MCA parameter.
|
|
||||||
*
|
|
||||||
* @param index Index previous returned from
|
|
||||||
* mca_base_param_reg_int().
|
|
||||||
* @param value Pointer to int where the parameter value will be
|
|
||||||
* stored.
|
|
||||||
*
|
|
||||||
* @return OPAL_ERROR Upon failure. The contents of value are
|
|
||||||
* undefined.
|
|
||||||
* @return OPAL_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
|
|
||||||
* return value from mca_base_param_reg_int().
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_lookup_int(int index, int *value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look up a string MCA parameter.
|
|
||||||
*
|
|
||||||
* @param index Index previous returned from
|
|
||||||
* mca_base_param_reg_string().
|
|
||||||
* @param value Pointer to (char *) where the parameter value will be
|
|
||||||
* stored.
|
|
||||||
*
|
|
||||||
* @return OPAL_ERROR Upon failure. The contents of value are
|
|
||||||
* undefined.
|
|
||||||
* @return OPAL_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
|
|
||||||
* never be NULL. It will always have a value, even if that value is
|
|
||||||
* the empty string.
|
|
||||||
*
|
|
||||||
* Strings returned in the \em value parameter should later be
|
|
||||||
* free()'ed.
|
|
||||||
*
|
|
||||||
* The value of a specific MCA parameter can be looked up using the
|
|
||||||
* return value from mca_base_param_reg_string().
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_lookup_string(int index, char **value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lookup the source of an MCA parameter's value
|
|
||||||
*
|
|
||||||
* @param index [in] Index of MCA parameter to set
|
|
||||||
* @param source [out] Enum value indicating source
|
|
||||||
* @param source_file [out] If value came from source, name of the
|
|
||||||
* file that set it. The caller should not modify or free this
|
|
||||||
* string. It is permissable to specify source_file==NULL if the
|
|
||||||
* caller does not care to know the filename.
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
*
|
|
||||||
* This function looks up to see where the value of an MCA
|
|
||||||
* parameter came from.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_lookup_source(int index,
|
|
||||||
mca_base_param_source_t *source,
|
|
||||||
const char **source_file) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
*
|
|
||||||
* This function sets an integer value on the MCA parameter
|
|
||||||
* indicated by the index value index. This value will be used in
|
|
||||||
* lieu of any other value from any other MCA source (environment
|
|
||||||
* variable, file, etc.) until the value is unset with
|
|
||||||
* mca_base_param_unset().
|
|
||||||
*
|
|
||||||
* This function may be invoked multiple times; each time, the
|
|
||||||
* last "set" value is replaced with the newest value.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_set_int(int index, int value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
*
|
|
||||||
* This function sets a string value on the MCA parameter
|
|
||||||
* indicated by the index value index. This value will be used in
|
|
||||||
* lieu of any other value from any other MCA source (environment
|
|
||||||
* variable, file, etc.) until the value is unset with
|
|
||||||
* mca_base_param_unset().
|
|
||||||
*
|
|
||||||
* The string is copied by value; the string "value" parameter
|
|
||||||
* does not become "owned" by the parameter subsystem.
|
|
||||||
*
|
|
||||||
* This function may be invoked multiple times; each time, the
|
|
||||||
* last "set" value is replaced with the newest value (the old
|
|
||||||
* value is discarded).
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_set_string(int index, char *value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
*
|
|
||||||
* Resets previous value that was set (if any) on the given MCA
|
|
||||||
* parameter.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_unset(int index) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the string name corresponding to the MCA parameter
|
|
||||||
* value in the environment.
|
|
||||||
*
|
|
||||||
* @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.
|
|
||||||
* @retval NULL Upon failure.
|
|
||||||
*
|
|
||||||
* The string that is returned is owned by the caller; if
|
|
||||||
* appropriate, it must be eventually freed by the caller.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC char *mca_base_param_env_var(const char *param_name) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find the index for an MCA parameter based on its names.
|
|
||||||
*
|
|
||||||
* @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 OPAL_ERROR If the parameter was not found.
|
|
||||||
* @retval index If the parameter was found.
|
|
||||||
*
|
|
||||||
* It is not always convenient to widely propagate a parameter's index
|
|
||||||
* value, or it may be necessary to look up the parameter from a
|
|
||||||
* different component -- where it is not possible to have the return
|
|
||||||
* value from mca_base_param_reg_int() or mca_base_param_reg_string().
|
|
||||||
* This function can be used to look up the index of any registered
|
|
||||||
* parameter. The returned index can be used with
|
|
||||||
* mca_base_param_lookup_int() and mca_base_param_lookup_string().
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_find(const char *type,
|
|
||||||
const char *component,
|
|
||||||
const char *param) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find an MCA parameter in an env array based on its names.
|
|
||||||
*
|
|
||||||
* @param component [in] Pointer to the component for which the
|
|
||||||
* parameter was registered.
|
|
||||||
* @param param_name [in] The name of the parameter being
|
|
||||||
* registered (string).
|
|
||||||
* @param env [in] NULL-terminated list of strings (e.g., from an environment).
|
|
||||||
* @param current_value [out] Return the current value (if found).
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
*
|
|
||||||
* Look for a specific MCA parameter in an environment and return its value
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_find_int(const mca_base_component_t *component,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
int *current_value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find an MCA parameter (in an env array) 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 env [in] NULL-terminated list of strings (e.g., from an environment).
|
|
||||||
* @param current_value [out] Return the current value (if found).
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
*
|
|
||||||
* Look for a specific MCA parameter in an environment and return its value
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_find_int_name(const char *type,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
int *current_value) __opal_attribute_deprecated__;
|
|
||||||
/**
|
|
||||||
* Find a string MCA parameter in an env array based on its names.
|
|
||||||
*
|
|
||||||
* @param component [in] Pointer to the component for which the
|
|
||||||
* parameter was registered.
|
|
||||||
* @param param_name [in] The name of the parameter being
|
|
||||||
* registered (string).
|
|
||||||
* @param env [in] NULL-terminated list of strings (e.g., from an environment).
|
|
||||||
* @param current_value [out] Return the current value (if found).
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
*
|
|
||||||
* Look for a specific MCA parameter in an environment and return its value
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_find_string(const mca_base_component_t *component,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
char **current_value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find a string MCA parameter (in an env array) 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 env [in] NULL-terminated list of strings (e.g., from an environment).
|
|
||||||
* @param current_value [out] Return the current value (if found).
|
|
||||||
*
|
|
||||||
* @retval OPAL_ERROR If the parameter was not found.
|
|
||||||
*
|
|
||||||
* Look for a specific MCA parameter in an environment and return its value
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_find_string_name(const char *type,
|
|
||||||
const char *param_name,
|
|
||||||
char **env,
|
|
||||||
char **current_value) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that two MCA parameters were not both set to non-default
|
|
||||||
* values.
|
|
||||||
*
|
|
||||||
* @param type_a [in] Framework name of parameter A (string).
|
|
||||||
* @param component_a [in] Component name of parameter A (string).
|
|
||||||
* @param param_a [in] Parameter name of parameter A (string.
|
|
||||||
* @param type_b [in] Framework name of parameter A (string).
|
|
||||||
* @param component_b [in] Component name of parameter A (string).
|
|
||||||
* @param param_b [in] Parameter name of parameter A (string.
|
|
||||||
*
|
|
||||||
* This function is useful for checking that the user did not set both
|
|
||||||
* of 2 mutually-exclusive MCA parameters.
|
|
||||||
*
|
|
||||||
* This function will print an opal_show_help() message and return
|
|
||||||
* OPAL_ERR_BAD_PARAM if it finds that the two parameters both have
|
|
||||||
* value sources that are not MCA_BASE_PARAM_SOURCE_DEFAULT. This
|
|
||||||
* means that both parameters have been set by the user (i.e., they're
|
|
||||||
* not default values).
|
|
||||||
*
|
|
||||||
* Note that opal_show_help() allows itself to be hooked, so if this
|
|
||||||
* happens after the aggregated orte_show_help() system is
|
|
||||||
* initialized, the messages will be aggregated (w00t).
|
|
||||||
*
|
|
||||||
* @returns OPAL_ERR_BAD_PARAM if the two parameters have sources that
|
|
||||||
* are not MCA_BASE_PARAM_SOURCE_DEFAULT.
|
|
||||||
* @returns OPAL_SUCCESS otherwise.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_check_exclusive_string(const char *type_a,
|
|
||||||
const char *component_a,
|
|
||||||
const char *param_a,
|
|
||||||
const char *type_b,
|
|
||||||
const char *component_b,
|
|
||||||
const char *param_b) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the "internal" flag on an MCA parameter to true or false.
|
|
||||||
*
|
|
||||||
* @param index [in] Index previous returned from
|
|
||||||
* mca_base_param_reg_string() or mca_base_param_reg_int().
|
|
||||||
* @param internal [in] Boolean indicating whether the MCA
|
|
||||||
* parameter is internal (private) or public.
|
|
||||||
*
|
|
||||||
* @returns OPAL_SUCCESS If it can find the parameter to reset
|
|
||||||
* @returns OPAL_ERROR Otherwise
|
|
||||||
*
|
|
||||||
* "Internal" MCA parameters are ones that are not intentended to
|
|
||||||
* be seen or modified by users or user applications. These
|
|
||||||
* include values that are set at run time, such as TCP ports, IP
|
|
||||||
* addresses, etc. By setting the "internal" flag, internal MCA
|
|
||||||
* parameters are not displayed during the output of ompi_info and
|
|
||||||
* MPI_INIT (at least, they're not displayed by default), thus
|
|
||||||
* keeping them away from prying user eyes.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_set_internal(int index, bool internal) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* instances.
|
|
||||||
* @param internal [in] Whether to include the internal parameters
|
|
||||||
* or not.
|
|
||||||
*
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
* @retval OPAL_ERROR Upon failure.
|
|
||||||
*
|
|
||||||
* This function is used to obtain a list of all the currently
|
|
||||||
* registered MCA parameters along with their associated types
|
|
||||||
* (currently: string or integer). The results from this function
|
|
||||||
* can be used to repeatedly invoke mca_base_param_lookup_int()
|
|
||||||
* and/or mca_base_param_lookup_string() to obtain a comprehensive
|
|
||||||
* list of all MCA parameters and their current values.
|
|
||||||
*
|
|
||||||
* Releasing the list, and all the items in the list, is a
|
|
||||||
* relatively complicated process. Use the companion function
|
|
||||||
* mca_base_param_dump_release() when finished with the returned
|
|
||||||
* info list to release all associated memory.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_dump(opal_list_t **info, bool internal) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* strings, suitable for use in an environment
|
|
||||||
* @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
|
|
||||||
* or not.
|
|
||||||
*
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
* @retval OPAL_ERROR Upon failure.
|
|
||||||
*
|
|
||||||
* This function is similar to mca_base_param_dump() except that
|
|
||||||
* its output is in terms of an argv-style array of key=value
|
|
||||||
* strings, suitable for using in an environment.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_build_env(char ***env, int *num_env,
|
|
||||||
bool internal) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
* mca_base_param_dump().
|
|
||||||
*
|
|
||||||
* @retval OPAL_SUCCESS Upon success.
|
|
||||||
* @retval OPAL_ERROR Upon failure.
|
|
||||||
*
|
|
||||||
* This function is intended to be used to free the info list
|
|
||||||
* returned from mca_base_param_dump(). There are a bunch of
|
|
||||||
* strings and other associated memory in the list making it
|
|
||||||
* cumbersome for the caller to free it all properly. Hence, once
|
|
||||||
* the caller is finished with the info list, invoke this
|
|
||||||
* function and all memory associated with the list will be freed.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_dump_release(opal_list_t *info) __opal_attribute_deprecated__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shut down the MCA parameter system (normally only invoked by the
|
|
||||||
* MCA framework itself).
|
|
||||||
*
|
|
||||||
* @returns OPAL_SUCCESS This function never fails.
|
|
||||||
*
|
|
||||||
* This function shuts down the MCA parameter repository and frees all
|
|
||||||
* associated memory. No other mca_base_param*() functions can be
|
|
||||||
* invoked after this function.
|
|
||||||
*
|
|
||||||
* This function is normally only invoked by the MCA framework itself
|
|
||||||
* when the process is shutting down (e.g., during MPI_FINALIZE). It
|
|
||||||
* is only documented here for completeness.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_param_finalize(void);
|
|
||||||
|
|
||||||
END_C_DECLS
|
|
||||||
|
|
||||||
#endif /* OPAL_MCA_BASE_PARAM_H */
|
|
@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
||||||
* University Research and Technology
|
|
||||||
* Corporation. All rights reserved.
|
|
||||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
|
||||||
* of Tennessee Research Foundation. 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 (c) 2008 Cisco Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
|
|
||||||
* reserved.
|
|
||||||
* $COPYRIGHT$
|
|
||||||
*
|
|
||||||
* Additional copyrights may follow
|
|
||||||
*
|
|
||||||
* $HEADER$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
*
|
|
||||||
* This is the private declarations for the MCA parameter system.
|
|
||||||
* This file is internal to the MCA parameter system and should not
|
|
||||||
* need to be used by any other elements in Open MPI except the
|
|
||||||
* special case of the ompi_info command.
|
|
||||||
*
|
|
||||||
* All the rest of the doxygen documentation in this file is marked as
|
|
||||||
* "internal" and won't show up unless you specifically tell doxygen
|
|
||||||
* to generate internal documentation (by default, it is skipped).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OPAL_MCA_BASE_PARAM_INTERNAL_H
|
|
||||||
#define OPAL_MCA_BASE_PARAM_INTERNAL_H
|
|
||||||
|
|
||||||
#include "opal_config.h"
|
|
||||||
|
|
||||||
#include "opal/class/opal_object.h"
|
|
||||||
#include "opal/class/opal_list.h"
|
|
||||||
#include "opal/class/opal_value_array.h"
|
|
||||||
#include "opal/mca/base/mca_base_param.h"
|
|
||||||
#include "opal/mca/base/mca_base_var.h"
|
|
||||||
|
|
||||||
BEGIN_C_DECLS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Types for MCA parameters.
|
|
||||||
*/
|
|
||||||
typedef union {
|
|
||||||
/** Integer value */
|
|
||||||
int intval;
|
|
||||||
/** String value */
|
|
||||||
char *stringval;
|
|
||||||
} mca_base_param_storage_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Entry for holding the information about an MCA parameter and its
|
|
||||||
* default value.
|
|
||||||
*/
|
|
||||||
struct mca_base_param_t {
|
|
||||||
/** Allow this to be an OPAL OBJ */
|
|
||||||
opal_object_t super;
|
|
||||||
|
|
||||||
/* Backing store for the variable value */
|
|
||||||
mca_base_param_storage_t *param_value;
|
|
||||||
|
|
||||||
/* For debugging purposes */
|
|
||||||
int var_index;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Convenience typedef.
|
|
||||||
*/
|
|
||||||
typedef struct mca_base_param_t mca_base_param_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Object delcataion for mca_base_param_t
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_param_t);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Global list of params and values read in from MCA parameter files
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC extern opal_list_t mca_base_param_file_values;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \internal
|
|
||||||
*
|
|
||||||
* Parse a parameter file.
|
|
||||||
*/
|
|
||||||
OPAL_DECLSPEC int mca_base_parse_paramfile(const char *paramfile, opal_list_t *list);
|
|
||||||
|
|
||||||
END_C_DECLS
|
|
||||||
|
|
||||||
#endif /* OPAL_MCA_BASE_PARAM_INTERNAL_H */
|
|
@ -10,7 +10,7 @@
|
|||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
|
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
|
||||||
* Copyright (c) 2010-2012 Los Alamos National Security, LLC.
|
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -74,7 +74,7 @@ opal_finalize_util(void)
|
|||||||
(void) mca_base_framework_close(&opal_if_base_framework);
|
(void) mca_base_framework_close(&opal_if_base_framework);
|
||||||
|
|
||||||
/* Clear out all the registered MCA params */
|
/* Clear out all the registered MCA params */
|
||||||
mca_base_param_finalize();
|
mca_base_var_finalize();
|
||||||
|
|
||||||
opal_net_finalize();
|
opal_net_finalize();
|
||||||
|
|
||||||
|
@ -286,8 +286,8 @@ opal_init_util(int* pargc, char*** pargv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the parameter system */
|
/* Setup the parameter system */
|
||||||
if (OPAL_SUCCESS != (ret = mca_base_param_init())) {
|
if (OPAL_SUCCESS != (ret = mca_base_var_init())) {
|
||||||
error = "mca_base_param_init";
|
error = "mca_base_var_init";
|
||||||
goto return_error;
|
goto return_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user