1
1
openmpi/ompi/mca/coll/sm/coll_sm_module.c
Jeff Squyres f41e4149fa - Add new mpool base function: lookup by module name. This allows
multiple components to share a single mpool module (e.g., the
  ptl/btl and coll sm components).
- Re-tool the ptl, btl, and coll sm components to first look for the
  target mpool module, and if they don't find it, to create it.
- coll sm component now correctly identifies when it is supposed to
  run or not (i.e., if all the processes in the communicator are on
  the same host).  Now we just need to fill in some algorithms.  :-)

This commit was SVN r6530.
2005-07-15 20:01:35 +00:00

161 строка
3.7 KiB
C

/*
* Copyright (c) 2004-2005 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "mpi.h"
#include "ompi/communicator/communicator.h"
#include "ompi/mca/coll/coll.h"
#include "ompi/mca/coll/base/base.h"
#include "ompi/mca/mpool/mpool.h"
#include "ompi/mca/mpool/base/base.h"
#include "coll_sm.h"
/*
* Linear set of collective algorithms
*/
static const mca_coll_base_module_1_0_0_t module = {
/* Initialization / finalization functions */
mca_coll_sm_module_init,
mca_coll_sm_module_finalize,
/* Collective function pointers */
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
mca_coll_sm_barrier_intra,
mca_coll_sm_bcast_intra,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
/*
* Initial query function that is invoked during MPI_INIT, allowing
* this component to disqualify itself if it doesn't support the
* required level of thread support.
*/
int mca_coll_sm_init_query(bool enable_progress_threads,
bool enable_mpi_threads)
{
/* Nothing to do */
return OMPI_SUCCESS;
}
/*
* Invoked when there's a new communicator that has been created.
* Look at the communicator and decide which set of functions and
* priority we want to return.
*/
const mca_coll_base_module_1_0_0_t *
mca_coll_sm_comm_query(struct ompi_communicator_t *comm, int *priority,
struct mca_coll_base_comm_t **data)
{
int i;
/* If we're intercomm, or if there's only one process in the
communicator, we don't want to run */
if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm)) {
return NULL;
}
/* Get our priority */
*priority = mca_coll_sm_component.sm_priority;
/* We only want to run if all the processes in the communicator
are on the same node */
for (i = 0; i < ompi_comm_size(comm); ++i) {
if (0 == (comm->c_local_group->grp_proc_pointers[i]->proc_flags &
OMPI_PROC_FLAG_LOCAL)) {
return NULL;
}
}
/* Can we get an mpool allocation? See if there was one created
already. If not, try to make one. */
mca_coll_sm_component.sm_mpool =
mca_mpool_base_module_lookup(mca_coll_sm_component.sm_mpool_name);
if (NULL == mca_coll_sm_component.sm_mpool) {
mca_coll_sm_component.sm_mpool =
mca_mpool_base_module_create(mca_coll_sm_component.sm_mpool_name,
NULL, NULL);
if (NULL == mca_coll_sm_component.sm_mpool) {
return NULL;
}
}
/* All is good -- return a module */
return &module;
}
/*
* Unquery the coll on comm
*/
int mca_coll_sm_comm_unquery(struct ompi_communicator_t *comm,
struct mca_coll_base_comm_t *data)
{
/* JMS */
/* Remove mpool query, if we got one */
return OMPI_SUCCESS;
}
/*
* Init module on the communicator
*/
const struct mca_coll_base_module_1_0_0_t *
mca_coll_sm_module_init(struct ompi_communicator_t *comm)
{
/* JMS */
return &module;
}
/*
* Finalize module on the communicator
*/
int mca_coll_sm_module_finalize(struct ompi_communicator_t *comm)
{
/* JMS */
return OMPI_SUCCESS;
}