1
1

- Add new MCA param: component_show_load_errors. Setting this param

to != 0 makes the MCA base display errors when it fails to load or
  open() a component (normally, such errors cause the MCA base to
  silently ignore the component).  Enabling this can be helpful to
  developers instead of turning on the massively-huge-output "verbose"
  param. 
- Add prefixes to the "verbose" output to make it more easily grep-able.

This commit was SVN r3157.
Этот коммит содержится в:
Jeff Squyres 2004-10-15 10:54:39 +00:00
родитель 6669e44107
Коммит fceb5c122f
3 изменённых файлов: 72 добавлений и 35 удалений

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

@ -148,12 +148,12 @@ static void find_dyn_components(const char *path, const char *type_name,
if (NULL == name) {
params.name[0] = '\0';
ompi_output_verbose(40, 0, " looking for all dynamic %s MCA components",
ompi_output_verbose(40, 0, "mca: base: component_find: looking for all dynamic %s MCA components",
type_name, NULL);
} else {
strcpy(params.name, name);
ompi_output_verbose(40, 0,
" looking for dynamic %s MCA component named \"%s\"",
"mca: base: component_find: looking for dynamic %s MCA component named \"%s\"",
type_name, name, NULL);
}
@ -296,23 +296,25 @@ static int save_filename(const char *filename, lt_ptr data)
static int open_component(component_file_item_t *target_file,
ompi_list_t *found_components)
{
int len;
int len, show_errors, param;
lt_dlhandle component_handle;
mca_base_component_t *component_struct;
char *struct_name;
char *struct_name, *err;
ompi_list_t dependencies;
ompi_list_item_t *cur;
mca_base_component_list_item_t *mitem;
dependency_item_t *ditem;
ompi_output_verbose(40, 0, " examining dyanmic %s MCA component \"%s\"",
ompi_output_verbose(40, 0, "mca: base: component_find: examining dyanmic %s MCA component \"%s\"",
target_file->type, target_file->name, NULL);
ompi_output_verbose(40, 0, " %s", target_file->filename, NULL);
ompi_output_verbose(40, 0, "mca: base: component_find: %s", target_file->filename, NULL);
param = mca_base_param_find("base", NULL, "component_show_load_errors");
mca_base_param_lookup_int(param, &show_errors);
/* Was this component already loaded (e.g., via dependency)? */
if (LOADED == target_file->status) {
ompi_output_verbose(40, 0, " already loaded (ignored)", NULL);
ompi_output_verbose(40, 0, "mca: base: component_find: already loaded (ignored)", NULL);
return OMPI_SUCCESS;
}
@ -328,7 +330,7 @@ static int open_component(component_file_item_t *target_file,
mitem = (mca_base_component_list_item_t *) cur;
if (0 == strcmp(mitem->cli_component->mca_type_name, target_file->type) &&
0 == strcmp(mitem->cli_component->mca_component_name, target_file->name)) {
ompi_output_verbose(40, 0, " already loaded (ignored)", NULL);
ompi_output_verbose(40, 0, "mca: base: component_find: already loaded (ignored)", NULL);
target_file->status = FAILED_TO_LOAD;
return OMPI_ERR_BAD_PARAM;
}
@ -349,8 +351,13 @@ static int open_component(component_file_item_t *target_file,
component_handle = lt_dlopenext(target_file->filename);
if (NULL == component_handle) {
ompi_output_verbose(40, 0, " unable to open: %s (ignored)",
lt_dlerror(), NULL);
err = strdup(lt_dlerror());
if (0 != show_errors) {
ompi_output(0, "mca: base: component_find: unable to open: %s (ignored)", err);
}
ompi_output_verbose(40, 0, "mca: base: component_find: unable to open: %s (ignored)",
err, NULL);
free(err);
target_file->status = FAILED_TO_LOAD;
free_dependency_list(&dependencies);
return OMPI_ERR_BAD_PARAM;
@ -381,7 +388,12 @@ static int open_component(component_file_item_t *target_file,
component_struct = lt_dlsym(component_handle, struct_name);
if (NULL == component_struct) {
ompi_output_verbose(40, 0, " \"%s\" does not appear to be a valid "
if (0 != show_errors) {
ompi_output(0, "mca: base: component_find: \"%s\" does not appear to be a valid "
"%s MCA dynamic component (ignored)",
target_file->basename, target_file->type, NULL);
}
ompi_output_verbose(40, 0, "mca: base: component_find: \"%s\" does not appear to be a valid "
"%s MCA dynamic component (ignored)",
target_file->basename, target_file->type, NULL);
free(mitem);
@ -415,7 +427,7 @@ static int open_component(component_file_item_t *target_file,
}
OBJ_DESTRUCT(&dependencies);
ompi_output_verbose(40, 0, " opened dynamic %s MCA component \"%s\"",
ompi_output_verbose(40, 0, "mca: base: component_find: opened dynamic %s MCA component \"%s\"",
target_file->type, target_file->name, NULL);
target_file->status = LOADED;
@ -434,7 +446,8 @@ static int open_component(component_file_item_t *target_file,
* Detect dependency cycles and error out.
*/
static int check_ompi_info(component_file_item_t *target_file,
ompi_list_t *dependencies, ompi_list_t *found_components)
ompi_list_t *dependencies,
ompi_list_t *found_components)
{
int len;
FILE *fp;
@ -461,7 +474,7 @@ static int check_ompi_info(component_file_item_t *target_file,
them. Return failure upon the first component that fails to
load. */
ompi_output_verbose(40, 0, " opening ompi_info file: %s", depname, NULL);
ompi_output_verbose(40, 0, "mca: base: component_find: opening ompi_info file: %s", depname, NULL);
while (NULL != fgets(buffer, BUFSIZ, fp)) {
/* Perl chomp */
@ -503,7 +516,7 @@ static int check_ompi_info(component_file_item_t *target_file,
}
}
}
ompi_output_verbose(40, 0, " ompi_info file closed (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: ompi_info file closed (%s)",
target_file->basename, NULL);
/* All done -- all depenencies satisfied */
@ -568,7 +581,7 @@ static int check_dependency(char *line, component_file_item_t *target_file,
else if (mitem == target_file) {
ompi_output_verbose(40, 0,
" component depends on itself (ignored dependency)",
"mca: base: component_find: component depends on itself (ignored dependency)",
NULL);
happiness = true;
break;
@ -578,7 +591,7 @@ static int check_dependency(char *line, component_file_item_t *target_file,
dependency sub-tree) */
else if (LOADED == mitem->status) {
ompi_output_verbose(40, 0, " dependency has already been loaded (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: dependency has already been loaded (%s)",
mitem->basename, NULL);
happiness = true;
break;
@ -589,7 +602,7 @@ static int check_dependency(char *line, component_file_item_t *target_file,
dependencies. */
else if (FAILED_TO_LOAD == mitem->status) {
ompi_output_verbose(40, 0, " dependency previously failed to load (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: dependency previously failed to load (%s)",
mitem->basename, NULL);
break;
}
@ -597,7 +610,7 @@ static int check_dependency(char *line, component_file_item_t *target_file,
/* If we hit a cycle, return badness */
else if (CHECKING_CYCLE == mitem->status) {
ompi_output_verbose(40, 0, " found cycle! (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: found cycle! (%s)",
mitem->basename, NULL);
break;
}
@ -606,12 +619,12 @@ static int check_dependency(char *line, component_file_item_t *target_file,
to load it. */
else if (UNVISITED == mitem->status) {
ompi_output_verbose(40, 0, " loading dependency (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: loading dependency (%s)",
mitem->basename, NULL);
if (OMPI_SUCCESS == open_component(target_file, found_components)) {
happiness = true;
} else {
ompi_output_verbose(40, 0, " dependency failed to load (%s)",
ompi_output_verbose(40, 0, "mca: base: component_find: dependency failed to load (%s)",
mitem->basename, NULL);
}
break;

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

@ -24,6 +24,12 @@ struct component_name_t {
typedef struct component_name_t component_name_t;
/*
* Local variables
*/
static bool show_errors = false;
/*
* Local functions
*/
@ -42,7 +48,7 @@ int mca_base_components_open(const char *type_name, int output_id,
const mca_base_component_t **static_components,
ompi_list_t *components_available)
{
int ret;
int ret, param;
ompi_list_item_t *item;
ompi_list_t components_found;
char **requested_component_names;
@ -57,13 +63,18 @@ int mca_base_components_open(const char *type_name, int output_id,
param_type = mca_base_param_register_string(type_name, "base", NULL,
type_name, NULL);
param = mca_base_param_find("base", NULL, "component_show_load_errors");
mca_base_param_lookup_int(param, &ret);
show_errors = (0 != ret) ? true : false;
/* Setup verbosity for this MCA type */
mca_base_param_lookup_int(param_verbose, &verbose_level);
if (output_id != 0) {
ompi_output_set_verbosity(output_id, verbose_level);
}
ompi_output_verbose(10, output_id, "mca: base: open: Looking for components");
ompi_output_verbose(10, output_id,
"mca: base: components_open: Looking for components");
/* Find and load all available components */
@ -144,14 +155,14 @@ static int open_components(const char *type_name, int output_id,
if (NULL == requested_component_names) {
ompi_output_verbose(10, output_id,
"mca: base: open: "
"mca: base: components_open: "
"looking for any %s components", type_name);
} else {
ompi_output_verbose(10, output_id,
"mca: base: open: looking for specific %s components:",
"mca: base: components_open: looking for specific %s components:",
type_name);
for (i = 0; NULL != requested_component_names[i]; ++i) {
ompi_output_verbose(10, output_id, "mca: base: open: %s",
ompi_output_verbose(10, output_id, "mca: base: components_open: %s",
requested_component_names[i]);
}
}
@ -185,13 +196,13 @@ static int open_components(const char *type_name, int output_id,
if (acceptable) {
opened = called_open = false;
ompi_output_verbose(10, output_id,
"mca: base: open: found loaded component %s",
"mca: base: components_open: found loaded component %s",
component->mca_component_name);
if (NULL == component->mca_open_component) {
opened = true;
ompi_output_verbose(10, output_id,
"mca: base: open: "
"mca: base: components_open: "
"component %s has no open function",
component->mca_component_name);
} else {
@ -199,14 +210,24 @@ static int open_components(const char *type_name, int output_id,
if (MCA_SUCCESS == component->mca_open_component()) {
opened = true;
ompi_output_verbose(10, output_id,
"mca: base: open: "
"mca: base: components_open: "
"component %s open function successful",
component->mca_component_name);
} else {
ompi_output_verbose(10, output_id,
"mca: base: open: "
"component %s open function failed",
component->mca_component_name);
/* We may end up displaying this twice, but it may go to
separate streams. So better to be redundant than to
not display the error in the stream where it was
expected. */
if (show_errors) {
ompi_output(0, "mca: base: components_open: "
"component %s open function failed",
component->mca_component_name);
}
ompi_output_verbose(10, output_id,
"mca: base: components_open: "
"component %s open function failed",
component->mca_component_name);
}
}
@ -218,13 +239,13 @@ static int open_components(const char *type_name, int output_id,
component->mca_close_component();
}
ompi_output_verbose(10, output_id,
"mca: base: open: component %s closed",
"mca: base: components_open: component %s closed",
component->mca_component_name);
called_open = false;
}
mca_base_component_repository_release(component);
ompi_output_verbose(10, output_id,
"mca: base: open: component %s unloaded",
"mca: base: components_open: component %s unloaded",
component->mca_component_name);
}

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

@ -56,6 +56,9 @@ int mca_base_open(void)
param_index = mca_base_param_register_string("base", NULL, "verbose",
"verbose", NULL);
mca_base_param_register_int("base", NULL, "component_show_load_errors",
"component_show_load_errors", 0);
/* What verbosity level do we want? */
mca_base_param_lookup_string(param_index, &value);