2013-03-28 01:10:18 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2004-08-02 04:24:22 +04:00
|
|
|
/*
|
2008-06-25 18:55:09 +04:00
|
|
|
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2013-03-26 18:34:29 +04:00
|
|
|
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
Refs trac:3275.
We ran into a case where the OMPI SVN trunk grew a new acceptable MCA
parameter value, but this new value was not accepted on the v1.6
branch (hwloc_base_mem_bind_failure_action -- on the trunk it accepts
the value "silent", but on the older v1.6 branch, it doesn't). If you
set "hwloc_base_mem_bind_failure_action=silent" in the default MCA
params file and then accidentally ran with the v1.6 branch, every OMPI
executable (including ompi_info) just failed because hwloc_base_open()
would say "hey, 'silent' is not a valid value for
hwloc_base_mem_bind_failure_action!". Kaboom.
The only problem is that it didn't give you any indication of where
this value was being set. Quite maddening, from a user perspective.
So we changed the ompi_info handles this case. If any framework open
function return OMPI_ERR_BAD_PARAM (either because its base MCA params
got a bad value or because one of its component register/open
functions return OMPI_ERR_BAD_PARAM), ompi_info will stop, print out
a warning that it received and error, and then dump out the parameters
that it has received so far in the framework that had a problem.
At a minimum, this will show the user the MCA param that had an error
(it's usually the last one), and ''where it was set from'' (so that
they can go fix it).
We updated ompi_info to check for O???_ERR_BAD_PARAM from each from
the framework opens. Also updated the doxygen docs in mca.h for this
O???_BAD_PARAM behavior. And we noticed that mca.h had MCA_SUCCESS
and MCA_ERR_??? codes. Why? I think we used them in exactly one
place in the code base (mca_base_components_open.c). So we deleted
those and just used the normal OPAL_* codes instead.
While we were doing this, we also cleaned up a little memory
management during ompi_info/orte-info/opal-info finalization.
Valgrind still reports a truckload of memory still in use at ompi_info
termination, but they mostly look to be components not freeing
memory/resources properly (and outside the scope of this fix).
This commit was SVN r27306.
The following Trac tickets were found above:
Ticket 3275 --> https://svn.open-mpi.org/trac/ompi/ticket/3275
2012-09-12 00:47:24 +04:00
|
|
|
* Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved.
|
2013-03-28 01:10:18 +04:00
|
|
|
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
2012-04-06 18:23:13 +04:00
|
|
|
* All rights reserved.
|
2014-03-04 20:14:46 +04:00
|
|
|
* Copyright (c) 2014 Hochschule Esslingen. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-08-02 04:24:22 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2004-08-02 04:24:22 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-08-13 00:46:25 +04:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2014-03-04 20:14:46 +04:00
|
|
|
#if OPAL_ENABLE_FT_CR == 1
|
|
|
|
#include "opal/runtime/opal_params.h"
|
|
|
|
#endif
|
2004-08-02 04:24:22 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2013-03-28 01:10:18 +04:00
|
|
|
static int open_components(mca_base_framework_t *framework);
|
|
|
|
|
|
|
|
struct mca_base_dummy_framework_list_item_t {
|
|
|
|
opal_list_item_t super;
|
|
|
|
mca_base_framework_t framework;
|
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components, or the
|
|
|
|
* one that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
2013-03-28 01:10:18 +04:00
|
|
|
int mca_base_framework_components_open (mca_base_framework_t *framework,
|
|
|
|
mca_base_open_flag_t flags)
|
2004-08-02 04:24:22 +04:00
|
|
|
{
|
2013-03-28 01:10:18 +04:00
|
|
|
/* Open flags are not used at this time. Suppress compiler warning. */
|
|
|
|
if (flags & MCA_BASE_OPEN_FIND_COMPONENTS) {
|
|
|
|
/* Find and load requested components */
|
|
|
|
int ret = mca_base_component_find(NULL, framework->framework_name,
|
|
|
|
framework->framework_static_components,
|
|
|
|
framework->framework_selection,
|
|
|
|
&framework->framework_components, true);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
return ret;
|
2007-07-13 18:54:01 +04:00
|
|
|
}
|
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
/* Open all registered components */
|
|
|
|
return open_components (framework);
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
int mca_base_components_open (const char *type_name, int output_id,
|
|
|
|
const mca_base_component_t **static_components,
|
|
|
|
opal_list_t *components_available,
|
|
|
|
bool open_dso_components)
|
2009-12-17 18:12:26 +03:00
|
|
|
{
|
2013-03-28 01:10:18 +04:00
|
|
|
/* create a dummy framework -- this leaks -- i know -- but it is temporary */
|
|
|
|
mca_base_register_flag_t register_flags;
|
|
|
|
mca_base_framework_t *dummy_framework;
|
|
|
|
opal_list_item_t *item;
|
|
|
|
int ret;
|
2009-12-17 18:12:26 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
dummy_framework = calloc (1, sizeof(*dummy_framework));
|
2009-12-17 18:12:26 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
dummy_framework->framework_static_components = static_components;
|
|
|
|
dummy_framework->framework_output = output_id;
|
|
|
|
dummy_framework->framework_name = strdup(type_name);
|
2009-12-17 18:12:26 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
if (open_dso_components) {
|
|
|
|
register_flags = MCA_BASE_REGISTER_STATIC_ONLY;
|
|
|
|
} else {
|
|
|
|
register_flags = MCA_BASE_REGISTER_DEFAULT;
|
2009-12-17 18:12:26 +03:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
ret = mca_base_framework_components_register (dummy_framework, register_flags);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
free (dummy_framework);
|
|
|
|
return ret;
|
2009-12-17 18:12:26 +03:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
ret = mca_base_framework_components_open (dummy_framework, 0);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
(void) mca_base_framework_components_close (dummy_framework, NULL);
|
|
|
|
free (dummy_framework);
|
|
|
|
return ret;
|
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
OBJ_CONSTRUCT(components_available, opal_list_t);
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
while (NULL != (item = opal_list_remove_first(&dummy_framework->framework_components))) {
|
|
|
|
opal_list_append(components_available, item);
|
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
OBJ_DESTRUCT(&dummy_framework->framework_components);
|
2004-08-02 04:24:22 +04:00
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|
|
|
|
|
2005-09-27 01:55:32 +04:00
|
|
|
/*
|
|
|
|
* Traverse the entire list of found components (a list of
|
|
|
|
* mca_base_component_t instances). If the requested_component_names
|
|
|
|
* array is empty, or the name of each component in the list of found
|
|
|
|
* components is in the requested_components_array, try to open it.
|
|
|
|
* If it opens, add it to the components_available list.
|
|
|
|
*/
|
2013-03-28 01:10:18 +04:00
|
|
|
static int open_components(mca_base_framework_t *framework)
|
2005-09-27 01:55:32 +04:00
|
|
|
{
|
2013-03-28 01:10:18 +04:00
|
|
|
opal_list_t *components = &framework->framework_components;
|
|
|
|
uint32_t open_only_flags = MCA_BASE_METADATA_PARAM_NONE;
|
|
|
|
int output_id = framework->framework_output;
|
|
|
|
mca_base_component_list_item_t *cli, *next;
|
2010-01-12 22:29:12 +03:00
|
|
|
int ret;
|
2013-03-28 01:10:18 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Pre-process the list with parameter constraints
|
|
|
|
* e.g., If requested to select only CR enabled components
|
|
|
|
* then only make available those components.
|
|
|
|
*
|
|
|
|
* JJH Note: Currently checkpoint/restart is the only user of this
|
|
|
|
* functionality. If other component constraint options are
|
|
|
|
* added, then this logic can be used for all contraint
|
|
|
|
* options.
|
|
|
|
*
|
|
|
|
* NTH: Logic moved to mca_base_components_filter.
|
|
|
|
*/
|
|
|
|
#if (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1)
|
2014-03-04 20:14:46 +04:00
|
|
|
if (opal_base_distill_checkpoint_ready) {
|
2013-03-28 01:10:18 +04:00
|
|
|
open_only_flags |= MCA_BASE_METADATA_PARAM_CHECKPOINT;
|
|
|
|
}
|
|
|
|
#endif /* (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1) */
|
|
|
|
|
|
|
|
/* If mca_base_framework_register_components was called with the MCA_BASE_COMPONENTS_ALL flag
|
|
|
|
we need to trim down and close any extra components we do not want open */
|
|
|
|
ret = mca_base_components_filter (framework->framework_name, &framework->framework_components,
|
|
|
|
framework->framework_output, framework->framework_selection,
|
|
|
|
open_only_flags);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-27 01:55:32 +04:00
|
|
|
/* Announce */
|
|
|
|
opal_output_verbose(10, output_id,
|
|
|
|
"mca: base: components_open: opening %s components",
|
2013-03-28 01:10:18 +04:00
|
|
|
framework->framework_name);
|
2005-09-27 01:55:32 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
/* Traverse the list of components */
|
|
|
|
OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
|
|
|
|
const mca_base_component_t *component = cli->cli_component;
|
2005-09-27 01:55:32 +04:00
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(10, output_id,
|
2005-09-27 01:55:32 +04:00
|
|
|
"mca: base: components_open: found loaded component %s",
|
2004-10-15 14:54:39 +04:00
|
|
|
component->mca_component_name);
|
2008-07-29 02:40:57 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
if (NULL != component->mca_open_component) {
|
|
|
|
/* Call open if register didn't call it already */
|
2010-01-12 22:29:12 +03:00
|
|
|
ret = component->mca_open_component();
|
2013-03-28 01:10:18 +04:00
|
|
|
|
Refs trac:3275.
We ran into a case where the OMPI SVN trunk grew a new acceptable MCA
parameter value, but this new value was not accepted on the v1.6
branch (hwloc_base_mem_bind_failure_action -- on the trunk it accepts
the value "silent", but on the older v1.6 branch, it doesn't). If you
set "hwloc_base_mem_bind_failure_action=silent" in the default MCA
params file and then accidentally ran with the v1.6 branch, every OMPI
executable (including ompi_info) just failed because hwloc_base_open()
would say "hey, 'silent' is not a valid value for
hwloc_base_mem_bind_failure_action!". Kaboom.
The only problem is that it didn't give you any indication of where
this value was being set. Quite maddening, from a user perspective.
So we changed the ompi_info handles this case. If any framework open
function return OMPI_ERR_BAD_PARAM (either because its base MCA params
got a bad value or because one of its component register/open
functions return OMPI_ERR_BAD_PARAM), ompi_info will stop, print out
a warning that it received and error, and then dump out the parameters
that it has received so far in the framework that had a problem.
At a minimum, this will show the user the MCA param that had an error
(it's usually the last one), and ''where it was set from'' (so that
they can go fix it).
We updated ompi_info to check for O???_ERR_BAD_PARAM from each from
the framework opens. Also updated the doxygen docs in mca.h for this
O???_BAD_PARAM behavior. And we noticed that mca.h had MCA_SUCCESS
and MCA_ERR_??? codes. Why? I think we used them in exactly one
place in the code base (mca_base_components_open.c). So we deleted
those and just used the normal OPAL_* codes instead.
While we were doing this, we also cleaned up a little memory
management during ompi_info/orte-info/opal-info finalization.
Valgrind still reports a truckload of memory still in use at ompi_info
termination, but they mostly look to be components not freeing
memory/resources properly (and outside the scope of this fix).
This commit was SVN r27306.
The following Trac tickets were found above:
Ticket 3275 --> https://svn.open-mpi.org/trac/ompi/ticket/3275
2012-09-12 00:47:24 +04:00
|
|
|
if (OPAL_SUCCESS == ret) {
|
2005-09-27 01:55:32 +04:00
|
|
|
opal_output_verbose(10, output_id,
|
|
|
|
"mca: base: components_open: "
|
|
|
|
"component %s open function successful",
|
|
|
|
component->mca_component_name);
|
2013-03-28 01:10:18 +04:00
|
|
|
} else {
|
|
|
|
if (OPAL_ERR_NOT_AVAILABLE != ret) {
|
|
|
|
/* If the component returns OPAL_ERR_NOT_AVAILABLE,
|
|
|
|
it's a cue to "silently ignore me" -- it's not a
|
|
|
|
failure, it's just a way for the component to say
|
|
|
|
"nope!".
|
|
|
|
|
|
|
|
Otherwise, however, display an error. 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. */
|
2005-09-27 01:55:32 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
if (mca_base_component_show_load_errors) {
|
|
|
|
opal_output(0, "mca: base: components_open: "
|
|
|
|
"component %s / %s open function failed",
|
|
|
|
component->mca_type_name,
|
|
|
|
component->mca_component_name);
|
|
|
|
}
|
|
|
|
opal_output_verbose(10, output_id,
|
|
|
|
"mca: base: components_open: "
|
|
|
|
"component %s open function failed",
|
|
|
|
component->mca_component_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
mca_base_component_close (component, output_id);
|
|
|
|
|
|
|
|
opal_list_remove_item (components, &cli->super);
|
|
|
|
OBJ_RELEASE(cli);
|
|
|
|
}
|
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|
2005-09-27 01:55:32 +04:00
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-08-02 04:24:22 +04:00
|
|
|
}
|