2016-04-08 14:41:29 -06:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2005-08-12 02:41:14 +00:00
|
|
|
/*
|
2007-03-16 23:11:45 +00:00
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
2005-11-05 19:57:48 +00:00
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2006-08-24 16:38:08 +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.
|
2015-06-23 20:59:57 -07:00
|
|
|
* Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
2005-08-12 02:41:14 +00:00
|
|
|
* University of Stuttgart. All rights reserved.
|
2006-03-27 22:48:12 +00:00
|
|
|
* Copyright (c) 2004-2006 The Regents of the University of California.
|
2005-08-12 02:41:14 +00:00
|
|
|
* All rights reserved.
|
2015-05-08 09:19:02 +09:00
|
|
|
* Copyright (c) 2015 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2016-04-08 14:41:29 -06:00
|
|
|
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2005-08-12 02:41:14 +00:00
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2005-08-12 02:41:14 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2005-08-12 02:41:14 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2006-08-24 16:38:08 +00:00
|
|
|
#include "ompi_config.h"
|
2015-06-23 20:59:57 -07:00
|
|
|
#include "ompi/mca/bml/base/base.h"
|
2006-02-12 01:33:29 +00:00
|
|
|
#include "opal/mca/base/base.h"
|
2005-08-12 02:41:14 +00:00
|
|
|
|
2015-03-05 20:50:44 -07:00
|
|
|
#include "ompi/mca/mca.h"
|
2008-12-09 23:49:02 +00:00
|
|
|
#include "opal/runtime/opal.h"
|
|
|
|
|
2006-08-24 16:38:08 +00:00
|
|
|
mca_bml_base_module_t mca_bml = {
|
2005-08-12 02:41:14 +00:00
|
|
|
NULL, /* bml_component */
|
2015-06-23 20:59:57 -07:00
|
|
|
NULL, /* bml_add_procs */
|
2005-08-12 02:41:14 +00:00
|
|
|
NULL, /* bml_del_procs */
|
2007-01-30 06:34:38 +00:00
|
|
|
NULL, /* bml_add_btl */
|
|
|
|
NULL, /* bml_del_btl */
|
|
|
|
NULL, /* bml_del_proc_btl */
|
2015-06-23 20:59:57 -07:00
|
|
|
NULL, /* bml_register */
|
|
|
|
NULL, /* bml_register_error */
|
2005-08-12 02:41:14 +00:00
|
|
|
NULL, /* bml_finalize*/
|
2007-03-16 23:11:45 +00:00
|
|
|
NULL /* FT event */
|
2005-08-12 02:41:14 +00:00
|
|
|
};
|
2015-05-08 09:19:02 +09:00
|
|
|
mca_bml_base_component_t mca_bml_component = {{0}};
|
2005-08-12 02:41:14 +00:00
|
|
|
|
2006-08-03 00:10:19 +00:00
|
|
|
static bool init_called = false;
|
|
|
|
|
|
|
|
bool
|
|
|
|
mca_bml_base_inited(void)
|
|
|
|
{
|
|
|
|
return init_called;
|
|
|
|
}
|
2005-08-12 02:41:14 +00:00
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
int mca_bml_base_init( bool enable_progress_threads,
|
2006-07-04 01:20:20 +00:00
|
|
|
bool enable_mpi_threads) {
|
2015-06-23 20:59:57 -07:00
|
|
|
mca_bml_base_component_t *component = NULL, *best_component = NULL;
|
|
|
|
mca_bml_base_module_t *module = NULL, *best_module = NULL;
|
|
|
|
int priority = 0, best_priority = -1;
|
|
|
|
mca_base_component_list_item_t *cli = NULL;
|
2005-08-12 02:41:14 +00:00
|
|
|
|
2016-04-08 14:41:29 -06:00
|
|
|
if (init_called) {
|
|
|
|
return OPAL_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2006-08-03 00:10:19 +00:00
|
|
|
init_called = true;
|
|
|
|
|
2016-04-08 14:41:29 -06:00
|
|
|
OPAL_LIST_FOREACH(cli, &ompi_bml_base_framework.framework_components, mca_base_component_list_item_t) {
|
2015-06-23 20:59:57 -07:00
|
|
|
component = (mca_bml_base_component_t*) cli->cli_component;
|
2005-08-12 02:41:14 +00:00
|
|
|
if(NULL == component->bml_init) {
|
2015-06-23 20:59:57 -07:00
|
|
|
opal_output_verbose( 10, ompi_bml_base_framework.framework_output,
|
|
|
|
"select: no init function; ignoring component %s",
|
|
|
|
component->bml_version.mca_component_name );
|
|
|
|
continue;
|
2005-08-12 02:41:14 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
module = component->bml_init(&priority,
|
|
|
|
enable_progress_threads,
|
|
|
|
enable_mpi_threads);
|
2005-08-12 02:41:14 +00:00
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
if(NULL == module) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(priority > best_priority) {
|
2005-08-12 02:41:14 +00:00
|
|
|
best_priority = priority;
|
|
|
|
best_component = component;
|
|
|
|
best_module = module;
|
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
|
2005-08-12 02:41:14 +00:00
|
|
|
}
|
2015-06-23 20:59:57 -07:00
|
|
|
if(NULL == best_module) {
|
|
|
|
return OMPI_SUCCESS;
|
2005-08-12 02:41:14 +00:00
|
|
|
}
|
2013-03-27 21:17:31 +00:00
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
mca_bml_component = *best_component;
|
|
|
|
mca_bml = *best_module;
|
2013-03-27 21:17:31 +00:00
|
|
|
return mca_base_framework_components_close(&ompi_bml_base_framework,
|
|
|
|
(mca_base_component_t*) best_component);
|
2005-08-12 02:41:14 +00:00
|
|
|
}
|