2004-07-01 14:49:54 +00:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "util/output.h"
|
|
|
|
#include "mca/mca.h"
|
|
|
|
#include "mca/base/base.h"
|
|
|
|
#include "mca/pcm/pcm.h"
|
|
|
|
#include "mca/oob/oob.h"
|
|
|
|
#include "mca/oob/base/base.h"
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_oob_base_module_t,
|
|
|
|
ompi_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|
2004-08-02 00:24:22 +00:00
|
|
|
OBJ_CLASS_INSTANCE(
|
|
|
|
mca_oob_base_info_t,
|
|
|
|
ompi_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
ompi_process_name_t mca_oob_base_self;
|
2004-08-02 00:24:22 +00:00
|
|
|
ompi_process_name_t mca_oob_base_any;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function for selecting one module from all those that are
|
|
|
|
* available.
|
|
|
|
*
|
|
|
|
* Call the init function on all available modules.
|
|
|
|
*/
|
|
|
|
int mca_oob_base_init(bool *user_threads, bool *hidden_threads)
|
|
|
|
{
|
|
|
|
ompi_list_item_t *item;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_list_item_t *cli;
|
|
|
|
mca_oob_base_info_t * first;
|
2004-07-01 14:49:54 +00:00
|
|
|
mca_oob_base_component_t *component;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_oob_base_module_t *module;
|
|
|
|
extern ompi_list_t mca_oob_base_components;
|
2004-07-01 14:49:54 +00:00
|
|
|
ompi_process_name_t *self;
|
|
|
|
|
|
|
|
/* setup local name */
|
|
|
|
self = mca_pcm.pcm_self();
|
|
|
|
if(NULL == self) {
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
mca_oob_base_self = *self;
|
|
|
|
|
|
|
|
/* setup wildcard name */
|
|
|
|
mca_oob_base_any.cellid = -1;
|
|
|
|
mca_oob_base_any.jobid = -1;
|
2004-07-08 14:48:34 +00:00
|
|
|
mca_oob_base_any.vpid = -1;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
/* Traverse the list of available modules; call their init functions. */
|
|
|
|
for (item = ompi_list_get_first(&mca_oob_base_components);
|
|
|
|
item != ompi_list_get_end(&mca_oob_base_components);
|
|
|
|
item = ompi_list_get_next(item)) {
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_oob_base_info_t *inited;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
2004-08-02 00:24:22 +00:00
|
|
|
cli = (mca_base_component_list_item_t *) item;
|
|
|
|
component = (mca_oob_base_component_t *) cli->cli_component;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
if (NULL == component->oob_init) {
|
|
|
|
ompi_output_verbose(10, mca_oob_base_output, "mca_oob_base_init: no init function; ignoring component");
|
|
|
|
} else {
|
|
|
|
module = component->oob_init(user_threads, hidden_threads);
|
|
|
|
if (NULL == module) {
|
|
|
|
ompi_output_verbose(10, mca_oob_base_output, "mca_oob_base_init: oob_init returned failure");
|
2004-07-13 04:42:34 +00:00
|
|
|
} else {
|
2004-08-02 00:24:22 +00:00
|
|
|
inited = OBJ_NEW(mca_oob_base_info_t);
|
2004-07-13 04:42:34 +00:00
|
|
|
inited->oob_component = component;
|
|
|
|
inited->oob_module = module;
|
|
|
|
ompi_list_append(&mca_oob_base_modules, &inited->super);
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* set the global variable to point to the first initialize module */
|
2004-07-13 04:42:34 +00:00
|
|
|
if (0 < ompi_list_get_size(&mca_oob_base_modules)) {
|
2004-08-02 00:24:22 +00:00
|
|
|
first = (mca_oob_base_info_t *) ompi_list_get_first(&mca_oob_base_modules);
|
2004-07-13 04:42:34 +00:00
|
|
|
mca_oob = *first->oob_module;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
} else {
|
|
|
|
printf("No OOB modules available!\n");
|
|
|
|
fflush(stdout);
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
|