2004-01-30 03:55:39 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
#include "ompi_config.h"
|
2004-01-30 03:55:39 +00:00
|
|
|
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "runtime/runtime.h"
|
2004-01-30 03:55:39 +00:00
|
|
|
#include "mca/mca.h"
|
2004-03-17 18:45:16 +00:00
|
|
|
#include "mca/base/base.h"
|
|
|
|
#include "mca/ptl/ptl.h"
|
|
|
|
#include "mca/ptl/base/base.h"
|
2004-01-30 03:55:39 +00:00
|
|
|
|
|
|
|
|
2004-01-30 23:02:39 +00:00
|
|
|
/**
|
2004-08-02 00:24:22 +00:00
|
|
|
* Function for weeding out ptl components that don't want to run.
|
2004-01-30 23:02:39 +00:00
|
|
|
*
|
2004-08-02 00:24:22 +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
|
|
|
|
* components will be closed and unloaded. The selected modules will
|
|
|
|
* be returned to the caller in a ompi_list_t.
|
2004-01-30 23:02:39 +00:00
|
|
|
*/
|
2004-01-31 21:45:32 +00:00
|
|
|
int mca_ptl_base_select(bool *allow_multi_user_threads,
|
|
|
|
bool *have_hidden_threads)
|
2004-01-30 03:55:39 +00:00
|
|
|
{
|
2004-01-30 23:02:39 +00:00
|
|
|
int i, num_ptls;
|
2004-01-31 21:45:32 +00:00
|
|
|
bool user_threads, hidden_threads;
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_list_item_t *item;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_list_item_t *cli;
|
|
|
|
mca_ptl_base_component_t *component;
|
|
|
|
mca_ptl_base_module_t **modules;
|
2004-01-30 23:02:39 +00:00
|
|
|
mca_ptl_base_selected_module_t *sm;
|
|
|
|
|
2004-08-11 18:25:24 +00:00
|
|
|
/* Traverse the list of opened modules; call their init
|
2004-01-30 23:02:39 +00:00
|
|
|
functions. */
|
|
|
|
|
2004-08-11 18:25:24 +00:00
|
|
|
for (item = ompi_list_remove_first(&mca_ptl_base_components_opened);
|
|
|
|
NULL != item;
|
|
|
|
item = ompi_list_remove_first(&mca_ptl_base_components_opened)) {
|
2004-08-02 00:24:22 +00:00
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = (mca_ptl_base_component_t *) cli->cli_component;
|
2004-01-30 23:02:39 +00:00
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_output_verbose(10, mca_ptl_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: initializing %s component %s",
|
|
|
|
component->ptlm_version.mca_type_name,
|
|
|
|
component->ptlm_version.mca_component_name);
|
|
|
|
if (NULL == component->ptlm_init) {
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_output_verbose(10, mca_ptl_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: no init function; ignoring component");
|
2004-01-30 23:02:39 +00:00
|
|
|
} else {
|
2004-08-02 00:24:22 +00:00
|
|
|
modules = component->ptlm_init(&num_ptls, &user_threads,
|
2004-08-11 18:25:24 +00:00
|
|
|
&hidden_threads);
|
2004-01-30 23:02:39 +00:00
|
|
|
|
2004-08-11 18:25:24 +00:00
|
|
|
/* If the component didn't initialize, remove it from the opened
|
|
|
|
list and remove it from the component repository */
|
2004-01-30 23:02:39 +00:00
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
if (NULL == modules) {
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_output_verbose(10, mca_ptl_base_output,
|
2004-01-30 23:02:39 +00:00
|
|
|
"select: init returned failure");
|
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_repository_release((mca_base_component_t *) component);
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_output_verbose(10, mca_ptl_base_output,
|
2004-08-02 00:24:22 +00:00
|
|
|
"select: module %s unloaded",
|
|
|
|
component->ptlm_version.mca_component_name);
|
2004-01-30 23:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Otherwise, it initialized properly. Save it. */
|
|
|
|
|
|
|
|
else {
|
2004-06-17 15:08:07 +00:00
|
|
|
*allow_multi_user_threads &= user_threads;
|
2004-01-31 21:45:32 +00:00
|
|
|
*have_hidden_threads |= hidden_threads;
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
ompi_output_verbose(10, mca_ptl_base_output,
|
2004-01-30 23:02:39 +00:00
|
|
|
"select: init returned success");
|
|
|
|
|
|
|
|
for (i = 0; i < num_ptls; ++i) {
|
2004-02-10 00:09:36 +00:00
|
|
|
sm = malloc(sizeof(mca_ptl_base_selected_module_t));
|
2004-01-30 23:02:39 +00:00
|
|
|
if (NULL == sm) {
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2004-01-30 23:02:39 +00:00
|
|
|
}
|
2004-06-07 15:33:53 +00:00
|
|
|
OBJ_CONSTRUCT(sm, ompi_list_item_t);
|
2004-08-02 00:24:22 +00:00
|
|
|
sm->pbsm_component = component;
|
|
|
|
sm->pbsm_module = modules[i];
|
2004-08-11 18:25:24 +00:00
|
|
|
ompi_list_append(&mca_ptl_base_modules_initialized,
|
2004-06-07 15:33:53 +00:00
|
|
|
(ompi_list_item_t*) sm);
|
2004-01-30 23:02:39 +00:00
|
|
|
}
|
2004-08-02 00:24:22 +00:00
|
|
|
free(modules);
|
2004-01-30 23:02:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
/* Finished querying all components. Check for the bozo case. */
|
2004-01-30 23:02:39 +00:00
|
|
|
|
2004-08-11 18:25:24 +00:00
|
|
|
if (0 == ompi_list_get_size(&mca_ptl_base_modules_initialized)) {
|
2004-01-30 23:02:39 +00:00
|
|
|
/* JMS Replace with show_help */
|
2004-08-02 00:24:22 +00:00
|
|
|
ompi_abort(1, "No ptl components available. This shouldn't happen.");
|
2004-01-30 23:02:39 +00:00
|
|
|
}
|
|
|
|
|
2004-01-30 03:55:39 +00:00
|
|
|
/* All done */
|
|
|
|
|
2004-06-07 15:33:53 +00:00
|
|
|
return OMPI_SUCCESS;
|
2004-01-30 03:55:39 +00:00
|
|
|
}
|