2013-09-27 01:55:08 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
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.
|
2015-06-24 06:59:57 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
* 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.
|
2007-10-09 19:18:23 +04:00
|
|
|
* Copyright (c) 2007 Lawrence Livermore National Security, LLC. All
|
|
|
|
* rights reserved.
|
2008-05-20 01:34:01 +04:00
|
|
|
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
2014-08-08 17:34:15 +04:00
|
|
|
* Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
|
2013-09-27 01:55:08 +04:00
|
|
|
* Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved.
|
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2014-10-10 10:19:37 +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$
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2004-11-22 04:38:40 +03:00
|
|
|
* Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
*
|
2004-06-29 04:02:25 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "mpi.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/communicator/communicator.h"
|
2009-02-14 05:26:12 +03:00
|
|
|
#include "opal/util/output.h"
|
2013-02-13 01:10:11 +04:00
|
|
|
#include "opal/util/show_help.h"
|
2005-07-03 20:22:16 +04:00
|
|
|
#include "opal/class/opal_list.h"
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2015-03-06 06:50:44 +03:00
|
|
|
#include "ompi/mca/mca.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "ompi/mca/coll/coll.h"
|
|
|
|
#include "ompi/mca/coll/base/base.h"
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local types
|
|
|
|
*/
|
|
|
|
struct avail_coll_t {
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t super;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2005-01-30 21:42:37 +03:00
|
|
|
int ac_priority;
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t *ac_module;
|
2004-06-29 04:02:25 +04:00
|
|
|
};
|
|
|
|
typedef struct avail_coll_t avail_coll_t;
|
|
|
|
|
2005-01-30 21:42:37 +03:00
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/*
|
|
|
|
* Local functions
|
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static opal_list_t *check_components(opal_list_t * components,
|
2008-12-31 16:40:51 +03:00
|
|
|
ompi_communicator_t * comm);
|
2008-12-31 15:17:08 +03:00
|
|
|
static int check_one_component(ompi_communicator_t * comm,
|
|
|
|
const mca_base_component_t * component,
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t ** module);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
static int query(const mca_base_component_t * component,
|
|
|
|
ompi_communicator_t * comm, int *priority,
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t ** module);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
static int query_2_0_0(const mca_coll_base_component_2_0_0_t *
|
|
|
|
coll_component, ompi_communicator_t * comm,
|
|
|
|
int *priority,
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t ** module);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Stuff for the OBJ interface
|
|
|
|
*/
|
2005-07-03 20:22:16 +04:00
|
|
|
static OBJ_CLASS_INSTANCE(avail_coll_t, opal_list_item_t, NULL, NULL);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
|
2007-08-19 07:37:49 +04:00
|
|
|
#define COPY(module, comm, func) \
|
|
|
|
do { \
|
|
|
|
if (NULL != module->coll_ ## func) { \
|
|
|
|
if (NULL != comm->c_coll.coll_ ## func ## _module) { \
|
|
|
|
OBJ_RELEASE(comm->c_coll.coll_ ## func ## _module); \
|
|
|
|
} \
|
|
|
|
comm->c_coll.coll_ ## func = module->coll_ ## func; \
|
|
|
|
comm->c_coll.coll_ ## func ## _module = module; \
|
|
|
|
OBJ_RETAIN(module); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2015-05-11 22:10:37 +03:00
|
|
|
#define CHECK_NULL(what, comm, func) \
|
|
|
|
( (what) = # func , NULL == (comm)->c_coll.coll_ ## func)
|
|
|
|
|
2004-06-29 04:02:25 +04:00
|
|
|
/*
|
|
|
|
* This function is called at the initialization time of every
|
|
|
|
* communicator. It is used to select which coll component will be
|
|
|
|
* active for a given communicator.
|
|
|
|
*
|
|
|
|
* This selection logic is not for the weak.
|
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
int mca_coll_base_comm_select(ompi_communicator_t * comm)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2007-08-19 07:37:49 +04:00
|
|
|
opal_list_t *selectable;
|
|
|
|
opal_list_item_t *item;
|
2015-05-11 22:10:37 +03:00
|
|
|
char* which_func = "unknown";
|
2011-06-20 13:29:19 +04:00
|
|
|
int ret;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* Announce */
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2011-06-20 13:29:19 +04:00
|
|
|
"coll:base:comm_select: new communicator: %s (cid %d)",
|
|
|
|
comm->c_name, comm->c_contextid);
|
2008-12-31 15:17:08 +03:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* Initialize all the relevant pointers, since they're used as
|
2008-12-31 15:17:08 +03:00
|
|
|
* sentinel values */
|
2008-05-20 18:11:10 +04:00
|
|
|
memset(&comm->c_coll, 0, sizeof(mca_coll_base_comm_coll_t));
|
2008-12-31 15:17:08 +03:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-12-31 16:40:51 +03:00
|
|
|
"coll:base:comm_select: Checking all available modules");
|
2013-03-28 01:17:31 +04:00
|
|
|
selectable = check_components(&ompi_coll_base_framework.framework_components, comm);
|
2008-05-20 18:11:10 +04:00
|
|
|
|
|
|
|
/* Upon return from the above, the modules list will contain the
|
|
|
|
list of modules that returned (priority >= 0). If we have no
|
|
|
|
collective modules available, then print error and return. */
|
|
|
|
if (NULL == selectable) {
|
|
|
|
/* There's no modules available */
|
2014-08-08 17:34:15 +04:00
|
|
|
opal_show_help("help-mca-coll-base.txt",
|
2008-05-20 18:11:10 +04:00
|
|
|
"comm-select:none-available", true);
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIX ME - Do some kind of collective operation to find a module
|
|
|
|
that everyone has available */
|
|
|
|
|
|
|
|
/* do the selection loop */
|
|
|
|
for (item = opal_list_remove_first(selectable);
|
2008-12-31 15:17:08 +03:00
|
|
|
NULL != item; item = opal_list_remove_first(selectable)) {
|
2008-05-20 18:11:10 +04:00
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
avail_coll_t *avail = (avail_coll_t *) item;
|
2008-05-20 18:11:10 +04:00
|
|
|
|
|
|
|
/* initialize the module */
|
|
|
|
ret = avail->ac_module->coll_module_enable(avail->ac_module, comm);
|
2014-06-26 19:52:45 +04:00
|
|
|
if (OMPI_SUCCESS == ret) {
|
|
|
|
|
|
|
|
/* copy over any of the pointers */
|
|
|
|
COPY(avail->ac_module, comm, allgather);
|
|
|
|
COPY(avail->ac_module, comm, allgatherv);
|
|
|
|
COPY(avail->ac_module, comm, allreduce);
|
|
|
|
COPY(avail->ac_module, comm, alltoall);
|
|
|
|
COPY(avail->ac_module, comm, alltoallv);
|
|
|
|
COPY(avail->ac_module, comm, alltoallw);
|
|
|
|
COPY(avail->ac_module, comm, barrier);
|
|
|
|
COPY(avail->ac_module, comm, bcast);
|
|
|
|
COPY(avail->ac_module, comm, exscan);
|
|
|
|
COPY(avail->ac_module, comm, gather);
|
|
|
|
COPY(avail->ac_module, comm, gatherv);
|
|
|
|
COPY(avail->ac_module, comm, reduce);
|
|
|
|
COPY(avail->ac_module, comm, reduce_scatter_block);
|
|
|
|
COPY(avail->ac_module, comm, reduce_scatter);
|
|
|
|
COPY(avail->ac_module, comm, scan);
|
|
|
|
COPY(avail->ac_module, comm, scatter);
|
|
|
|
COPY(avail->ac_module, comm, scatterv);
|
|
|
|
|
|
|
|
COPY(avail->ac_module, comm, iallgather);
|
|
|
|
COPY(avail->ac_module, comm, iallgatherv);
|
|
|
|
COPY(avail->ac_module, comm, iallreduce);
|
|
|
|
COPY(avail->ac_module, comm, ialltoall);
|
|
|
|
COPY(avail->ac_module, comm, ialltoallv);
|
|
|
|
COPY(avail->ac_module, comm, ialltoallw);
|
|
|
|
COPY(avail->ac_module, comm, ibarrier);
|
|
|
|
COPY(avail->ac_module, comm, ibcast);
|
|
|
|
COPY(avail->ac_module, comm, iexscan);
|
|
|
|
COPY(avail->ac_module, comm, igather);
|
|
|
|
COPY(avail->ac_module, comm, igatherv);
|
|
|
|
COPY(avail->ac_module, comm, ireduce);
|
|
|
|
COPY(avail->ac_module, comm, ireduce_scatter_block);
|
|
|
|
COPY(avail->ac_module, comm, ireduce_scatter);
|
|
|
|
COPY(avail->ac_module, comm, iscan);
|
|
|
|
COPY(avail->ac_module, comm, iscatter);
|
|
|
|
COPY(avail->ac_module, comm, iscatterv);
|
|
|
|
|
|
|
|
/* We can not reliably check if this comm has a topology
|
|
|
|
* at this time. The flags are set *after* coll_select */
|
|
|
|
COPY(avail->ac_module, comm, neighbor_allgather);
|
|
|
|
COPY(avail->ac_module, comm, neighbor_allgatherv);
|
|
|
|
COPY(avail->ac_module, comm, neighbor_alltoall);
|
|
|
|
COPY(avail->ac_module, comm, neighbor_alltoallv);
|
|
|
|
COPY(avail->ac_module, comm, neighbor_alltoallw);
|
|
|
|
|
|
|
|
COPY(avail->ac_module, comm, ineighbor_allgather);
|
|
|
|
COPY(avail->ac_module, comm, ineighbor_allgatherv);
|
|
|
|
COPY(avail->ac_module, comm, ineighbor_alltoall);
|
|
|
|
COPY(avail->ac_module, comm, ineighbor_alltoallv);
|
|
|
|
COPY(avail->ac_module, comm, ineighbor_alltoallw);
|
2008-05-20 18:11:10 +04:00
|
|
|
}
|
|
|
|
/* release the original module reference and the list item */
|
|
|
|
OBJ_RELEASE(avail->ac_module);
|
|
|
|
OBJ_RELEASE(avail);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Done with the list from the check_components() call so release it. */
|
|
|
|
OBJ_RELEASE(selectable);
|
|
|
|
|
|
|
|
/* check to make sure no NULLs */
|
2015-05-11 22:10:37 +03:00
|
|
|
if (CHECK_NULL(which_func, comm, allgather) ||
|
|
|
|
CHECK_NULL(which_func, comm, allgatherv) ||
|
|
|
|
CHECK_NULL(which_func, comm, allreduce) ||
|
|
|
|
CHECK_NULL(which_func, comm, alltoall) ||
|
|
|
|
CHECK_NULL(which_func, comm, alltoallv) ||
|
|
|
|
CHECK_NULL(which_func, comm, alltoallw) ||
|
|
|
|
CHECK_NULL(which_func, comm, barrier) ||
|
|
|
|
CHECK_NULL(which_func, comm, bcast) ||
|
|
|
|
((OMPI_COMM_IS_INTRA(comm)) && CHECK_NULL(which_func, comm, exscan)) ||
|
|
|
|
CHECK_NULL(which_func, comm, gather) ||
|
|
|
|
CHECK_NULL(which_func, comm, gatherv) ||
|
|
|
|
CHECK_NULL(which_func, comm, reduce) ||
|
|
|
|
CHECK_NULL(which_func, comm, reduce_scatter_block) ||
|
|
|
|
CHECK_NULL(which_func, comm, reduce_scatter) ||
|
|
|
|
((OMPI_COMM_IS_INTRA(comm)) && CHECK_NULL(which_func, comm, scan)) ||
|
|
|
|
CHECK_NULL(which_func, comm, scatter) ||
|
|
|
|
CHECK_NULL(which_func, comm, scatterv) ||
|
|
|
|
CHECK_NULL(which_func, comm, iallgather) ||
|
|
|
|
CHECK_NULL(which_func, comm, iallgatherv) ||
|
|
|
|
CHECK_NULL(which_func, comm, iallreduce) ||
|
|
|
|
CHECK_NULL(which_func, comm, ialltoall) ||
|
|
|
|
CHECK_NULL(which_func, comm, ialltoallv) ||
|
|
|
|
CHECK_NULL(which_func, comm, ialltoallw) ||
|
|
|
|
CHECK_NULL(which_func, comm, ibarrier) ||
|
|
|
|
CHECK_NULL(which_func, comm, ibcast) ||
|
|
|
|
((OMPI_COMM_IS_INTRA(comm)) && CHECK_NULL(which_func, comm, iexscan)) ||
|
|
|
|
CHECK_NULL(which_func, comm, igather) ||
|
|
|
|
CHECK_NULL(which_func, comm, igatherv) ||
|
|
|
|
CHECK_NULL(which_func, comm, ireduce) ||
|
|
|
|
CHECK_NULL(which_func, comm, ireduce_scatter_block) ||
|
|
|
|
CHECK_NULL(which_func, comm, ireduce_scatter) ||
|
|
|
|
((OMPI_COMM_IS_INTRA(comm)) && CHECK_NULL(which_func, comm, iscan)) ||
|
|
|
|
CHECK_NULL(which_func, comm, iscatter) ||
|
|
|
|
CHECK_NULL(which_func, comm, iscatterv)) {
|
2014-06-26 19:52:45 +04:00
|
|
|
/* TODO -- Once the topology flags are set before coll_select then
|
2013-10-03 07:37:46 +04:00
|
|
|
* check if neighborhood collectives have been set. */
|
2015-05-11 22:10:37 +03:00
|
|
|
|
|
|
|
opal_show_help("help-mca-coll-base.txt",
|
|
|
|
"comm-select:no-function-available", true, which_func);
|
|
|
|
|
|
|
|
mca_coll_base_comm_unselect(comm);
|
2008-05-20 18:11:10 +04:00
|
|
|
return OMPI_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
static int avail_coll_compare (opal_list_item_t **a,
|
|
|
|
opal_list_item_t **b) {
|
|
|
|
avail_coll_t *acoll = (avail_coll_t *) *a;
|
|
|
|
avail_coll_t *bcoll = (avail_coll_t *) *b;
|
|
|
|
|
|
|
|
if (acoll->ac_priority > bcoll->ac_priority) {
|
|
|
|
return 1;
|
|
|
|
} else if (acoll->ac_priority < bcoll->ac_priority) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
|
|
|
/*
|
2008-12-31 16:40:51 +03:00
|
|
|
* For each module in the list, check and see if it wants to run, and
|
2004-06-29 04:02:25 +04:00
|
|
|
* do the resulting priority comparison. Make a list of modules to be
|
|
|
|
* only those who returned that they want to run, and put them in
|
|
|
|
* priority order.
|
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static opal_list_t *check_components(opal_list_t * components,
|
2008-12-31 16:40:51 +03:00
|
|
|
ompi_communicator_t * comm)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2008-12-31 16:40:51 +03:00
|
|
|
int priority;
|
2008-05-20 18:11:10 +04:00
|
|
|
const mca_base_component_t *component;
|
2013-03-28 01:17:31 +04:00
|
|
|
mca_base_component_list_item_t *cli;
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t *module;
|
2008-05-20 18:11:10 +04:00
|
|
|
opal_list_t *selectable;
|
2013-03-28 01:17:31 +04:00
|
|
|
avail_coll_t *avail;
|
2008-12-31 15:17:08 +03:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* Make a list of the components that query successfully */
|
|
|
|
selectable = OBJ_NEW(opal_list_t);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
/* Scan through the list of components */
|
|
|
|
OPAL_LIST_FOREACH(cli, &ompi_coll_base_framework.framework_components, mca_base_component_list_item_t) {
|
|
|
|
component = cli->cli_component;
|
2008-05-20 18:11:10 +04:00
|
|
|
|
2008-12-31 16:40:51 +03:00
|
|
|
priority = check_one_component(comm, component, &module);
|
|
|
|
if (priority >= 0) {
|
|
|
|
/* We have a component that indicated that it wants to run
|
|
|
|
by giving us a module */
|
|
|
|
avail = OBJ_NEW(avail_coll_t);
|
|
|
|
avail->ac_priority = priority;
|
|
|
|
avail->ac_module = module;
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_list_append(selectable, &avail->super);
|
2007-10-09 03:01:36 +04:00
|
|
|
}
|
2015-06-24 06:59:57 +03:00
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* If we didn't find any available components, return an error */
|
|
|
|
if (0 == opal_list_get_size(selectable)) {
|
|
|
|
OBJ_RELEASE(selectable);
|
|
|
|
return NULL;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
/* Put this list in priority order */
|
|
|
|
opal_list_sort(selectable, avail_coll_compare);
|
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* All done */
|
|
|
|
return selectable;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check a single component
|
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static int check_one_component(ompi_communicator_t * comm,
|
|
|
|
const mca_base_component_t * component,
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t ** module)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2008-05-20 18:11:10 +04:00
|
|
|
int err;
|
|
|
|
int priority = -1;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
err = query(component, comm, &priority, module);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
if (OMPI_SUCCESS == err) {
|
|
|
|
priority = (priority < 100) ? priority : 100;
|
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:base:comm_select: component available: %s, priority: %d",
|
2008-05-20 18:11:10 +04:00
|
|
|
component->mca_component_name, priority);
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
} else {
|
|
|
|
priority = -1;
|
2013-03-28 01:17:31 +04:00
|
|
|
opal_output_verbose(10, ompi_coll_base_framework.framework_output,
|
2008-05-20 18:11:10 +04:00
|
|
|
"coll:base:comm_select: component not available: %s",
|
|
|
|
component->mca_component_name);
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
return priority;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* Query functions
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Take any version of a coll module, query it, and return the right
|
2004-08-04 01:29:23 +04:00
|
|
|
* module struct
|
2004-06-29 04:02:25 +04:00
|
|
|
*/
|
2008-12-31 15:17:08 +03:00
|
|
|
static int query(const mca_base_component_t * component,
|
|
|
|
ompi_communicator_t * comm,
|
2014-10-10 10:19:37 +04:00
|
|
|
int *priority, mca_coll_base_module_2_1_0_t ** module)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2008-05-20 18:11:10 +04:00
|
|
|
*module = NULL;
|
2008-07-29 02:40:57 +04:00
|
|
|
if (2 == component->mca_type_major_version &&
|
|
|
|
0 == component->mca_type_minor_version &&
|
2008-05-20 18:11:10 +04:00
|
|
|
0 == component->mca_type_release_version) {
|
2008-12-31 15:17:08 +03:00
|
|
|
const mca_coll_base_component_2_0_0_t *coll100 =
|
2008-07-29 02:40:57 +04:00
|
|
|
(mca_coll_base_component_2_0_0_t *) component;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-07-29 02:40:57 +04:00
|
|
|
return query_2_0_0(coll100, comm, priority, module);
|
2008-12-31 15:17:08 +03:00
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* Unknown coll API version -- return error */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
return OMPI_ERROR;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-31 15:17:08 +03:00
|
|
|
static int query_2_0_0(const mca_coll_base_component_2_0_0_t * component,
|
|
|
|
ompi_communicator_t * comm, int *priority,
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t ** module)
|
2004-06-29 04:02:25 +04:00
|
|
|
{
|
2014-10-10 10:19:37 +04:00
|
|
|
mca_coll_base_module_2_1_0_t *ret;
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
/* There's currently no need for conversion */
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
ret = component->collm_comm_query(comm, priority);
|
|
|
|
if (NULL != ret) {
|
|
|
|
*module = ret;
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2004-06-29 04:02:25 +04:00
|
|
|
|
2008-05-20 18:11:10 +04:00
|
|
|
return OMPI_ERROR;
|
2004-06-29 04:02:25 +04:00
|
|
|
}
|