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(
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_t,
|
2004-07-01 14:49:54 +00:00
|
|
|
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
|
|
|
|
2004-08-02 21:24:00 +00:00
|
|
|
ompi_process_name_t mca_oob_name_seed;
|
|
|
|
ompi_process_name_t mca_oob_name_self;
|
|
|
|
ompi_process_name_t mca_oob_name_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 21:24:00 +00:00
|
|
|
mca_oob_t *module;
|
2004-08-02 00:24:22 +00:00
|
|
|
extern ompi_list_t mca_oob_base_components;
|
2004-07-01 14:49:54 +00:00
|
|
|
ompi_process_name_t *self;
|
|
|
|
|
|
|
|
/* setup local name */
|
2004-08-02 21:24:00 +00:00
|
|
|
OBJ_CONSTRUCT(&mca_oob_name_self, ompi_process_name_t);
|
2004-07-01 14:49:54 +00:00
|
|
|
self = mca_pcm.pcm_self();
|
|
|
|
if(NULL == self) {
|
2004-08-07 20:07:25 +00:00
|
|
|
ompi_output(0, "mca_oob_base_init: could not get PCM self pointer");
|
2004-07-01 14:49:54 +00:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_name_self = *self;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
/* setup wildcard name */
|
2004-08-02 21:24:00 +00:00
|
|
|
OBJ_CONSTRUCT(&mca_oob_name_any, ompi_process_name_t);
|
|
|
|
mca_oob_name_any.cellid = -1;
|
|
|
|
mca_oob_name_any.jobid = -1;
|
|
|
|
mca_oob_name_any.vpid = -1;
|
|
|
|
|
|
|
|
/* setup seed daemons name */
|
|
|
|
OBJ_CONSTRUCT(&mca_oob_name_seed, ompi_process_name_t);
|
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
|
|
|
}
|
|
|
|
|
2004-08-10 22:11:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtains the contact info (oob implementation specific) URI strings through
|
|
|
|
* which this process can be contacted on an OOB channel.
|
|
|
|
*
|
2004-08-10 22:30:21 +00:00
|
|
|
* @return A null terminated string.
|
2004-08-10 22:11:31 +00:00
|
|
|
*
|
2004-08-10 22:30:21 +00:00
|
|
|
* The caller is responsible for freeing the returned string.
|
2004-08-10 22:11:31 +00:00
|
|
|
*/
|
|
|
|
|
2004-08-10 22:30:21 +00:00
|
|
|
char* mca_oob_get_contact_info()
|
2004-08-10 22:11:31 +00:00
|
|
|
{
|
2004-08-10 22:30:21 +00:00
|
|
|
return strdup("tcp:localhost:5000");
|
2004-08-10 22:11:31 +00:00
|
|
|
}
|