2013-03-28 01:10:18 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2004-01-18 02:07:40 +03:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2007-07-13 18:54:01 +04:00
|
|
|
* Copyright (c) 2004-2007 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.
|
2010-04-12 18:51:47 +04:00
|
|
|
* Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
|
2008-06-24 18:57:12 +04:00
|
|
|
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-18 02:07:40 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal_config.h"
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <stdlib.h>
|
2009-05-12 16:41:42 +04:00
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_STAT_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#endif
|
2008-06-27 20:25:31 +04:00
|
|
|
#ifdef HAVE_UNISTD_H
|
2008-06-23 20:14:05 +04:00
|
|
|
#include <unistd.h>
|
2008-06-27 20:25:31 +04:00
|
|
|
#endif
|
2008-06-24 02:32:26 +04:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
2008-06-24 18:57:12 +04:00
|
|
|
#ifdef HAVE_NETDB_H
|
|
|
|
#include <netdb.h>
|
|
|
|
#endif
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2013-02-28 21:31:47 +04:00
|
|
|
#if OPAL_LIBLTDL_INTERNAL
|
|
|
|
#include "opal/libltdl/ltdl.h"
|
2009-08-12 12:52:48 +04:00
|
|
|
#else
|
|
|
|
#include "ltdl.h"
|
|
|
|
#endif
|
2005-07-14 22:05:30 +04:00
|
|
|
#endif
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2009-12-07 23:29:28 +03:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
#include "opal/util/opal_environ.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2009-01-22 01:27:05 +03:00
|
|
|
#include "opal/util/argv.h"
|
2008-06-23 20:14:05 +04:00
|
|
|
#include "opal/util/show_help.h"
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-08-13 00:46:25 +04:00
|
|
|
#include "opal/mca/mca.h"
|
|
|
|
#include "opal/mca/base/base.h"
|
2005-09-01 16:16:36 +04:00
|
|
|
#include "opal/mca/base/mca_base_component_repository.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/constants.h"
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2004-01-18 02:07:40 +03:00
|
|
|
/*
|
2007-01-18 01:36:33 +03:00
|
|
|
* Private types; only necessary when we're dlopening components.
|
2004-01-18 02:07:40 +03:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef enum component_status {
|
2004-01-18 02:07:40 +03:00
|
|
|
UNVISITED,
|
|
|
|
FAILED_TO_LOAD,
|
|
|
|
CHECKING_CYCLE,
|
|
|
|
LOADED,
|
|
|
|
|
|
|
|
STATUS_MAX
|
2004-08-02 04:24:22 +04:00
|
|
|
} component_status_t;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
struct component_file_item_t {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2008-06-06 04:59:08 +04:00
|
|
|
char type[MCA_BASE_MAX_TYPE_NAME_LEN + 1];
|
|
|
|
char name[MCA_BASE_MAX_COMPONENT_NAME_LEN + 1];
|
2009-05-07 00:11:28 +04:00
|
|
|
char basename[OPAL_PATH_MAX + 1];
|
|
|
|
char filename[OPAL_PATH_MAX + 1];
|
2004-08-02 04:24:22 +04:00
|
|
|
component_status_t status;
|
2004-01-18 02:07:40 +03:00
|
|
|
};
|
2004-08-02 04:24:22 +04:00
|
|
|
typedef struct component_file_item_t component_file_item_t;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
static OBJ_CLASS_INSTANCE(component_file_item_t, opal_list_item_t, NULL, NULL);
|
2004-06-23 17:39:26 +04:00
|
|
|
|
2004-01-18 02:07:40 +03:00
|
|
|
struct dependency_item_t {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
component_file_item_t *di_component_file_item;
|
2004-01-18 02:07:40 +03:00
|
|
|
};
|
|
|
|
typedef struct dependency_item_t dependency_item_t;
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
static OBJ_CLASS_INSTANCE(dependency_item_t, opal_list_item_t, NULL, NULL);
|
2004-06-23 17:39:26 +04:00
|
|
|
|
2007-08-17 08:08:23 +04:00
|
|
|
#if OPAL_HAVE_LTDL_ADVISE
|
|
|
|
extern lt_dladvise opal_mca_dladvise;
|
|
|
|
#endif
|
2009-05-07 00:11:28 +04:00
|
|
|
#endif /* OPAL_WANT_LIBLTDL */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2004-01-18 02:07:40 +03:00
|
|
|
/*
|
|
|
|
* Private functions
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
static void find_dyn_components(const char *path, const char *type,
|
2009-01-22 01:27:05 +03:00
|
|
|
const char **names, bool include_mode,
|
2007-07-13 18:54:01 +04:00
|
|
|
opal_list_t *found_components);
|
2004-01-18 02:07:40 +03:00
|
|
|
static int save_filename(const char *filename, lt_ptr data);
|
2004-08-02 04:24:22 +04:00
|
|
|
static int open_component(component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *found_components);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
static int check_opal_info(component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *dependencies,
|
|
|
|
opal_list_t *found_components);
|
2004-08-02 04:24:22 +04:00
|
|
|
static int check_dependency(char *line, component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *dependencies,
|
|
|
|
opal_list_t *found_components);
|
|
|
|
static void free_dependency_list(opal_list_t *dependencies);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Private variables
|
|
|
|
*/
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
static const char *opal_info_suffix = ".ompi_info";
|
2004-01-18 02:07:40 +03:00
|
|
|
static const char *key_dependency = "dependency=";
|
2004-08-02 04:24:22 +04:00
|
|
|
static const char component_template[] = "mca_%s_";
|
2005-07-03 20:22:16 +04:00
|
|
|
static opal_list_t found_files;
|
2009-01-22 01:27:05 +03:00
|
|
|
static char **found_filenames = NULL;
|
2010-04-13 02:02:34 +04:00
|
|
|
static char *last_path_to_use = NULL;
|
2009-05-07 00:11:28 +04:00
|
|
|
#endif /* OPAL_WANT_LIBLTDL */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
static int component_find_check (const char *framework_name, char **requested_component_names, opal_list_t *components);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Dummy structure for casting for open_only logic
|
|
|
|
*/
|
|
|
|
struct mca_base_open_only_dummy_component_t {
|
|
|
|
/** MCA base component */
|
|
|
|
mca_base_component_t version;
|
|
|
|
/** MCA base data */
|
|
|
|
mca_base_component_data_t data;
|
|
|
|
};
|
|
|
|
typedef struct mca_base_open_only_dummy_component_t mca_base_open_only_dummy_component_t;
|
|
|
|
|
|
|
|
static char negate[] = "^";
|
|
|
|
|
2007-07-18 18:19:24 +04:00
|
|
|
static bool use_component(const bool include_mode,
|
|
|
|
const char **requested_component_names,
|
|
|
|
const char *component_name);
|
|
|
|
|
|
|
|
|
2004-01-18 02:07:40 +03:00
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* Function to find as many components of a given type as possible. This
|
|
|
|
* includes statically-linked in components as well as opening up a
|
|
|
|
* directory and looking for shared-library MCA components of the
|
2004-01-18 02:07:40 +03:00
|
|
|
* appropriate type (load them if available).
|
|
|
|
*
|
2004-08-02 04:24:22 +04:00
|
|
|
* Return one consolidated array of (mca_base_component_t*) pointing to all
|
|
|
|
* available components.
|
2004-01-18 02:07:40 +03:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
int mca_base_component_find(const char *directory, const char *type,
|
2007-04-12 10:25:57 +04:00
|
|
|
const mca_base_component_t *static_components[],
|
2013-03-28 01:10:18 +04:00
|
|
|
const char *requested_components,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *found_components,
|
2005-04-13 07:19:48 +04:00
|
|
|
bool open_dso_components)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
2013-03-28 01:10:18 +04:00
|
|
|
char **requested_component_names = NULL;
|
2007-07-13 18:54:01 +04:00
|
|
|
mca_base_component_list_item_t *cli;
|
2013-03-28 01:10:18 +04:00
|
|
|
bool include_mode;
|
|
|
|
int i, ret;
|
|
|
|
|
2013-08-28 20:03:23 +04:00
|
|
|
ret = mca_base_component_parse_requested (requested_components, &include_mode,
|
2013-03-28 01:10:18 +04:00
|
|
|
&requested_component_names);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
2007-07-13 18:54:01 +04:00
|
|
|
|
|
|
|
/* Find all the components that were statically linked in */
|
|
|
|
OBJ_CONSTRUCT(found_components, opal_list_t);
|
2010-04-12 18:51:47 +04:00
|
|
|
for (i = 0; NULL != static_components &&
|
|
|
|
NULL != static_components[i]; ++i) {
|
2007-07-17 16:06:51 +04:00
|
|
|
if ( use_component(include_mode,
|
|
|
|
(const char**)requested_component_names,
|
|
|
|
static_components[i]->mca_component_name) ) {
|
|
|
|
cli = OBJ_NEW(mca_base_component_list_item_t);
|
|
|
|
if (NULL == cli) {
|
2013-03-28 01:10:18 +04:00
|
|
|
ret = OPAL_ERR_OUT_OF_RESOURCE;
|
|
|
|
goto component_find_out;
|
2007-07-17 16:06:51 +04:00
|
|
|
}
|
|
|
|
cli->cli_component = static_components[i];
|
|
|
|
opal_list_append(found_components, (opal_list_item_t *) cli);
|
2007-07-13 18:54:01 +04:00
|
|
|
}
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2007-07-13 18:54:01 +04:00
|
|
|
/* Find any available dynamic components in the specified directory */
|
2013-03-28 01:09:41 +04:00
|
|
|
if (open_dso_components && !mca_base_component_disable_dlopen) {
|
|
|
|
find_dyn_components(directory, type,
|
|
|
|
(const char**)requested_component_names,
|
|
|
|
include_mode, found_components);
|
2007-07-13 18:54:01 +04:00
|
|
|
} else {
|
|
|
|
opal_output_verbose(40, 0,
|
|
|
|
"mca: base: component_find: dso loading for %s MCA components disabled",
|
|
|
|
type);
|
|
|
|
}
|
2005-07-14 22:05:30 +04:00
|
|
|
#endif
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
if (include_mode) {
|
|
|
|
ret = component_find_check (type, requested_component_names, found_components);
|
|
|
|
} else {
|
|
|
|
ret = OPAL_SUCCESS;
|
|
|
|
}
|
2008-06-23 20:14:05 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
|
|
|
|
ret = OPAL_SUCCESS;
|
|
|
|
|
|
|
|
component_find_out:
|
|
|
|
|
|
|
|
if (NULL != requested_component_names) {
|
|
|
|
opal_argv_free(requested_component_names);
|
2008-06-23 20:14:05 +04:00
|
|
|
}
|
|
|
|
|
2007-07-13 18:54:01 +04:00
|
|
|
/* All done */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
return ret;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
int mca_base_component_find_finalize(void)
|
|
|
|
{
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2009-01-22 01:27:05 +03:00
|
|
|
if (NULL != found_filenames) {
|
|
|
|
opal_argv_free(found_filenames);
|
|
|
|
found_filenames = NULL;
|
|
|
|
}
|
2010-04-13 02:02:34 +04:00
|
|
|
if (NULL != last_path_to_use) {
|
|
|
|
free(last_path_to_use);
|
|
|
|
last_path_to_use = NULL;
|
|
|
|
}
|
2009-01-22 19:46:02 +03:00
|
|
|
#endif
|
2009-01-22 01:27:05 +03:00
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
int mca_base_components_filter (const char *framework_name, opal_list_t *components, int output_id,
|
|
|
|
const char *filter_names, uint32_t filter_flags)
|
|
|
|
{
|
|
|
|
mca_base_component_list_item_t *cli, *next;
|
|
|
|
char **requested_component_names = NULL;
|
|
|
|
bool include_mode, can_use;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
assert (NULL != components);
|
|
|
|
|
|
|
|
if (0 == filter_flags && NULL == filter_names) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-08-28 20:03:23 +04:00
|
|
|
ret = mca_base_component_parse_requested (filter_names, &include_mode,
|
2013-03-28 01:10:18 +04:00
|
|
|
&requested_component_names);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_LIST_FOREACH_SAFE(cli, next, components, mca_base_component_list_item_t) {
|
|
|
|
const mca_base_component_t *component = cli->cli_component;
|
|
|
|
mca_base_open_only_dummy_component_t *dummy =
|
|
|
|
(mca_base_open_only_dummy_component_t *) cli->cli_component;
|
|
|
|
|
|
|
|
can_use = use_component (include_mode, (const char **) requested_component_names,
|
|
|
|
cli->cli_component->mca_component_name);
|
|
|
|
|
|
|
|
if (!can_use || (filter_flags & dummy->data.param_field) != filter_flags) {
|
|
|
|
if (can_use && (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) &&
|
|
|
|
!(MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field)) {
|
|
|
|
opal_output_verbose(10, output_id,
|
|
|
|
"mca: base: components_filter: "
|
|
|
|
"(%s) Component %s is *NOT* Checkpointable - Disabled",
|
|
|
|
component->reserved,
|
|
|
|
component->mca_component_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
opal_list_remove_item (components, &cli->super);
|
|
|
|
|
2013-08-10 00:16:08 +04:00
|
|
|
mca_base_component_unload (component, output_id);
|
2013-03-28 01:10:18 +04:00
|
|
|
|
|
|
|
OBJ_RELEASE(cli);
|
|
|
|
} else if (filter_flags & MCA_BASE_METADATA_PARAM_CHECKPOINT) {
|
|
|
|
opal_output_verbose(10, output_id,
|
|
|
|
"mca: base: components_filter: "
|
|
|
|
"(%s) Component %s is Checkpointable",
|
|
|
|
component->reserved,
|
|
|
|
component->mca_component_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (include_mode) {
|
|
|
|
ret = component_find_check (framework_name, requested_component_names, components);
|
|
|
|
} else {
|
|
|
|
ret = OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NULL != requested_component_names) {
|
|
|
|
opal_argv_free (requested_component_names);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#if OPAL_WANT_LIBLTDL
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* Open up all directories in a given path and search for components of
|
2004-01-18 02:07:40 +03:00
|
|
|
* the specified type (and possibly of a given name).
|
|
|
|
*
|
|
|
|
* Note that we use our own path iteration functionality (vs. ltdl's
|
|
|
|
* lt_dladdsearchdir() functionality) because we need to look at
|
2004-06-07 19:33:53 +04:00
|
|
|
* companion .ompi_info files in the same directory as the library to
|
2004-01-18 02:07:40 +03:00
|
|
|
* generate dependencies, etc. If we use the plain lt_dlopen()
|
|
|
|
* functionality, we would not get the directory name of the file
|
|
|
|
* finally opened in recursive dependency traversals.
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
static void find_dyn_components(const char *path, const char *type_name,
|
2009-01-22 01:27:05 +03:00
|
|
|
const char **names, bool include_mode,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *found_components)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
2009-01-22 01:27:05 +03:00
|
|
|
int i, len;
|
2013-03-28 01:10:18 +04:00
|
|
|
char *path_to_use = NULL, *dir, *end;
|
2007-07-13 18:54:01 +04:00
|
|
|
component_file_item_t *file;
|
|
|
|
opal_list_item_t *cur;
|
2009-01-22 01:27:05 +03:00
|
|
|
char prefix[32 + MCA_BASE_MAX_TYPE_NAME_LEN], *basename;
|
2009-12-07 23:29:28 +03:00
|
|
|
|
2007-07-13 18:54:01 +04:00
|
|
|
/* If path is NULL, iterate over the set of directories specified by
|
|
|
|
the MCA param mca_base_component_path. If path is not NULL, then
|
|
|
|
use that as the path. */
|
|
|
|
|
|
|
|
if (NULL == path) {
|
2013-03-28 01:09:41 +04:00
|
|
|
if (NULL != mca_base_component_path) {
|
2013-03-28 01:10:18 +04:00
|
|
|
path_to_use = strdup (mca_base_component_path);
|
2013-03-28 01:09:41 +04:00
|
|
|
} else {
|
2007-07-13 18:54:01 +04:00
|
|
|
/* If there's no path, then there's nothing to search -- we're
|
|
|
|
done */
|
|
|
|
return;
|
|
|
|
}
|
2013-03-28 01:09:41 +04:00
|
|
|
|
|
|
|
if (NULL == path_to_use) {
|
|
|
|
/* out of memory */
|
|
|
|
return;
|
|
|
|
}
|
2007-07-13 18:54:01 +04:00
|
|
|
} else {
|
|
|
|
path_to_use = strdup(path);
|
2004-08-28 13:30:09 +04:00
|
|
|
}
|
2007-07-13 18:54:01 +04:00
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
/* If we haven't done so already, iterate over all the files in
|
|
|
|
the directories in the path and make a master array of all the
|
|
|
|
matching filenames that we find. Save the filenames in an
|
2010-04-13 02:02:34 +04:00
|
|
|
argv-style array. Re-scan do this if the mca_component_path
|
|
|
|
has changed. */
|
|
|
|
if (NULL == found_filenames ||
|
|
|
|
(NULL != last_path_to_use &&
|
|
|
|
0 != strcmp(path_to_use, last_path_to_use))) {
|
|
|
|
if (NULL != found_filenames) {
|
|
|
|
opal_argv_free(found_filenames);
|
|
|
|
found_filenames = NULL;
|
|
|
|
free(last_path_to_use);
|
|
|
|
last_path_to_use = NULL;
|
|
|
|
}
|
|
|
|
if (NULL == last_path_to_use) {
|
|
|
|
last_path_to_use = strdup(path_to_use);
|
|
|
|
}
|
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
dir = path_to_use;
|
|
|
|
if (NULL != dir) {
|
|
|
|
do {
|
|
|
|
end = strchr(dir, OPAL_ENV_SEP);
|
|
|
|
if (NULL != end) {
|
|
|
|
*end = '\0';
|
|
|
|
}
|
2009-12-07 23:29:28 +03:00
|
|
|
if ((0 == strcmp(dir, "USER_DEFAULT") ||
|
|
|
|
0 == strcmp(dir, "USR_DEFAULT"))
|
2009-12-08 20:32:22 +03:00
|
|
|
&& NULL != mca_base_user_default_path) {
|
|
|
|
if (0 != lt_dlforeachfile(mca_base_user_default_path,
|
|
|
|
save_filename, NULL)) {
|
2009-12-07 23:29:28 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (0 == strcmp(dir, "SYS_DEFAULT") ||
|
|
|
|
0 == strcmp(dir, "SYSTEM_DEFAULT")) {
|
2009-12-08 20:32:22 +03:00
|
|
|
if (0 != lt_dlforeachfile(mca_base_system_default_path,
|
|
|
|
save_filename, NULL)) {
|
2009-12-07 23:29:28 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (0 != lt_dlforeachfile(dir, save_filename, NULL)) {
|
|
|
|
break;
|
|
|
|
}
|
2009-01-22 01:27:05 +03:00
|
|
|
}
|
|
|
|
dir = end + 1;
|
|
|
|
} while (NULL != end);
|
|
|
|
}
|
|
|
|
}
|
2009-12-07 23:29:28 +03:00
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
/* Look through the list of found files and find those that match
|
|
|
|
the desired framework name */
|
|
|
|
snprintf(prefix, sizeof(prefix) - 1, component_template, type_name);
|
|
|
|
len = strlen(prefix);
|
2007-07-13 18:54:01 +04:00
|
|
|
OBJ_CONSTRUCT(&found_files, opal_list_t);
|
2009-01-22 01:27:05 +03:00
|
|
|
for (i = 0; NULL != found_filenames && NULL != found_filenames[i]; ++i) {
|
|
|
|
basename = strrchr(found_filenames[i], '/');
|
|
|
|
if (NULL == basename) {
|
|
|
|
basename = found_filenames[i];
|
|
|
|
} else {
|
|
|
|
basename += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 != strncmp(basename, prefix, len)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We found a match; save all the relevant details in the
|
|
|
|
found_files list */
|
|
|
|
file = OBJ_NEW(component_file_item_t);
|
|
|
|
if (NULL == file) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
strncpy(file->type, type_name, MCA_BASE_MAX_TYPE_NAME_LEN);
|
|
|
|
file->type[MCA_BASE_MAX_TYPE_NAME_LEN] = '\0';
|
|
|
|
strncpy(file->name, basename + len, MCA_BASE_MAX_COMPONENT_NAME_LEN);
|
|
|
|
file->name[MCA_BASE_MAX_COMPONENT_NAME_LEN] = '\0';
|
2009-05-07 00:11:28 +04:00
|
|
|
strncpy(file->basename, basename, OPAL_PATH_MAX);
|
|
|
|
file->basename[OPAL_PATH_MAX] = '\0';
|
|
|
|
strncpy(file->filename, found_filenames[i], OPAL_PATH_MAX);
|
|
|
|
file->filename[OPAL_PATH_MAX] = '\0';
|
2009-01-22 01:27:05 +03:00
|
|
|
file->status = UNVISITED;
|
2009-03-18 20:46:24 +03:00
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
opal_list_append(&found_files, (opal_list_item_t *)
|
|
|
|
file);
|
2004-06-23 17:39:26 +04:00
|
|
|
}
|
2007-07-13 18:54:01 +04:00
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
/* Iterate through all the filenames that we found that matched
|
|
|
|
the framework we were looking for. Since one component may
|
|
|
|
[try to] call another to be loaded, only try to load the
|
|
|
|
UNVISITED files. Also, ignore the return code -- basically,
|
|
|
|
give every file one chance to try to load. If they load,
|
|
|
|
great. If not, great. */
|
2007-07-13 18:54:01 +04:00
|
|
|
for (cur = opal_list_get_first(&found_files);
|
|
|
|
opal_list_get_end(&found_files) != cur;
|
|
|
|
cur = opal_list_get_next(cur)) {
|
|
|
|
file = (component_file_item_t *) cur;
|
|
|
|
|
|
|
|
if( UNVISITED == file->status ) {
|
|
|
|
bool op = true;
|
|
|
|
file->status = CHECKING_CYCLE;
|
|
|
|
|
2009-01-22 01:27:05 +03:00
|
|
|
op = use_component(include_mode, names, file->name);
|
2007-07-13 18:54:01 +04:00
|
|
|
if( true == op ) {
|
|
|
|
open_component(file, found_components);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* So now we have a final list of loaded components. We can free all
|
|
|
|
the file information. */
|
|
|
|
for (cur = opal_list_remove_first(&found_files);
|
|
|
|
NULL != cur;
|
|
|
|
cur = opal_list_remove_first(&found_files)) {
|
|
|
|
OBJ_RELEASE(cur);
|
|
|
|
}
|
2009-01-22 01:27:05 +03:00
|
|
|
OBJ_DESTRUCT(&found_files);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2007-07-13 18:54:01 +04:00
|
|
|
/* All done, now let's cleanup */
|
|
|
|
free(path_to_use);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-01-22 01:27:05 +03:00
|
|
|
* Blindly save all filenames into an argv-style list. This function
|
|
|
|
* is the callback from lt_dlforeachfile().
|
2004-01-18 02:07:40 +03:00
|
|
|
*/
|
|
|
|
static int save_filename(const char *filename, lt_ptr data)
|
|
|
|
{
|
2009-01-22 01:27:05 +03:00
|
|
|
opal_argv_append_nosize(&found_filenames, filename);
|
2004-01-18 02:07:40 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-05-12 16:41:42 +04:00
|
|
|
static int file_exists(const char *filename, const char *ext)
|
|
|
|
{
|
|
|
|
char *final;
|
|
|
|
struct stat buf;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (NULL != ext) {
|
|
|
|
asprintf(&final, "%s.%s", filename, ext);
|
|
|
|
} else {
|
|
|
|
final = strdup(filename);
|
|
|
|
}
|
|
|
|
if (NULL == final) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ret = stat(final, &buf);
|
|
|
|
free(final);
|
|
|
|
return (0 == ret ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-18 02:07:40 +03:00
|
|
|
/*
|
2004-08-02 04:24:22 +04:00
|
|
|
* Open a component, chasing down its dependencies first, if possible.
|
2004-01-18 02:07:40 +03:00
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
static int open_component(component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *found_components)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
2004-08-02 04:24:22 +04:00
|
|
|
lt_dlhandle component_handle;
|
|
|
|
mca_base_component_t *component_struct;
|
2004-10-15 14:54:39 +04:00
|
|
|
char *struct_name, *err;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t dependencies;
|
|
|
|
opal_list_item_t *cur;
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_component_list_item_t *mitem;
|
2004-01-18 02:07:40 +03:00
|
|
|
dependency_item_t *ditem;
|
2006-08-23 03:25:13 +04:00
|
|
|
size_t len;
|
2008-08-06 15:44:22 +04:00
|
|
|
int vl;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: examining dyanmic %s MCA component \"%s\"",
|
2007-01-30 23:56:31 +03:00
|
|
|
target_file->type, target_file->name);
|
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: %s", target_file->filename);
|
2013-03-28 01:10:18 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
vl = mca_base_component_show_load_errors ? 0 : 40;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Was this component already loaded (e.g., via dependency)? */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
if (LOADED == target_file->status) {
|
2007-01-30 23:56:31 +03:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: already loaded (ignored)");
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Ensure that this component is not already loaded (should only happen
|
2004-01-18 02:07:40 +03:00
|
|
|
if it was statically loaded). It's an error if it's already
|
2004-08-02 04:24:22 +04:00
|
|
|
loaded because we're evaluating this file -- not this component.
|
2006-02-12 04:33:29 +03:00
|
|
|
Hence, returning OPAL_ERR_PARAM indicates that the *file* failed
|
2004-08-02 04:24:22 +04:00
|
|
|
to load, not the component. */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (cur = opal_list_get_first(found_components);
|
|
|
|
opal_list_get_end(found_components) != cur;
|
|
|
|
cur = opal_list_get_next(cur)) {
|
2004-08-02 04:24:22 +04:00
|
|
|
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)) {
|
2007-01-30 23:56:31 +03:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: already loaded (ignored)");
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = FAILED_TO_LOAD;
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Look at see if this component has any dependencies. If so, load
|
|
|
|
them. If we can't load them, then this component must also fail to
|
2004-01-18 02:07:40 +03:00
|
|
|
load. */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&dependencies, opal_list_t);
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
if (0 != check_opal_info(target_file, &dependencies, found_components)) {
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Now try to load the component */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2007-08-17 08:08:23 +04:00
|
|
|
#if OPAL_HAVE_LTDL_ADVISE
|
|
|
|
component_handle = lt_dlopenadvise(target_file->filename, opal_mca_dladvise);
|
|
|
|
#else
|
2004-08-02 04:24:22 +04:00
|
|
|
component_handle = lt_dlopenext(target_file->filename);
|
2007-08-17 08:08:23 +04:00
|
|
|
#endif
|
2004-08-02 04:24:22 +04:00
|
|
|
if (NULL == component_handle) {
|
2010-07-27 18:15:53 +04:00
|
|
|
/* Apparently lt_dlerror() sometimes returns NULL! */
|
|
|
|
const char *str = lt_dlerror();
|
|
|
|
if (NULL != str) {
|
|
|
|
err = strdup(str);
|
|
|
|
} else {
|
|
|
|
err = strdup("lt_dlerror() returned NULL!");
|
|
|
|
}
|
|
|
|
/* Because libltdl erroneously says "file not found" for any
|
|
|
|
type of error -- which is especially misleading when the file
|
|
|
|
is actually there but cannot be opened for some other reason
|
|
|
|
(e.g., missing symbol) -- do some simple huersitics and if
|
|
|
|
the file [probably] does exist, print a slightly better error
|
|
|
|
message. */
|
|
|
|
if (0 == strcmp("file not found", err) &&
|
|
|
|
(file_exists(target_file->filename, "lo") ||
|
|
|
|
file_exists(target_file->filename, "so") ||
|
|
|
|
file_exists(target_file->filename, "dylib") ||
|
|
|
|
file_exists(target_file->filename, "dll"))) {
|
|
|
|
free(err);
|
|
|
|
err = strdup("perhaps a missing symbol, or compiled for a different version of Open MPI?");
|
|
|
|
}
|
|
|
|
opal_output_verbose(vl, 0, "mca: base: component_find: unable to open %s: %s (ignored)",
|
|
|
|
target_file->filename, err);
|
|
|
|
free(err);
|
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Successfully opened the component; now find the public struct.
|
2004-01-18 02:07:40 +03:00
|
|
|
Malloc out enough space for it. */
|
|
|
|
|
|
|
|
len = strlen(target_file->type) + strlen(target_file->name) + 32;
|
2006-08-23 00:07:42 +04:00
|
|
|
struct_name = (char*)malloc(len);
|
2004-01-18 02:07:40 +03:00
|
|
|
if (NULL == struct_name) {
|
2004-08-02 04:24:22 +04:00
|
|
|
lt_dlclose(component_handle);
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
snprintf(struct_name, len, "mca_%s_%s_component", target_file->type,
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->name);
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mitem = OBJ_NEW(mca_base_component_list_item_t);
|
2004-01-18 02:07:40 +03:00
|
|
|
if (NULL == mitem) {
|
2004-02-10 03:09:36 +03:00
|
|
|
free(struct_name);
|
2004-08-02 04:24:22 +04:00
|
|
|
lt_dlclose(component_handle);
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2006-08-23 00:07:42 +04:00
|
|
|
component_struct = (mca_base_component_t*)lt_dlsym(component_handle, struct_name);
|
2004-08-02 04:24:22 +04:00
|
|
|
if (NULL == component_struct) {
|
2010-07-27 18:15:53 +04:00
|
|
|
/* Apparently lt_dlerror() sometimes returns NULL! */
|
|
|
|
const char *str = lt_dlerror();
|
|
|
|
if (NULL == str) {
|
|
|
|
str = "lt_dlerror() returned NULL!";
|
|
|
|
}
|
|
|
|
opal_output_verbose(vl, 0, "mca: base: component_find: \"%s\" does not appear to be a valid "
|
|
|
|
"%s MCA dynamic component (ignored): %s",
|
|
|
|
target_file->basename, target_file->type, str);
|
|
|
|
free(mitem);
|
|
|
|
free(struct_name);
|
|
|
|
lt_dlclose(component_handle);
|
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2008-07-29 02:40:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We found the public struct. Make sure its MCA major.minor
|
|
|
|
version is the same as ours. */
|
|
|
|
if (!(MCA_BASE_VERSION_MAJOR == component_struct->mca_major_version &&
|
|
|
|
MCA_BASE_VERSION_MINOR == component_struct->mca_minor_version)) {
|
|
|
|
opal_output_verbose(vl, 0, "mca: base: component_find: %s \"%s\" uses an MCA interface that is not recognized (component MCA v%d.%d.%d != supported MCA v%d.%d.%d) -- ignored",
|
|
|
|
target_file->type, target_file->basename,
|
|
|
|
component_struct->mca_major_version,
|
|
|
|
component_struct->mca_minor_version,
|
|
|
|
component_struct->mca_release_version,
|
|
|
|
MCA_BASE_VERSION_MAJOR,
|
|
|
|
MCA_BASE_VERSION_MINOR,
|
|
|
|
MCA_BASE_VERSION_RELEASE);
|
2004-02-10 03:09:36 +03:00
|
|
|
free(mitem);
|
|
|
|
free(struct_name);
|
2004-08-02 04:24:22 +04:00
|
|
|
lt_dlclose(component_handle);
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
2009-01-17 15:53:21 +03:00
|
|
|
/* Also check that the component struct framework and component
|
|
|
|
names match the expected names from the filename */
|
|
|
|
if (0 != strcmp(component_struct->mca_type_name, target_file->type) ||
|
|
|
|
0 != strcmp(component_struct->mca_component_name, target_file->name)) {
|
|
|
|
opal_output_verbose(vl, 0, "Component file data does not match filename: %s (%s / %s) != %s %s -- ignored",
|
|
|
|
target_file->filename, target_file->type, target_file->name,
|
|
|
|
component_struct->mca_type_name,
|
|
|
|
component_struct->mca_component_name);
|
|
|
|
free(mitem);
|
|
|
|
free(struct_name);
|
|
|
|
lt_dlclose(component_handle);
|
|
|
|
target_file->status = FAILED_TO_LOAD;
|
|
|
|
free_dependency_list(&dependencies);
|
|
|
|
return OPAL_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
2008-07-29 02:40:57 +04:00
|
|
|
/* Alles gut. Save the component struct, and register this
|
|
|
|
component to be closed later. */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
mitem->cli_component = component_struct;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(found_components, (opal_list_item_t *) mitem);
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_component_repository_retain(target_file->type, component_handle,
|
|
|
|
component_struct);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* Now that that's all done, link all the dependencies in to this
|
2004-08-02 04:24:22 +04:00
|
|
|
component's repository entry */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (cur = opal_list_remove_first(&dependencies);
|
2004-01-18 02:07:40 +03:00
|
|
|
NULL != cur;
|
2005-07-03 20:22:16 +04:00
|
|
|
cur = opal_list_remove_first(&dependencies)) {
|
2004-01-18 02:07:40 +03:00
|
|
|
ditem = (dependency_item_t *) cur;
|
2004-08-02 04:24:22 +04:00
|
|
|
mca_base_component_repository_link(target_file->type,
|
|
|
|
target_file->name,
|
|
|
|
ditem->di_component_file_item->type,
|
|
|
|
ditem->di_component_file_item->name);
|
2004-06-23 17:39:26 +04:00
|
|
|
OBJ_RELEASE(ditem);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
2004-02-10 19:53:41 +03:00
|
|
|
OBJ_DESTRUCT(&dependencies);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: opened dynamic %s MCA component \"%s\"",
|
2007-01-30 23:56:31 +03:00
|
|
|
target_file->type, target_file->name);
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = LOADED;
|
|
|
|
|
|
|
|
/* All done */
|
|
|
|
|
2004-02-10 03:09:36 +03:00
|
|
|
free(struct_name);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-06-07 19:33:53 +04:00
|
|
|
* For a given filename, see if there exists a filename.ompi_info, which
|
2004-08-02 04:24:22 +04:00
|
|
|
* lists dependencies that must be loaded before this component is
|
|
|
|
* loaded. If we find this file, try to load those components first.
|
2004-01-18 02:07:40 +03:00
|
|
|
*
|
|
|
|
* Detect dependency cycles and error out.
|
|
|
|
*/
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
static int check_opal_info(component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *dependencies,
|
|
|
|
opal_list_t *found_components)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
2006-08-23 03:25:13 +04:00
|
|
|
size_t len;
|
2004-01-18 02:07:40 +03:00
|
|
|
FILE *fp;
|
|
|
|
char *depname;
|
|
|
|
char buffer[BUFSIZ], *p;
|
|
|
|
|
|
|
|
/* Form the filename */
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
len = strlen(target_file->filename) + strlen(opal_info_suffix) + 16;
|
2006-08-23 00:07:42 +04:00
|
|
|
depname = (char*)malloc(len);
|
2004-01-18 02:07:40 +03:00
|
|
|
if (NULL == depname)
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
snprintf(depname, len, "%s%s", target_file->filename, opal_info_suffix);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* Try to open the file. If there's no file, return success (i.e.,
|
|
|
|
there are no dependencies). */
|
|
|
|
|
|
|
|
if (NULL == (fp = fopen(depname, "r"))) {
|
2004-02-10 03:09:36 +03:00
|
|
|
free(depname);
|
2004-01-18 02:07:40 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, loop reading the lines in the file and trying to load
|
2004-08-02 04:24:22 +04:00
|
|
|
them. Return failure upon the first component that fails to
|
2004-01-18 02:07:40 +03:00
|
|
|
load. */
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: opening .ompi_info file: %s", depname);
|
2004-01-18 02:07:40 +03:00
|
|
|
while (NULL != fgets(buffer, BUFSIZ, fp)) {
|
|
|
|
|
|
|
|
/* Perl chomp */
|
|
|
|
|
|
|
|
buffer[BUFSIZ - 1] = '\0';
|
|
|
|
len = strlen(buffer);
|
|
|
|
if ('\n' == buffer[len - 1])
|
|
|
|
buffer[len - 1] = '\0';
|
|
|
|
|
|
|
|
/* Ignore emtpy lines and lines beginning with "#" or "//" */
|
|
|
|
|
|
|
|
for (p = buffer; '\0' != p; ++p)
|
|
|
|
if (!isspace(*p))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ('\0' == *p)
|
|
|
|
continue;
|
|
|
|
else if (*p == '#' || ('/' == *p && '/' == *(p + 1)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Is it a dependency? */
|
|
|
|
|
|
|
|
else if (0 == strncasecmp(p, key_dependency, strlen(key_dependency))) {
|
2006-02-12 04:33:29 +03:00
|
|
|
if (OPAL_SUCCESS != check_dependency(p + strlen(key_dependency),
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file, dependencies,
|
2004-08-02 04:24:22 +04:00
|
|
|
found_components)) {
|
2004-01-18 02:07:40 +03:00
|
|
|
fclose(fp);
|
2004-02-10 03:09:36 +03:00
|
|
|
free(depname);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* We can leave any successfully loaded dependencies; we might
|
|
|
|
need them again later. But free the dependency list for
|
2004-08-02 04:24:22 +04:00
|
|
|
this component, because since [at least] one of them didn't
|
2004-01-18 02:07:40 +03:00
|
|
|
load, we have to pretend like all of them didn't load and
|
2004-08-02 04:24:22 +04:00
|
|
|
disallow loading this component. So free the dependency
|
2004-01-18 02:07:40 +03:00
|
|
|
list. */
|
|
|
|
|
|
|
|
free_dependency_list(dependencies);
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: ompi_info file closed (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
target_file->basename);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* All done -- all depenencies satisfied */
|
|
|
|
|
|
|
|
fclose(fp);
|
2004-02-10 03:09:36 +03:00
|
|
|
free(depname);
|
2004-01-18 02:07:40 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-06-07 19:33:53 +04:00
|
|
|
* A DEPENDENCY key was found in the ompi_info file. Chase it down: see
|
2004-08-02 04:24:22 +04:00
|
|
|
* if we've already got such a component loaded, or go try to load it if
|
2004-01-18 02:07:40 +03:00
|
|
|
* it's not already loaded.
|
|
|
|
*/
|
2004-08-02 04:24:22 +04:00
|
|
|
static int check_dependency(char *line, component_file_item_t *target_file,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t *dependencies,
|
|
|
|
opal_list_t *found_components)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
|
|
|
bool happiness;
|
|
|
|
char buffer[BUFSIZ];
|
|
|
|
char *type, *name;
|
2007-09-14 06:04:34 +04:00
|
|
|
int len;
|
2004-08-02 04:24:22 +04:00
|
|
|
component_file_item_t *mitem;
|
2004-01-18 02:07:40 +03:00
|
|
|
dependency_item_t *ditem;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *cur;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* Ensure that this was a valid dependency statement */
|
|
|
|
|
|
|
|
type = line;
|
2006-08-23 03:25:13 +04:00
|
|
|
name = strchr(line, OPAL_ENV_SEP);
|
2004-08-29 23:38:26 +04:00
|
|
|
if (NULL == name) {
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-08-29 23:38:26 +04:00
|
|
|
}
|
2004-01-18 02:07:40 +03:00
|
|
|
*name = '\0';
|
|
|
|
++name;
|
|
|
|
|
2004-08-02 04:24:22 +04:00
|
|
|
/* Form the name of the component to compare to */
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
if (strlen(type) + strlen(name) + 32 >= BUFSIZ) {
|
|
|
|
target_file->status = FAILED_TO_LOAD;
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
2004-08-02 04:24:22 +04:00
|
|
|
snprintf(buffer, BUFSIZ, component_template, type);
|
2007-09-14 06:04:34 +04:00
|
|
|
len = strlen(buffer);
|
|
|
|
strncat(buffer, name, BUFSIZ - len);
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* Traverse down the list of files that we have, and see if we can
|
|
|
|
find it */
|
|
|
|
|
2004-08-29 23:38:26 +04:00
|
|
|
mitem = NULL;
|
2004-01-18 02:07:40 +03:00
|
|
|
target_file->status = CHECKING_CYCLE;
|
2005-07-03 20:22:16 +04:00
|
|
|
for (happiness = false, cur = opal_list_get_first(&found_files);
|
|
|
|
opal_list_get_end(&found_files) != cur;
|
|
|
|
cur = opal_list_get_next(cur)) {
|
2004-08-02 04:24:22 +04:00
|
|
|
mitem = (component_file_item_t *) cur;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
|
|
|
/* Compare the name to the basename */
|
|
|
|
|
|
|
|
if (0 != strcmp(mitem->basename, buffer))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Catch the bozo dependency on itself */
|
|
|
|
|
|
|
|
else if (mitem == target_file) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0,
|
2007-01-30 23:56:31 +03:00
|
|
|
"mca: base: component_find: component depends on itself (ignored dependency)");
|
2004-01-18 02:07:40 +03:00
|
|
|
happiness = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If it's loaded, great -- we're done (no need to check that
|
|
|
|
dependency sub-tree) */
|
|
|
|
|
|
|
|
else if (LOADED == mitem->status) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: dependency has already been loaded (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
mitem->basename);
|
2004-01-18 02:07:40 +03:00
|
|
|
happiness = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If it's specifically not loaded (i.e., there was some kind of
|
|
|
|
error when we tried to load it), then we cannot meet the
|
|
|
|
dependencies. */
|
|
|
|
|
|
|
|
else if (FAILED_TO_LOAD == mitem->status) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: dependency previously failed to load (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
mitem->basename);
|
2004-01-18 02:07:40 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we hit a cycle, return badness */
|
|
|
|
|
|
|
|
else if (CHECKING_CYCLE == mitem->status) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: found cycle! (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
mitem->basename);
|
2004-01-18 02:07:40 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, this dependency has not been looked at yet. Go try
|
|
|
|
to load it. */
|
|
|
|
|
|
|
|
else if (UNVISITED == mitem->status) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: loading dependency (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
mitem->basename);
|
2006-02-12 04:33:29 +03:00
|
|
|
if (OPAL_SUCCESS == open_component(target_file, found_components)) {
|
2004-01-18 02:07:40 +03:00
|
|
|
happiness = true;
|
|
|
|
} else {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output_verbose(40, 0, "mca: base: component_find: dependency failed to load (%s)",
|
2007-01-30 23:56:31 +03:00
|
|
|
mitem->basename);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Did we find the dependency? */
|
|
|
|
|
|
|
|
if (!happiness) {
|
|
|
|
target_file->status = FAILED_TO_LOAD;
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_BAD_PARAM;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The dependency loaded properly. Increment its refcount so that
|
2004-08-29 23:38:26 +04:00
|
|
|
it doesn't get unloaded before we get unloaded. The (NULL !=
|
|
|
|
mitem) check is somewhat redundant -- we won't be here in this
|
|
|
|
function unless there's dependencies to check, but a) it's safer
|
|
|
|
to double check, and b) it fixes a compiler warning. :-) */
|
|
|
|
|
|
|
|
if (NULL != mitem) {
|
|
|
|
ditem = OBJ_NEW(dependency_item_t);
|
|
|
|
if (NULL == ditem) {
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
2004-08-29 23:38:26 +04:00
|
|
|
}
|
|
|
|
ditem->di_component_file_item = mitem;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(dependencies, (opal_list_item_t*) ditem);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* All done -- all depenencies satisfied */
|
|
|
|
|
2006-02-12 04:33:29 +03:00
|
|
|
return OPAL_SUCCESS;
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Free a dependency list
|
|
|
|
*/
|
2005-07-03 20:22:16 +04:00
|
|
|
static void free_dependency_list(opal_list_t *dependencies)
|
2004-01-18 02:07:40 +03:00
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *item;
|
2004-01-18 02:07:40 +03:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
for (item = opal_list_remove_first(dependencies);
|
2004-01-18 02:07:40 +03:00
|
|
|
NULL != item;
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_remove_first(dependencies)) {
|
2004-06-23 17:39:26 +04:00
|
|
|
OBJ_RELEASE(item);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
2004-02-10 19:53:41 +03:00
|
|
|
OBJ_DESTRUCT(dependencies);
|
2004-01-18 02:07:40 +03:00
|
|
|
}
|
2005-07-14 22:05:30 +04:00
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
#endif /* OPAL_WANT_LIBLTDL */
|
2007-07-18 18:25:51 +04:00
|
|
|
|
2007-07-17 16:06:51 +04:00
|
|
|
static bool use_component(const bool include_mode,
|
|
|
|
const char **requested_component_names,
|
|
|
|
const char *component_name)
|
|
|
|
{
|
|
|
|
bool found = false;
|
|
|
|
const char **req_comp_name = requested_component_names;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If no selection is specified then we use all components
|
|
|
|
* we can find.
|
|
|
|
*/
|
|
|
|
if (NULL == req_comp_name) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ( *req_comp_name != NULL ) {
|
|
|
|
if ( strcmp(component_name, *req_comp_name) == 0 ) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
req_comp_name++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* include_mode found | use
|
|
|
|
* --------------------+------
|
|
|
|
* 0 0 | true
|
|
|
|
* 0 1 | false
|
|
|
|
* 1 0 | false
|
|
|
|
* 1 1 | true
|
|
|
|
*
|
|
|
|
* -> inverted xor
|
|
|
|
* As xor is a binary operator let's implement it manually before
|
|
|
|
* a compiler screws it up.
|
|
|
|
*/
|
2013-03-28 01:10:18 +04:00
|
|
|
|
|
|
|
return (include_mode && found) || !(include_mode || found);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Ensure that *all* requested components exist. Print a warning
|
|
|
|
and abort if they do not. */
|
|
|
|
static int component_find_check (const char *framework_name, char **requested_component_names, opal_list_t *components)
|
|
|
|
{
|
|
|
|
mca_base_component_list_item_t *cli;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; NULL != requested_component_names &&
|
|
|
|
NULL != requested_component_names[i]; ++i) {
|
|
|
|
bool found = false;
|
|
|
|
|
|
|
|
OPAL_LIST_FOREACH(cli, components, mca_base_component_list_item_t) {
|
|
|
|
if (0 == strcmp(requested_component_names[i],
|
|
|
|
cli->cli_component->mca_component_name)) {
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
char h[MAXHOSTNAMELEN];
|
|
|
|
gethostname(h, sizeof(h));
|
|
|
|
opal_show_help("help-mca-base.txt",
|
|
|
|
"find-available:not-valid", true,
|
|
|
|
h, framework_name, requested_component_names[i]);
|
|
|
|
return OPAL_ERR_NOT_FOUND;
|
|
|
|
}
|
2007-07-17 16:06:51 +04:00
|
|
|
}
|
2013-03-28 01:10:18 +04:00
|
|
|
|
|
|
|
return OPAL_SUCCESS;
|
2007-07-17 16:06:51 +04:00
|
|
|
}
|
|
|
|
|
2013-08-28 20:03:23 +04:00
|
|
|
int mca_base_component_parse_requested (const char *requested, bool *include_mode,
|
|
|
|
char ***requested_component_names)
|
2013-03-28 01:10:18 +04:00
|
|
|
{
|
|
|
|
const char *requested_orig = requested;
|
|
|
|
|
|
|
|
*requested_component_names = NULL;
|
|
|
|
*include_mode = true;
|
|
|
|
|
|
|
|
/* See if the user requested anything */
|
|
|
|
if (NULL == requested || 0 == strlen (requested)) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Are we including or excluding? We only allow the negate
|
|
|
|
character to be the *first* character of the value (but be nice
|
|
|
|
and allow any number of negate characters in the beginning). */
|
2013-07-12 21:55:20 +04:00
|
|
|
*include_mode = requested[0] != negate[0];
|
|
|
|
|
|
|
|
/* skip over all negate symbols at the beginning */
|
2013-03-28 01:10:18 +04:00
|
|
|
requested += strspn (requested, negate);
|
|
|
|
|
|
|
|
/* Double check to ensure that the user did not specify the negate
|
|
|
|
character anywhere else in the value. */
|
|
|
|
if (NULL != strstr (requested, negate)) {
|
|
|
|
opal_show_help("help-mca-base.txt",
|
|
|
|
"framework-param:too-many-negates",
|
|
|
|
true, requested_orig);
|
|
|
|
return OPAL_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Split up the value into individual component names */
|
|
|
|
*requested_component_names = opal_argv_split(requested, ',');
|
2007-07-17 16:06:51 +04:00
|
|
|
|
2013-03-28 01:10:18 +04:00
|
|
|
/* All done */
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|