2004-06-14 21:05:53 +00:00
|
|
|
/*
|
2004-11-22 01:38:40 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-14 21:05:53 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include "runtime/runtime.h"
|
2004-06-16 15:41:29 +00:00
|
|
|
#include "util/output.h"
|
2004-06-14 21:05:53 +00:00
|
|
|
#include "mca/mca.h"
|
|
|
|
#include "mca/base/base.h"
|
2004-06-15 19:07:45 +00:00
|
|
|
#include "mca/mpool/mpool.h"
|
|
|
|
#include "mca/mpool/base/base.h"
|
2004-06-14 21:05:53 +00:00
|
|
|
|
|
|
|
|
2004-06-16 15:41:29 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_mpool_base_selected_module_t, ompi_list_item_t, NULL, NULL);
|
|
|
|
|
|
|
|
|
2004-06-14 21:05:53 +00:00
|
|
|
/**
|
2004-06-15 19:07:45 +00:00
|
|
|
* Function for weeding out mpool modules that don't want to run.
|
2004-06-14 21:05:53 +00:00
|
|
|
*
|
2004-06-17 16:13:20 +00:00
|
|
|
* Call the init function on all available components to find out if they
|
|
|
|
* want to run. Select all components that don't fail. Failing modules
|
2004-06-14 21:05:53 +00:00
|
|
|
* will be closed and unloaded. The selected modules will be returned
|
|
|
|
* to the caller in a ompi_list_t.
|
|
|
|
*/
|
2004-06-16 15:41:29 +00:00
|
|
|
int mca_mpool_base_init(bool *allow_multi_user_threads)
|
2004-06-14 21:05:53 +00:00
|
|
|
{
|
2004-06-16 15:41:29 +00:00
|
|
|
bool user_threads;
|
2004-06-14 21:05:53 +00:00
|
|
|
ompi_list_item_t *item;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_list_item_t *cli;
|
2004-06-16 15:41:29 +00:00
|
|
|
mca_mpool_base_component_t *component;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_mpool_base_module_t *module;
|
2004-06-15 19:07:45 +00:00
|
|
|
mca_mpool_base_selected_module_t *sm;
|
2004-06-14 21:05:53 +00:00
|
|
|
|
2004-06-23 15:52:28 +00:00
|
|
|
/* Default to true in case there's no modules selected */
|
|
|
|
|
|
|
|
*allow_multi_user_threads = true;
|
|
|
|
|
2004-06-14 21:05:53 +00:00
|
|
|
/* Traverse the list of available modules; call their init
|
|
|
|
functions. */
|
|
|
|
|
2004-06-17 16:13:20 +00:00
|
|
|
for (item = ompi_list_get_first(&mca_mpool_base_components);
|
|
|
|
ompi_list_get_end(&mca_mpool_base_components) != item;
|
2004-06-14 21:05:53 +00:00
|
|
|
item = ompi_list_get_next(item)) {
|
2004-08-02 00:24:22 +00:00
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = (mca_mpool_base_component_t *) cli->cli_component;
|
2004-06-14 21:05:53 +00:00
|
|
|
|
2004-06-15 19:07:45 +00:00
|
|
|
ompi_output_verbose(10, mca_mpool_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: initializing %s module %s",
|
|
|
|
component->mpool_version.mca_type_name,
|
|
|
|
component->mpool_version.mca_component_name);
|
2004-06-16 15:41:29 +00:00
|
|
|
if (NULL == component->mpool_init) {
|
2004-06-15 19:07:45 +00:00
|
|
|
ompi_output_verbose(10, mca_mpool_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: no init function; ignoring module");
|
2004-06-14 21:05:53 +00:00
|
|
|
} else {
|
2004-06-16 15:41:29 +00:00
|
|
|
module = component->mpool_init(&user_threads);
|
2004-06-14 21:05:53 +00:00
|
|
|
|
|
|
|
/* If the module didn't initialize, unload it */
|
|
|
|
|
2004-06-16 15:41:29 +00:00
|
|
|
if (NULL == module) {
|
2004-06-15 19:07:45 +00:00
|
|
|
ompi_output_verbose(10, mca_mpool_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: init returned failure");
|
2004-06-14 21:05:53 +00:00
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_repository_release((mca_base_component_t *) component);
|
2004-06-15 19:07:45 +00:00
|
|
|
ompi_output_verbose(10, mca_mpool_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: component %s unloaded",
|
|
|
|
component->mpool_version.mca_component_name);
|
2004-06-14 21:05:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, it initialized properly. Save it. */
|
|
|
|
|
|
|
|
else {
|
2004-06-17 16:13:20 +00:00
|
|
|
*allow_multi_user_threads &= user_threads;
|
|
|
|
ompi_output_verbose(10, mca_mpool_base_output,
|
2004-06-14 21:05:53 +00:00
|
|
|
"select: init returned success");
|
|
|
|
|
2004-06-16 15:41:29 +00:00
|
|
|
sm = OBJ_NEW(mca_mpool_base_selected_module_t);
|
|
|
|
sm->mpool_component = component;
|
|
|
|
sm->mpool_module = module;
|
2004-06-17 16:13:20 +00:00
|
|
|
ompi_list_append(&mca_mpool_base_modules, (ompi_list_item_t*) sm);
|
2004-06-14 21:05:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2004-06-16 15:41:29 +00:00
|
|
|
|
2004-06-17 16:13:20 +00:00
|
|
|
|