2004-07-01 14:49:54 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-23 03:32:36 +00:00
|
|
|
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
2005-11-05 19:57:48 +00:00
|
|
|
* of Tennessee Research Foundation. 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.
|
2007-06-10 14:16:05 +00:00
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
2013-03-27 21:14:43 +00:00
|
|
|
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
|
2012-06-08 01:23:08 +00:00
|
|
|
* reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-07-01 14:49:54 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2005-03-18 03:43:59 +00:00
|
|
|
#include "orte_config.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
#include "orte/constants.h"
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2004-11-05 07:52:30 +00:00
|
|
|
#include <string.h>
|
2004-07-01 14:49:54 +00:00
|
|
|
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "opal/mca/mca.h"
|
2009-02-14 02:26:12 +00:00
|
|
|
#include "opal/util/output.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "opal/mca/base/base.h"
|
2008-02-28 01:57:57 +00:00
|
|
|
|
2012-06-08 01:23:08 +00:00
|
|
|
#include "orte/runtime/orte_globals.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "orte/mca/oob/oob.h"
|
|
|
|
#include "orte/mca/oob/base/base.h"
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_t,
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t,
|
2004-07-01 14:49:54 +00:00
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
);
|
2004-08-18 15:51:40 +00:00
|
|
|
|
2004-08-16 19:39:54 +00:00
|
|
|
|
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.
|
|
|
|
*/
|
2005-03-14 20:57:21 +00:00
|
|
|
int mca_oob_base_init(void)
|
2004-07-01 14:49:54 +00:00
|
|
|
{
|
2005-07-03 16:22:16 +00:00
|
|
|
opal_list_item_t *item;
|
2004-08-02 00:24:22 +00:00
|
|
|
mca_base_component_list_item_t *cli;
|
2013-05-14 21:58:40 +00:00
|
|
|
mca_oob_base_component_t *component, *s_component=NULL;
|
2004-08-02 21:24:00 +00:00
|
|
|
mca_oob_t *module;
|
2004-08-28 01:15:19 +00:00
|
|
|
mca_oob_t *s_module = NULL;
|
|
|
|
int s_priority = -1;
|
2004-07-01 14:49:54 +00:00
|
|
|
|
|
|
|
/* Traverse the list of available modules; call their init functions. */
|
2013-03-27 21:14:43 +00:00
|
|
|
for (item = opal_list_get_first(&orte_oob_base_framework.framework_components);
|
|
|
|
item != opal_list_get_end(&orte_oob_base_framework.framework_components);
|
|
|
|
item = opal_list_get_next(item)) {
|
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) {
|
2013-03-27 21:14:43 +00:00
|
|
|
opal_output_verbose(10, orte_oob_base_framework.framework_output,
|
|
|
|
"mca_oob_base_init: no init function; ignoring component");
|
2004-07-01 14:49:54 +00:00
|
|
|
} else {
|
2004-08-28 01:15:19 +00:00
|
|
|
int priority = -1;
|
2005-03-14 20:57:21 +00:00
|
|
|
module = component->oob_init(&priority);
|
2004-08-28 01:15:19 +00:00
|
|
|
if (NULL != module) {
|
2013-03-27 21:14:43 +00:00
|
|
|
if (priority > s_priority) {
|
2004-08-28 01:15:19 +00:00
|
|
|
s_module = module;
|
2013-03-27 21:14:43 +00:00
|
|
|
s_priority = priority;
|
2012-06-08 01:23:08 +00:00
|
|
|
s_component = component;
|
2013-03-27 21:14:43 +00:00
|
|
|
} else {
|
|
|
|
if (NULL != module->oob_fini) {
|
|
|
|
module->oob_fini();
|
|
|
|
}
|
2004-08-28 01:15:19 +00:00
|
|
|
}
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* set the global variable to point to the first initialize module */
|
2011-06-07 02:09:11 +00:00
|
|
|
if (s_module == NULL) {
|
2013-03-27 21:14:43 +00:00
|
|
|
opal_output_verbose(10, orte_oob_base_framework.framework_output,
|
|
|
|
"mca_oob_base_init: no OOB modules available\n");
|
2011-06-07 02:09:11 +00:00
|
|
|
/* the oob modules will have printed out an error msg - so be silent here */
|
|
|
|
return ORTE_ERR_SILENT;
|
|
|
|
}
|
2004-08-28 01:15:19 +00:00
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
mca_oob = *s_module;
|
2012-06-08 01:23:08 +00:00
|
|
|
|
2013-03-27 21:14:43 +00:00
|
|
|
orte_selected_oob_component = strdup(s_component->oob_base.mca_component_name);
|
|
|
|
opal_output_verbose(10, orte_oob_base_framework.framework_output,
|
|
|
|
"mca_oob_base_init: %s module selected\n",
|
|
|
|
s_component->oob_base.mca_component_name);
|
|
|
|
return ORTE_SUCCESS;
|
2004-07-01 14:49:54 +00:00
|
|
|
}
|
|
|
|
|