1
1

Remove all the keyval stuff from the MCA parameter functionality. The

meat of it was commented out long ago, anyway (because of the way it
was written, it violates OPAL<->OMPI abstraction barriers); we never
ended up using the MPI keyval MCA parameter stuff.  So just delete it.

This commit was SVN r18860.
Этот коммит содержится в:
Jeff Squyres 2008-07-10 01:52:51 +00:00
родитель 49be4b1e45
Коммит 7b2612696c
3 изменённых файлов: 1 добавлений и 207 удалений

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

@ -35,11 +35,6 @@
#include "opal/class/opal_value_array.h" #include "opal/class/opal_value_array.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/class/opal_hash_table.h" #include "opal/class/opal_hash_table.h"
#if 0
/* JMS commented out for now -- see lookup_keyvals() below for an
explanation */
#include "ompi/attribute/attribute.h"
#endif
#include "opal/util/printf.h" #include "opal/util/printf.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/mca/mca.h" #include "opal/mca/mca.h"
@ -124,9 +119,6 @@ static bool param_set_override(size_t index,
mca_base_param_type_t type); mca_base_param_type_t type);
static bool lookup_override(mca_base_param_t *param, static bool lookup_override(mca_base_param_t *param,
mca_base_param_storage_t *storage); mca_base_param_storage_t *storage);
static bool lookup_keyvals(mca_base_param_t *param,
mca_base_param_storage_t *storage,
opal_hash_table_t *attrs);
static bool lookup_env(mca_base_param_t *param, static bool lookup_env(mca_base_param_t *param,
mca_base_param_storage_t *storage); mca_base_param_storage_t *storage);
static bool lookup_file(mca_base_param_t *param, static bool lookup_file(mca_base_param_t *param,
@ -481,36 +473,6 @@ int mca_base_param_reg_syn_name(int index_orig,
syn_param_name, deprecated); syn_param_name, deprecated);
} }
/*
* Associate a keyval with a parameter index
*/
int mca_base_param_kv_associate(int index, int keyval)
{
size_t len;
mca_base_param_t *array;
if (!initialized) {
return OPAL_ERROR;
}
len = opal_value_array_get_size(&mca_base_params);
if (((size_t) index) > len) {
return OPAL_ERROR;
}
/* We have a valid entry (remember that we never delete MCA
parameters, so if the index is >0 and <len, it must be good), so
save the keyval */
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
array[index].mbp_keyval = keyval;
/* All done */
return OPAL_SUCCESS;
}
/* /*
* Look up an integer MCA parameter. * Look up an integer MCA parameter.
*/ */
@ -526,22 +488,6 @@ int mca_base_param_lookup_int(int index, int *value)
} }
/*
* Look up an integer MCA parameter, including in attributes
*/
int mca_base_param_kv_lookup_int(int index, opal_hash_table_t *attrs,
int *value)
{
mca_base_param_storage_t storage;
if (param_lookup(index, &storage, attrs, NULL)) {
*value = storage.intval;
return OPAL_SUCCESS;
}
return OPAL_ERROR;
}
/* /*
* Set an integer parameter * Set an integer parameter
*/ */
@ -571,22 +517,6 @@ int mca_base_param_lookup_string(int index, char **value)
} }
/*
* Look up a string MCA parameter, including in attributes.
*/
int mca_base_param_kv_lookup_string(int index, opal_hash_table_t *attrs,
char **value)
{
mca_base_param_storage_t storage;
if (param_lookup(index, &storage, attrs, NULL)) {
*value = storage.stringval;
return OPAL_SUCCESS;
}
return OPAL_ERROR;
}
/* /*
* Set an string parameter * Set an string parameter
*/ */
@ -1303,12 +1233,10 @@ static int param_register(const char *type_name,
mca_base_param_init(); mca_base_param_init();
} }
/* Create a parameter entry. If a keyval is to be used, it will be /* Create a parameter entry */
registered elsewhere. We simply assign -1 here. */
OBJ_CONSTRUCT(&param, mca_base_param_t); OBJ_CONSTRUCT(&param, mca_base_param_t);
param.mbp_type = type; param.mbp_type = type;
param.mbp_keyval = -1;
param.mbp_internal = internal; param.mbp_internal = internal;
param.mbp_read_only = read_only; param.mbp_read_only = read_only;
if (NULL != help_msg) { if (NULL != help_msg) {
@ -1793,7 +1721,6 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
if (array[index].mbp_read_only) { if (array[index].mbp_read_only) {
if (lookup_override(&array[index], storage) || if (lookup_override(&array[index], storage) ||
lookup_keyvals(&array[index], storage, attrs) ||
lookup_env(&array[index], storage) || lookup_env(&array[index], storage) ||
lookup_file(&array[index], storage)) { lookup_file(&array[index], storage)) {
opal_show_help("help-mca-param.txt", "read-only-param-set", opal_show_help("help-mca-param.txt", "read-only-param-set",
@ -1807,8 +1734,6 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
} else { } else {
if (lookup_override(&array[index], storage)) { if (lookup_override(&array[index], storage)) {
source = MCA_BASE_PARAM_SOURCE_OVERRIDE; source = MCA_BASE_PARAM_SOURCE_OVERRIDE;
} else if (lookup_keyvals(&array[index], storage, attrs)) {
source = MCA_BASE_PARAM_SOURCE_KEYVAL;
} else if (lookup_env(&array[index], storage)) { } else if (lookup_env(&array[index], storage)) {
source = MCA_BASE_PARAM_SOURCE_ENV; source = MCA_BASE_PARAM_SOURCE_ENV;
} else if (lookup_file(&array[index], storage)) { } else if (lookup_file(&array[index], storage)) {
@ -1882,57 +1807,6 @@ static bool lookup_override(mca_base_param_t *param,
} }
/*
* Lookup a param in the set of attributes/keyvals
*/
static bool lookup_keyvals(mca_base_param_t *param,
mca_base_param_storage_t *storage,
opal_hash_table_t *attrs)
{
#if 1
/* JMS: Comment this out for now, because it drags in all of
libmpi. This is undesirable for programs like mpirun, etc.
Need a better solution for this -- perhaps a registration kind
of thing...? */
return false;
#else
int err, flag;
/* If this param has a keyval and we were provided with a hash
table, look it up and see if we can find a value */
if (-1 != param->mbp_keyval) {
/* Use the stringval member of the union because it's definitely
big enough to handle both (int) and (char*) */
err = ompi_attr_get(attrs, param->mbp_keyval,
&storage->stringval, &flag);
if (OPAL_SUCCESS == err && 1 == flag) {
/* Because of alignment weirdness between (void*) and int, we
must grab the lower sizeof(int) bytes from the (char*) in
stringval, in case sizeof(int) != sizeof(char*). */
if (MCA_BASE_PARAM_TYPE_INT == param->mbp_type) {
storage->intval = *((int *) (storage->stringval +
sizeof(void *) - sizeof(int)));
}
/* Nothing to do for string -- we already have the value loaded
in the right place */
return true;
}
}
/* Either this param has not keyval or we didn't find the keyval */
return false;
#endif
}
/* /*
* Lookup a param in the environment * Lookup a param in the environment
*/ */
@ -2150,7 +2024,6 @@ static void param_constructor(mca_base_param_t *p)
p->mbp_full_name = NULL; p->mbp_full_name = NULL;
p->mbp_help_msg = NULL; p->mbp_help_msg = NULL;
p->mbp_keyval = -1;
p->mbp_env_var_name = NULL; p->mbp_env_var_name = NULL;
p->mbp_default_value.stringval = NULL; p->mbp_default_value.stringval = NULL;

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

@ -29,7 +29,6 @@
* *
* - Creating MCA parameters * - Creating MCA parameters
* -# Register a parameter, get an index back * -# Register a parameter, get an index back
* -# Optionally associate that index with an attribute keyval
* - Using MCA parameters * - Using MCA parameters
* -# Lookup a "normal" parameter value on a specific index, or * -# Lookup a "normal" parameter value on a specific index, or
* -# Lookup an attribute parameter on a specific index and * -# Lookup an attribute parameter on a specific index and
@ -41,8 +40,6 @@
* *
* - An "override" location that is only available to be set via the * - An "override" location that is only available to be set via the
* mca_base_param API. * mca_base_param API.
* - If the parameter has an MPI attribute keyval associated with it,
* see if there is a value assigned that can be used.
* - Look for an environment variable corresponding to the MCA * - Look for an environment variable corresponding to the MCA
* parameter. * parameter.
* - See if a file contains the MCA parameter (MCA parameter files are * - See if a file contains the MCA parameter (MCA parameter files are
@ -91,8 +88,6 @@ typedef enum {
MCA_BASE_PARAM_SOURCE_ENV, MCA_BASE_PARAM_SOURCE_ENV,
/** The value came from a file */ /** The value came from a file */
MCA_BASE_PARAM_SOURCE_FILE, MCA_BASE_PARAM_SOURCE_FILE,
/** The value came from a keyval */
MCA_BASE_PARAM_SOURCE_KEYVAL,
/** The value came a "set" API call */ /** The value came a "set" API call */
MCA_BASE_PARAM_SOURCE_OVERRIDE, MCA_BASE_PARAM_SOURCE_OVERRIDE,
@ -473,31 +468,6 @@ extern "C" {
const char *syn_param_name, const char *syn_param_name,
bool deprecated); bool deprecated);
/**
* Associate a communicator/datatype/window keyval with an MCA
* parameter.
*
* @param index The index of the parameter to use.
* @param keyval The keyval to associate it with.
*
* @returns OPAL_SUCCESS Upon success.
* @returns OPAL_ERROR If the index value is invalid.
*
* For an index value that was previously returned by
* mca_base_param_register_int() or
* mca_base_param_register_string(), the corresponding MCA parameter
* can be associated with a communicator, datatype, or window
* attribute keyval.
*
* After using this function, you can use any of the four lookup
* functions (mca_base_param_lookup_int(),
* mca_base_param_lookup_string(), mca_base_param_kv_lookup_int(),
* and mca_base_param_kv_lookup_string()), but only the "kv"
* versions will cross reference and attempt to find parameter
* values on attributes.
*/
OPAL_DECLSPEC int mca_base_param_kv_associate(int index, int keyval);
/** /**
* Look up an integer MCA parameter. * Look up an integer MCA parameter.
* *
@ -516,30 +486,6 @@ extern "C" {
*/ */
OPAL_DECLSPEC int mca_base_param_lookup_int(int index, int *value); OPAL_DECLSPEC int mca_base_param_lookup_int(int index, int *value);
/**
* Look up an integer MCA parameter, to include looking in
* attributes.
*
* @param index Index previous returned from
* mca_base_param_register_int().
* @param attrs Object containing attributes to be searched.
* @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.
*
* This function is identical to mca_base_param_lookup_int() except
* that it looks in attributes \em first to find the parameter
* value. The function mca_base_param_kv_associate() must have been
* called first to associate a keyval with the index.
*/
OPAL_DECLSPEC int mca_base_param_kv_lookup_int(int index,
struct opal_hash_table_t *attrs,
int *value);
/** /**
* Look up a string MCA parameter. * Look up a string MCA parameter.
* *
@ -565,29 +511,6 @@ extern "C" {
*/ */
OPAL_DECLSPEC int mca_base_param_lookup_string(int index, char **value); OPAL_DECLSPEC int mca_base_param_lookup_string(int index, char **value);
/**
* Look up a string MCA parameter, to include looking in attributes.
*
* @param index [in] Index previous returned from
* mca_base_param_register_string().
* @param attrs [in] Object containing attributes to be searched.
* @param value [out] 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.
*
* This function is identical to mca_base_param_lookup_string()
* except that it looks in attributes \em first to find the
* parameter value. The function mca_base_param_kv_associate() must
* have been called first to associate a keyval with the index.
*/
OPAL_DECLSPEC int mca_base_param_kv_lookup_string(int index,
struct opal_hash_table_t *attrs,
char **value);
/** /**
* Lookup the source of an MCA parameter's value * Lookup the source of an MCA parameter's value
* *

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

@ -104,8 +104,6 @@ struct mca_base_param_t {
/** Help message associated with this parameter */ /** Help message associated with this parameter */
char *mbp_help_msg; char *mbp_help_msg;
/** Keyval value for MPI attribute parameters */
int mbp_keyval;
/** Environment variable name */ /** Environment variable name */
char *mbp_env_var_name; char *mbp_env_var_name;