2004-06-29 04:02:25 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2014-08-08 17:34:15 +04:00
|
|
|
* Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
2013-01-28 03:25:10 +04:00
|
|
|
* Copyright (c) 2012 Los Alamos National Security, LLC.
|
|
|
|
* All rights reserved.
|
2014-08-11 07:27:45 +04:00
|
|
|
* Copyright (c) 2014 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-06-29 04:02:25 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2004-11-05 10:52:30 +03:00
|
|
|
#include <string.h>
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
#include "mpi.h"
|
2013-02-13 01:10:11 +04:00
|
|
|
#include "opal/util/show_help.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2015-03-06 06:50:44 +03:00
|
|
|
#include "ompi/mca/mca.h"
|
2005-09-01 16:16:36 +04:00
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/mca/base/mca_base_component_repository.h"
|
2013-01-28 03:25:10 +04:00
|
|
|
|
|
|
|
#include "ompi/mca/rte/rte.h"
|
2005-09-01 16:16:36 +04:00
|
|
|
#include "ompi/mca/coll/coll.h"
|
|
|
|
#include "ompi/mca/coll/base/base.h"
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Private functions
|
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static int init_query(const mca_base_component_t * ls,
|
2005-03-27 17:05:23 +04:00
|
|
|
bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads);
|
2008-12-31 15:17:08 +03:00
|
|
|
static int init_query_2_0_0(const mca_base_component_t * ls,
|
2013-03-28 01:17:31 +04:00
|
|
|
bool enable_progress_threads,
|
2005-03-27 17:05:23 +04:00
|
|
|
bool enable_mpi_threads);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Scan down the list of successfully opened components and query each of
|
|
|
|
* them (the opened list will be one or more components. If the user
|
|
|
|
* requested a specific component, it will be the only component in the
|
|
|
|
* opened list). Create and populate the available list of all
|
|
|
|
* components who indicate that they want to be considered for selection.
|
|
|
|
* Close all components who do not want to be considered for selection,
|
|
|
|
* and destroy the opened list.
|
|
|
|
*
|
|
|
|
* Also find the basic component while we're doing all of this, and save
|
|
|
|
* it in a global variable so that we can find it easily later (e.g.,
|
|
|
|
* during scope selection).
|
|
|
|
*/
|
2005-03-27 17:05:23 +04:00
|
|
|
int mca_coll_base_find_available(bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2013-03-28 01:17:31 +04:00
|
|
|
mca_base_component_list_item_t *cli, *next;
|
2008-12-31 15:17:08 +03:00
|
|
|
const mca_base_component_t *component;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* The list of components that we should check has already been
|
|
|
|
established in mca_coll_base_open. */
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
OPAL_LIST_FOREACH_SAFE(cli, next, &ompi_coll_base_framework.framework_components, mca_base_component_list_item_t) {
|
|
|
|
component = cli->cli_component;
|
2008-12-31 15:17:08 +03:00
|
|
|
|
|
|
|
/* Call a subroutine to do the work, because the component may
|
|
|
|
represent different versions of the coll MCA. */
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
if (OMPI_SUCCESS != init_query(component, enable_progress_threads,
|
2008-12-31 15:17:08 +03:00
|
|
|
enable_mpi_threads)) {
|
|
|
|
/* If the component doesn't want to run, then close it.
|
2013-03-28 01:17:31 +04:00
|
|
|
Now close it out and release it from the DSO repository (if it's there). */
|
|
|
|
opal_list_remove_item(&ompi_coll_base_framework.framework_components, &cli->super);
|
|
|
|
mca_base_component_close(component, ompi_coll_base_framework.framework_output);
|
|
|
|
OBJ_RELEASE(cli);
|
2008-12-31 15:17:08 +03:00
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* If we have no collective components available, it's an error.
|
|
|
|
Thanks for playing! */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
if (opal_list_get_size(&ompi_coll_base_framework.framework_components) == 0) {
|
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll:find_available: no coll components available!");
|
2014-08-11 07:27:45 +04:00
|
|
|
opal_show_help("help-mca-base.txt", "find-available:not-valid", true,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll");
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* All done */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
return OMPI_SUCCESS;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Query a component, see if it wants to run at all. If it does, save
|
|
|
|
* some information. If it doesn't, close it.
|
|
|
|
*/
|
2008-12-31 16:32:46 +03:00
|
|
|
static int init_query(const mca_base_component_t * component,
|
2008-12-31 15:17:08 +03:00
|
|
|
bool enable_progress_threads, bool enable_mpi_threads)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2008-12-31 15:17:08 +03:00
|
|
|
int ret;
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll:find_available: querying coll component %s",
|
2008-12-31 16:32:46 +03:00
|
|
|
component->mca_component_name);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* This component has already been successfully opened. So now
|
|
|
|
query it. */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 16:32:46 +03:00
|
|
|
if (2 == component->mca_type_major_version &&
|
|
|
|
0 == component->mca_type_minor_version &&
|
|
|
|
0 == component->mca_type_release_version) {
|
2013-03-28 01:17:31 +04:00
|
|
|
ret = init_query_2_0_0(component, enable_progress_threads,
|
2008-12-31 15:17:08 +03:00
|
|
|
enable_mpi_threads);
|
|
|
|
} else {
|
|
|
|
/* Unrecognized coll API version */
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll:find_available: unrecognized coll API version (%d.%d.%d, ignored)",
|
2008-12-31 16:32:46 +03:00
|
|
|
component->mca_type_major_version,
|
|
|
|
component->mca_type_minor_version,
|
|
|
|
component->mca_type_release_version);
|
2008-12-31 15:17:08 +03:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* Query done -- look at the return value to see what happened */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll:find_available: coll component %s is not available",
|
2008-12-31 16:32:46 +03:00
|
|
|
component->mca_component_name);
|
2008-12-31 15:17:08 +03:00
|
|
|
} else {
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 15:17:08 +03:00
|
|
|
"coll:find_available: coll component %s is available",
|
2008-12-31 16:32:46 +03:00
|
|
|
component->mca_component_name);
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
/* All done */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
return ret;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2008-12-30 15:39:32 +03:00
|
|
|
* Query a specific component, coll v2.0.0
|
2004-06-29 04:02:25 +04:00
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static int init_query_2_0_0(const mca_base_component_t * component,
|
|
|
|
bool enable_progress_threads,
|
2005-03-27 17:05:23 +04:00
|
|
|
bool enable_mpi_threads)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2008-12-31 15:17:08 +03:00
|
|
|
mca_coll_base_component_2_0_0_t *coll =
|
|
|
|
(mca_coll_base_component_2_0_0_t *) component;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-03-27 17:05:23 +04:00
|
|
|
return coll->collm_init_query(enable_progress_threads,
|
|
|
|
enable_mpi_threads);
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|