Modifications in the way user-specified modules are loaded. Once we get the list of filenames from the libtool, we add the statically defined ones and then based on the include/exclude string we only keep the ones requested by the user. If no include/exclude was provided, we keep [as expected] everything. Once we have the list of whatever is requested we open them. Therefore, as an example, if the user specify "--mca pml ob1" we will never try to load/open/init DR nor CM.
There are several interesting things: 1. less NFS traffic [as we potentially access less files] 2. faster loading time [in case the user tune it's execution environment] 3. (1) + (2) -> faster startup time [at least everything which do not depend on the network] 4. MX bug will go away if the pml is specified. 5. No useless BTL will be opened, which will solve few others issues. This commit was SVN r15402.
Этот коммит содержится в:
родитель
24a28494a6
Коммит
59dc6b95f3
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -30,16 +30,14 @@
|
||||
#include "opal/mca/base/mca_base_param.h"
|
||||
#include "opal/mca/base/mca_base_msgbuf.h"
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/*
|
||||
* Structure for making plain lists of components
|
||||
*/
|
||||
struct mca_base_component_list_item_t {
|
||||
opal_list_item_t super;
|
||||
const mca_base_component_t *cli_component;
|
||||
opal_list_item_t super;
|
||||
const mca_base_component_t *cli_component;
|
||||
};
|
||||
typedef struct mca_base_component_list_item_t mca_base_component_list_item_t;
|
||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_component_list_item_t);
|
||||
@ -48,12 +46,11 @@ OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_component_list_item_t);
|
||||
* Structure for making priority lists of components
|
||||
*/
|
||||
struct mca_base_component_priority_list_item_t {
|
||||
mca_base_component_list_item_t super;
|
||||
|
||||
int cpli_priority;
|
||||
mca_base_component_list_item_t super;
|
||||
int cpli_priority;
|
||||
};
|
||||
typedef struct mca_base_component_priority_list_item_t
|
||||
mca_base_component_priority_list_item_t;
|
||||
mca_base_component_priority_list_item_t;
|
||||
|
||||
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_component_priority_list_item_t);
|
||||
|
||||
@ -66,85 +63,85 @@ OPAL_DECLSPEC extern int mca_base_param_component_path;
|
||||
* Public functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* First function called in the MCA.
|
||||
*
|
||||
* @return OPAL_SUCCESS Upon success
|
||||
* @return OPAL_ERROR Upon failure
|
||||
*
|
||||
* This function starts up the entire MCA. It initializes a bunch
|
||||
* of built-in MCA parameters, and initialized the MCA component
|
||||
* repository.
|
||||
*
|
||||
* It must be the first MCA function invoked. It is normally
|
||||
* invoked during ompi_mpi_init() and specifically invoked in the
|
||||
* special case of the laminfo command.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_open(void);
|
||||
/**
|
||||
* First function called in the MCA.
|
||||
*
|
||||
* @return OPAL_SUCCESS Upon success
|
||||
* @return OPAL_ERROR Upon failure
|
||||
*
|
||||
* This function starts up the entire MCA. It initializes a bunch
|
||||
* of built-in MCA parameters, and initialized the MCA component
|
||||
* repository.
|
||||
*
|
||||
* It must be the first MCA function invoked. It is normally
|
||||
* invoked during ompi_mpi_init() and specifically invoked in the
|
||||
* special case of the laminfo command.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_open(void);
|
||||
|
||||
/**
|
||||
* Last function called in the MCA
|
||||
*
|
||||
* @return OPAL_SUCCESS Upon success
|
||||
* @return OPAL_ERROR Upon failure
|
||||
*
|
||||
* This function closes down the entire MCA. It clears all MCA
|
||||
* parameters and closes down the MCA component respository.
|
||||
*
|
||||
* It must be the last MCA function invoked. It is normally invoked
|
||||
* during ompi_mpi_finalize() and specifically invoked during the
|
||||
* special case of the laminfo command.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_close(void);
|
||||
/**
|
||||
* Last function called in the MCA
|
||||
*
|
||||
* @return OPAL_SUCCESS Upon success
|
||||
* @return OPAL_ERROR Upon failure
|
||||
*
|
||||
* This function closes down the entire MCA. It clears all MCA
|
||||
* parameters and closes down the MCA component respository.
|
||||
*
|
||||
* It must be the last MCA function invoked. It is normally invoked
|
||||
* during ompi_mpi_finalize() and specifically invoked during the
|
||||
* special case of the laminfo command.
|
||||
*/
|
||||
OPAL_DECLSPEC int mca_base_close(void);
|
||||
|
||||
/* mca_base_cmd_line.c */
|
||||
/* mca_base_cmd_line.c */
|
||||
|
||||
OPAL_DECLSPEC int mca_base_cmd_line_setup(opal_cmd_line_t *cmd);
|
||||
OPAL_DECLSPEC int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd,
|
||||
char ***app_env,
|
||||
char ***global_env);
|
||||
OPAL_DECLSPEC int mca_base_cmd_line_setup(opal_cmd_line_t *cmd);
|
||||
OPAL_DECLSPEC int mca_base_cmd_line_process_args(opal_cmd_line_t *cmd,
|
||||
char ***app_env,
|
||||
char ***global_env);
|
||||
|
||||
/* mca_base_component_compare.c */
|
||||
|
||||
OPAL_DECLSPEC int mca_base_component_compare_priority(mca_base_component_priority_list_item_t *a,
|
||||
mca_base_component_priority_list_item_t *b);
|
||||
OPAL_DECLSPEC int mca_base_component_compare(const mca_base_component_t *a,
|
||||
const mca_base_component_t *b);
|
||||
OPAL_DECLSPEC int mca_base_component_compatible(const mca_base_component_t *a,
|
||||
const mca_base_component_t *b);
|
||||
/* mca_base_component_compare.c */
|
||||
|
||||
/* mca_base_component_find.c */
|
||||
OPAL_DECLSPEC int mca_base_component_compare_priority(mca_base_component_priority_list_item_t *a,
|
||||
mca_base_component_priority_list_item_t *b);
|
||||
OPAL_DECLSPEC int mca_base_component_compare(const mca_base_component_t *a,
|
||||
const mca_base_component_t *b);
|
||||
OPAL_DECLSPEC int mca_base_component_compatible(const mca_base_component_t *a,
|
||||
const mca_base_component_t *b);
|
||||
|
||||
OPAL_DECLSPEC int mca_base_component_find(const char *directory, const char *type,
|
||||
const mca_base_component_t *static_components[],
|
||||
opal_list_t *found_components,
|
||||
bool open_dso_components);
|
||||
/* mca_base_component_find.c */
|
||||
|
||||
/* mca_base_components_open.c */
|
||||
OPAL_DECLSPEC int mca_base_component_find(const char *directory, const char *type,
|
||||
const mca_base_component_t *static_components[],
|
||||
char **requested_component_names,
|
||||
bool include_mode,
|
||||
opal_list_t *found_components,
|
||||
bool open_dso_components);
|
||||
|
||||
OPAL_DECLSPEC 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);
|
||||
/* mca_base_components_open.c */
|
||||
|
||||
/* mca_base_components_close.c */
|
||||
|
||||
OPAL_DECLSPEC int mca_base_components_close(int output_id, opal_list_t *components_available,
|
||||
const mca_base_component_t *skip);
|
||||
OPAL_DECLSPEC 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);
|
||||
|
||||
/* mca_base_components_close.c */
|
||||
|
||||
OPAL_DECLSPEC int mca_base_components_close(int output_id, opal_list_t *components_available,
|
||||
const mca_base_component_t *skip);
|
||||
|
||||
#if 0
|
||||
/* JMS Not implemented yet */
|
||||
int mca_base_init_callback(mca_base_init_cb_t func);
|
||||
int mca_base_init_callbacks_invoke(void);
|
||||
int mca_base_component_select(int requested);
|
||||
|
||||
int mca_base_param_associate(int index, int keyval);
|
||||
int mca_base_param_lookup_int(int index, MPI_Comm comm);
|
||||
char *mca_base_param_lookup_string(int index, MPI_Comm comm);
|
||||
/* JMS Not implemented yet */
|
||||
int mca_base_init_callback(mca_base_init_cb_t func);
|
||||
int mca_base_init_callbacks_invoke(void);
|
||||
int mca_base_component_select(int requested);
|
||||
|
||||
int mca_base_param_associate(int index, int keyval);
|
||||
int mca_base_param_lookup_int(int index, MPI_Comm comm);
|
||||
char *mca_base_param_lookup_string(int index, MPI_Comm comm);
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_BASE_H */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -83,7 +83,8 @@ typedef struct ltfn_data_holder_t ltfn_data_holder_t;
|
||||
* Private functions
|
||||
*/
|
||||
static void find_dyn_components(const char *path, const char *type,
|
||||
const char *name, opal_list_t *found_components);
|
||||
const char **name, bool include_mode,
|
||||
opal_list_t *found_components);
|
||||
static int save_filename(const char *filename, lt_ptr data);
|
||||
static int open_component(component_file_item_t *target_file,
|
||||
opal_list_t *found_components);
|
||||
@ -116,44 +117,48 @@ static opal_list_t found_files;
|
||||
*/
|
||||
int mca_base_component_find(const char *directory, const char *type,
|
||||
const mca_base_component_t *static_components[],
|
||||
char **requested_component_names,
|
||||
bool include_mode,
|
||||
opal_list_t *found_components,
|
||||
bool open_dso_components)
|
||||
{
|
||||
int i;
|
||||
mca_base_component_list_item_t *cli;
|
||||
int i;
|
||||
mca_base_component_list_item_t *cli;
|
||||
|
||||
/* Find all the components that were statically linked in */
|
||||
/* Find all the components that were statically linked in */
|
||||
|
||||
OBJ_CONSTRUCT(found_components, opal_list_t);
|
||||
for (i = 0; NULL != static_components[i]; ++i) {
|
||||
cli = OBJ_NEW(mca_base_component_list_item_t);
|
||||
if (NULL == cli) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
OBJ_CONSTRUCT(found_components, opal_list_t);
|
||||
for (i = 0; NULL != static_components[i]; ++i) {
|
||||
cli = OBJ_NEW(mca_base_component_list_item_t);
|
||||
if (NULL == cli) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
cli->cli_component = static_components[i];
|
||||
opal_list_append(found_components, (opal_list_item_t *) cli);
|
||||
}
|
||||
cli->cli_component = static_components[i];
|
||||
opal_list_append(found_components, (opal_list_item_t *) cli);
|
||||
}
|
||||
|
||||
#if OMPI_WANT_LIBLTDL
|
||||
/* Find any available dynamic components in the specified directory */
|
||||
if (open_dso_components) {
|
||||
int param, param_disable_dlopen;
|
||||
param = mca_base_param_find("mca", NULL, "component_disable_dlopen");
|
||||
mca_base_param_lookup_int(param, ¶m_disable_dlopen);
|
||||
/* Find any available dynamic components in the specified directory */
|
||||
if (open_dso_components) {
|
||||
int param, param_disable_dlopen;
|
||||
param = mca_base_param_find("mca", NULL, "component_disable_dlopen");
|
||||
mca_base_param_lookup_int(param, ¶m_disable_dlopen);
|
||||
|
||||
if (0 == param_disable_dlopen) {
|
||||
find_dyn_components(directory, type, NULL, found_components);
|
||||
}
|
||||
} else {
|
||||
opal_output_verbose(40, 0,
|
||||
"mca: base: component_find: dso loading for %s MCA components disabled",
|
||||
type);
|
||||
}
|
||||
if (0 == param_disable_dlopen) {
|
||||
find_dyn_components(directory, type,
|
||||
(const char**)requested_component_names,
|
||||
include_mode, found_components);
|
||||
}
|
||||
} else {
|
||||
opal_output_verbose(40, 0,
|
||||
"mca: base: component_find: dso loading for %s MCA components disabled",
|
||||
type);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* All done */
|
||||
/* All done */
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
#if OMPI_WANT_LIBLTDL
|
||||
@ -170,89 +175,107 @@ int mca_base_component_find(const char *directory, const char *type,
|
||||
* finally opened in recursive dependency traversals.
|
||||
*/
|
||||
static void find_dyn_components(const char *path, const char *type_name,
|
||||
const char *name,
|
||||
const char **name, bool include_mode,
|
||||
opal_list_t *found_components)
|
||||
{
|
||||
ltfn_data_holder_t params;
|
||||
char *path_to_use, *dir, *end;
|
||||
component_file_item_t *file;
|
||||
opal_list_item_t *cur;
|
||||
ltfn_data_holder_t params;
|
||||
char *path_to_use, *dir, *end;
|
||||
component_file_item_t *file;
|
||||
opal_list_item_t *cur;
|
||||
|
||||
strcpy(params.type, type_name);
|
||||
strcpy(params.type, type_name);
|
||||
|
||||
if (NULL == name) {
|
||||
params.name[0] = '\0';
|
||||
opal_output_verbose(40, 0, "mca: base: component_find: looking for all dynamic %s MCA components",
|
||||
type_name);
|
||||
} else {
|
||||
strcpy(params.name, name);
|
||||
opal_output_verbose(40, 0,
|
||||
"mca: base: component_find: looking for dynamic %s MCA component named \"%s\"",
|
||||
type_name, name);
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
mca_base_param_lookup_string(mca_base_param_component_path, &path_to_use);
|
||||
if (NULL == path_to_use) {
|
||||
/* If there's no path, then there's nothing to search -- we're
|
||||
done */
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
path_to_use = strdup(path);
|
||||
}
|
||||
|
||||
/* Iterate over all the files in the directories in the path and
|
||||
make a master array of all the matching filenames that we
|
||||
find. */
|
||||
|
||||
OBJ_CONSTRUCT(&found_files, opal_list_t);
|
||||
dir = path_to_use;
|
||||
if (NULL != dir) {
|
||||
do {
|
||||
end = strchr(dir, OPAL_ENV_SEP);
|
||||
if (NULL != end) {
|
||||
*end = '\0';
|
||||
}
|
||||
if (0 != lt_dlforeachfile(dir, save_filename, ¶ms)) {
|
||||
break;
|
||||
}
|
||||
dir = end + 1;
|
||||
} while (NULL != end);
|
||||
}
|
||||
|
||||
/* Iterate through all the filenames that we found. 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. */
|
||||
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
/* 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) {
|
||||
mca_base_param_lookup_string(mca_base_param_component_path, &path_to_use);
|
||||
if (NULL == path_to_use) {
|
||||
/* If there's no path, then there's nothing to search -- we're
|
||||
done */
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
path_to_use = strdup(path);
|
||||
}
|
||||
|
||||
/* Iterate over all the files in the directories in the path and
|
||||
make a master array of all the matching filenames that we
|
||||
find. */
|
||||
|
||||
OBJ_CONSTRUCT(&found_files, opal_list_t);
|
||||
dir = path_to_use;
|
||||
if (NULL != dir) {
|
||||
do {
|
||||
end = strchr(dir, OPAL_ENV_SEP);
|
||||
if (NULL != end) {
|
||||
*end = '\0';
|
||||
}
|
||||
if (0 != lt_dlforeachfile(dir, save_filename, ¶ms)) {
|
||||
break;
|
||||
}
|
||||
dir = end + 1;
|
||||
} while (NULL != end);
|
||||
}
|
||||
|
||||
/* Iterate through all the filenames that we found. 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. */
|
||||
|
||||
/* All done, now let's cleanup */
|
||||
free(path_to_use);
|
||||
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;
|
||||
|
||||
OBJ_DESTRUCT(&found_files);
|
||||
if( UNVISITED == file->status ) {
|
||||
int i = 0;
|
||||
bool op = true;
|
||||
file->status = CHECKING_CYCLE;
|
||||
|
||||
if( NULL != name ) {
|
||||
if( false == include_mode) {
|
||||
/* exclude mode */
|
||||
for( i = 0; NULL != name[i]; i++ ) {
|
||||
if( 0 == strcmp(name[i], file->name) ){
|
||||
op = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* include mode */
|
||||
for( op = false, i = 0; NULL != name[i]; i++ ) {
|
||||
if( 0 == strcmp(name[i], file->name) ){
|
||||
op = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/* All done, now let's cleanup */
|
||||
free(path_to_use);
|
||||
|
||||
OBJ_DESTRUCT(&found_files);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
* Copyright (c) 2004-2007 The University of Tennessee and The University
|
||||
* of Tennessee Research Foundation. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
@ -39,6 +39,17 @@ struct component_name_t {
|
||||
};
|
||||
typedef struct component_name_t component_name_t;
|
||||
|
||||
/*
|
||||
* 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_1_0_0_t data;
|
||||
};
|
||||
typedef struct mca_base_open_only_dummy_component_t mca_base_open_only_dummy_component_t;
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
@ -53,10 +64,6 @@ static int parse_requested(int mca_param, bool *include_mode,
|
||||
char ***requested_component_names);
|
||||
static int open_components(const char *type_name, int output_id,
|
||||
opal_list_t *src, opal_list_t *dest);
|
||||
static int distill(bool include_mode, const char *type_name,
|
||||
int output_id, opal_list_t *src, opal_list_t *dest,
|
||||
char **names);
|
||||
|
||||
|
||||
/**
|
||||
* Function for finding and opening either all MCA components, or the
|
||||
@ -67,92 +74,146 @@ int mca_base_components_open(const char *type_name, int output_id,
|
||||
opal_list_t *components_available,
|
||||
bool open_dso_components)
|
||||
{
|
||||
int ret, param;
|
||||
opal_list_item_t *item;
|
||||
opal_list_t components_found, components_distilled;
|
||||
char **requested_component_names;
|
||||
int param_verbose = -1;
|
||||
int param_type = -1;
|
||||
int verbose_level;
|
||||
char *str;
|
||||
bool include_mode;
|
||||
bool distilled = false;
|
||||
int ret, param;
|
||||
opal_list_item_t *item, *next;
|
||||
opal_list_t components_found;
|
||||
char **requested_component_names;
|
||||
int param_verbose = -1;
|
||||
int param_type = -1;
|
||||
int verbose_level;
|
||||
char *str;
|
||||
bool include_mode;
|
||||
uint32_t open_only_flags = MCA_BASE_METADATA_PARAM_NONE;
|
||||
const mca_base_component_t *component;
|
||||
|
||||
/* Register MCA parameters */
|
||||
/* Check to see if it exists first */
|
||||
if( 0 > (param_type = mca_base_param_find(type_name, NULL, NULL) ) ) {
|
||||
asprintf(&str, "Default selection set of components for the %s framework (<none>"
|
||||
" means use all components that can be found)", type_name);
|
||||
param_type =
|
||||
mca_base_param_reg_string_name(type_name, NULL, str,
|
||||
false, false, NULL, NULL);
|
||||
free(str);
|
||||
}
|
||||
|
||||
/* Register MCA parameters */
|
||||
/* Check to see if it exists first */
|
||||
if( 0 > (param_type = mca_base_param_find(type_name, NULL, NULL) ) ) {
|
||||
asprintf(&str, "Default selection set of components for the %s framework (<none> means \"use all components that can be found\")", type_name);
|
||||
param_type =
|
||||
mca_base_param_reg_string_name(type_name, NULL, str,
|
||||
false, false, NULL, NULL);
|
||||
free(str);
|
||||
}
|
||||
param = mca_base_param_find("mca", NULL, "component_show_load_errors");
|
||||
mca_base_param_lookup_int(param, &ret);
|
||||
show_errors = OPAL_INT_TO_BOOL(ret);
|
||||
|
||||
asprintf(&str, "Verbosity level for the %s framework (0 = no verbosity)", type_name);
|
||||
param_verbose =
|
||||
mca_base_param_reg_int_name(type_name, "base_verbose",
|
||||
str, false, false, 0, NULL);
|
||||
free(str);
|
||||
/* Setup verbosity for this MCA type */
|
||||
asprintf(&str, "Verbosity level for the %s framework (0 = no verbosity)", type_name);
|
||||
param_verbose =
|
||||
mca_base_param_reg_int_name(type_name, "base_verbose",
|
||||
str, false, false, 0, NULL);
|
||||
free(str);
|
||||
mca_base_param_lookup_int(param_verbose, &verbose_level);
|
||||
if (output_id != 0) {
|
||||
opal_output_set_verbosity(output_id, verbose_level);
|
||||
}
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: Looking for %s components",
|
||||
type_name);
|
||||
|
||||
param = mca_base_param_find("mca", NULL, "component_show_load_errors");
|
||||
mca_base_param_lookup_int(param, &ret);
|
||||
show_errors = OPAL_INT_TO_BOOL(ret);
|
||||
ret = parse_requested(param_type, &include_mode, &requested_component_names);
|
||||
if( OPAL_SUCCESS != ret ) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Setup verbosity for this MCA type */
|
||||
/* Find and load requested components */
|
||||
if (OPAL_SUCCESS !=
|
||||
mca_base_component_find(NULL, type_name, static_components,
|
||||
requested_component_names, include_mode,
|
||||
&components_found, open_dso_components)) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
mca_base_param_lookup_int(param_verbose, &verbose_level);
|
||||
if (output_id != 0) {
|
||||
opal_output_set_verbosity(output_id, verbose_level);
|
||||
}
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: Looking for %s components",
|
||||
type_name);
|
||||
#if (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1)
|
||||
{
|
||||
int param_id = -1;
|
||||
int param_val = 0;
|
||||
/*
|
||||
* Extract supported mca parameters for selection contraints
|
||||
* Supported Options:
|
||||
* - mca_base_component_distill_checkpoint_ready = Checkpoint Ready
|
||||
*/
|
||||
param_id = mca_base_param_reg_int_name("mca", "base_component_distill_checkpoint_ready",
|
||||
"Distill only those components that are Checkpoint Ready",
|
||||
false, false,
|
||||
0, ¶m_val);
|
||||
if( 0 != param_val ) { /* Select Checkpoint Ready */
|
||||
open_only_flags |= MCA_BASE_METADATA_PARAM_CHECKPOINT;
|
||||
}
|
||||
}
|
||||
#endif /* (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1) */
|
||||
|
||||
/* Find and load all available components */
|
||||
/*
|
||||
* Pre-process the list with parameter constraints
|
||||
* e.g., If requested to select only CR enabled components
|
||||
* then only make available those components.
|
||||
*/
|
||||
if( !(MCA_BASE_METADATA_PARAM_NONE & open_only_flags) ) {
|
||||
#if (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1)
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & open_only_flags) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"including only %s components that are checkpoint enabled", type_name);
|
||||
}
|
||||
#endif /* (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1) */
|
||||
|
||||
for(item = opal_list_get_first(&components_found);
|
||||
item != opal_list_get_end(&components_found);
|
||||
item = next ) {
|
||||
mca_base_open_only_dummy_component_t *dummy;
|
||||
mca_base_component_list_item_t *cli = (mca_base_component_list_item_t *) item;
|
||||
dummy = (mca_base_open_only_dummy_component_t*) cli->cli_component;
|
||||
component = cli->cli_component;
|
||||
|
||||
next = opal_list_get_next(item);
|
||||
|
||||
#if (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1)
|
||||
/*
|
||||
* If the user asked for a checkpoint enabled run
|
||||
* then only load checkpoint enabled components.
|
||||
*/
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & open_only_flags) {
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"(%s) Component %s is Checkpointable",
|
||||
type_name,
|
||||
dummy->version.mca_component_name);
|
||||
}
|
||||
else {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"(%s) Component %s is *NOT* Checkpointable - Disabled",
|
||||
type_name,
|
||||
dummy->version.mca_component_name);
|
||||
opal_list_remove_item(&components_found, item);
|
||||
}
|
||||
}
|
||||
#endif /* (OPAL_ENABLE_FT == 1) && (OPAL_ENABLE_FT_CR == 1) */
|
||||
}
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS !=
|
||||
mca_base_component_find(NULL, type_name, static_components,
|
||||
&components_found, open_dso_components)) {
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
/* Open all remaining components */
|
||||
ret = open_components(type_name, output_id,
|
||||
&components_found, components_available);
|
||||
|
||||
/* See if one or more specific components were requested */
|
||||
/* Free resources */
|
||||
for (item = opal_list_remove_first(&components_found); NULL != item;
|
||||
item = opal_list_remove_first(&components_found)) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_DESTRUCT(&components_found);
|
||||
|
||||
ret = parse_requested(param_type, &include_mode, &requested_component_names);
|
||||
if (OPAL_SUCCESS == ret) {
|
||||
ret = distill(include_mode, type_name, output_id, &components_found,
|
||||
&components_distilled, requested_component_names);
|
||||
distilled = true;
|
||||
}
|
||||
if (NULL != requested_component_names) {
|
||||
opal_argv_free(requested_component_names);
|
||||
}
|
||||
|
||||
/* Now open whatever we have left */
|
||||
|
||||
if (OPAL_SUCCESS == ret) {
|
||||
ret = open_components(type_name, output_id,
|
||||
&components_distilled, components_available);
|
||||
}
|
||||
|
||||
/* Free resources */
|
||||
|
||||
for (item = opal_list_remove_first(&components_found); NULL != item;
|
||||
item = opal_list_remove_first(&components_found)) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_DESTRUCT(&components_found);
|
||||
if (distilled) {
|
||||
for (item = opal_list_remove_first(&components_distilled); NULL != item;
|
||||
item = opal_list_remove_first(&components_distilled)) {
|
||||
OBJ_RELEASE(item);
|
||||
}
|
||||
OBJ_DESTRUCT(&components_distilled);
|
||||
}
|
||||
if (NULL != requested_component_names) {
|
||||
opal_argv_free(requested_component_names);
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return ret;
|
||||
/* All done */
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -209,212 +270,6 @@ static int parse_requested(int mca_param, bool *include_mode,
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dummy structure for casting in distill
|
||||
*/
|
||||
struct mca_base_distill_dummy_component_t {
|
||||
/** MCA base component */
|
||||
mca_base_component_t version;
|
||||
/** MCA base data */
|
||||
mca_base_component_data_1_0_0_t data;
|
||||
};
|
||||
typedef struct mca_base_distill_dummy_component_t mca_base_distill_dummy_component_t;
|
||||
|
||||
|
||||
/*
|
||||
* Parse the list of found components and factor in the included /
|
||||
* excluded names to come up with a distilled list of components that
|
||||
* we should try to open.
|
||||
*/
|
||||
static int distill(bool include_mode, const char *type_name,
|
||||
int output_id, opal_list_t *src, opal_list_t *dest,
|
||||
char **names)
|
||||
{
|
||||
int i;
|
||||
bool good;
|
||||
opal_list_item_t *item, *next;
|
||||
const mca_base_component_t *component;
|
||||
mca_base_component_list_item_t *cli;
|
||||
uint32_t open_only_flags = MCA_BASE_METADATA_PARAM_NONE;
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
int param_id = -1;
|
||||
int param_val = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"distilling %s components", type_name);
|
||||
OBJ_CONSTRUCT(dest, opal_list_t);
|
||||
|
||||
/*
|
||||
* Extract supported mca parameters for selection contraints
|
||||
* Supported Options:
|
||||
* - mca_base_component_distill_checkpoint_ready = Checkpoint Ready
|
||||
*/
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
param_id = mca_base_param_reg_int_name("mca", "base_component_distill_checkpoint_ready",
|
||||
"Distill only those components that are Checkpoint Ready",
|
||||
false, false,
|
||||
0, ¶m_val);
|
||||
if( 0 != param_val ) { /* Select Checkpoint Ready */
|
||||
open_only_flags |= MCA_BASE_METADATA_PARAM_CHECKPOINT;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pre-process the list with parameter constraints
|
||||
* e.g., If requested to select only CR enabled components
|
||||
* then only make available those components.
|
||||
*/
|
||||
if( !(MCA_BASE_METADATA_PARAM_NONE & open_only_flags) ) {
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & open_only_flags) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"including only %s components that are checkpoint enabled", type_name);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for(item = opal_list_get_first(src);
|
||||
item != opal_list_get_end(src);
|
||||
item = next ) {
|
||||
mca_base_distill_dummy_component_t *dummy;
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
dummy = (mca_base_distill_dummy_component_t*) cli->cli_component;
|
||||
component = cli->cli_component;
|
||||
|
||||
next = opal_list_get_next(item);
|
||||
|
||||
#if OPAL_ENABLE_FT == 1
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
/*
|
||||
* If the user asked for a checkpoint enabled run
|
||||
* then only load checkpoint enabled components.
|
||||
*/
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & open_only_flags) {
|
||||
if( MCA_BASE_METADATA_PARAM_CHECKPOINT & dummy->data.param_field) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"(%s) Component %s is Checkpointable",
|
||||
type_name,
|
||||
dummy->version.mca_component_name);
|
||||
}
|
||||
else {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"(%s) Component %s is *NOT* Checkpointable - Disabled",
|
||||
type_name,
|
||||
dummy->version.mca_component_name);
|
||||
opal_list_remove_item(src, item);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Bozo case */
|
||||
|
||||
if (NULL == names) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"accepting all %s components", type_name);
|
||||
opal_list_join(dest, opal_list_get_end(dest), src);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Are we including components? */
|
||||
|
||||
if (include_mode) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"including %s components", type_name);
|
||||
|
||||
/* Go through all the components and only keep the ones that
|
||||
are specifically mentioned in the list */
|
||||
|
||||
for (i = 0; NULL != names[i]; ++i) {
|
||||
good = false;
|
||||
|
||||
for (item = opal_list_get_first(src);
|
||||
opal_list_get_end(src) != item;
|
||||
item = next) {
|
||||
next = opal_list_get_next(item);
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = cli->cli_component;
|
||||
if (0 == strcmp(names[i], component->mca_component_name)) {
|
||||
opal_list_remove_item(src, item);
|
||||
opal_list_append(dest, item);
|
||||
good = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (good) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"%s --> included", names[i]);
|
||||
} else {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"%s --> not found", names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* No, we are excluding components */
|
||||
|
||||
else {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"excluding %s components", type_name);
|
||||
|
||||
/* Go through all the components and only keep the ones that
|
||||
are specifically mentioned in the list */
|
||||
|
||||
for (item = opal_list_get_first(src);
|
||||
opal_list_get_end(src) != item;
|
||||
item = next) {
|
||||
next = opal_list_get_next(item);
|
||||
good = true;
|
||||
cli = (mca_base_component_list_item_t *) item;
|
||||
component = cli->cli_component;
|
||||
|
||||
for (i = 0; NULL != names[i]; ++i) {
|
||||
if (0 == strcmp(names[i], component->mca_component_name)) {
|
||||
good = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!good) {
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"%s --> excluded",
|
||||
component->mca_component_name);
|
||||
} else {
|
||||
opal_list_remove_item(src, item);
|
||||
opal_list_append(dest, item);
|
||||
opal_output_verbose(10, output_id,
|
||||
"mca: base: components_open: "
|
||||
"%s --> included",
|
||||
component->mca_component_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* All done */
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Traverse the entire list of found components (a list of
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user