From a41889112c9ff998e3cc38c89f2410542e987b7f Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 6 May 2015 12:48:34 -0600 Subject: [PATCH] Remove calls to ompi_group_peer_lookup in coll/sm and coll/fca Signed-off-by: Nathan Hjelm --- ompi/mca/coll/fca/coll_fca_module.c | 21 +-------------------- ompi/mca/coll/sm/coll_sm_module.c | 21 +-------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/ompi/mca/coll/fca/coll_fca_module.c b/ompi/mca/coll/fca/coll_fca_module.c index 2c3922cf34..cda756dfa5 100644 --- a/ompi/mca/coll/fca/coll_fca_module.c +++ b/ompi/mca/coll/fca/coll_fca_module.c @@ -35,25 +35,6 @@ int mca_coll_fca_init_query(bool enable_progress_threads, return OMPI_SUCCESS; } -static int have_remote_peers(ompi_group_t *group, size_t size, int *local_peers) -{ - ompi_proc_t *proc; - size_t i; - int ret; - - *local_peers = 0; - ret = 0; - for (i = 0; i < size; ++i) { - proc = ompi_group_peer_lookup(group, i); - if (OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags)) { - ++*local_peers; - } else { - ret = 1; - } - } - return ret; -} - static inline ompi_proc_t* __local_rank_lookup(ompi_communicator_t *comm, int rank) { return ompi_group_peer_lookup(comm->c_local_group, rank); @@ -618,7 +599,7 @@ mca_coll_fca_comm_query(struct ompi_communicator_t *comm, int *priority) if (size < mca_coll_fca_component.fca_np) goto exit; - if (!have_remote_peers(comm->c_local_group, size, &local_peers) || OMPI_COMM_IS_INTER(comm)) + if (!ompi_group_have_remote_peers(comm->c_local_group) || OMPI_COMM_IS_INTER(comm)) goto exit; fca_module = OBJ_NEW(mca_coll_fca_module_t); diff --git a/ompi/mca/coll/sm/coll_sm_module.c b/ompi/mca/coll/sm/coll_sm_module.c index 37a7cbdc2d..4739217bc1 100644 --- a/ompi/mca/coll/sm/coll_sm_module.c +++ b/ompi/mca/coll/sm/coll_sm_module.c @@ -74,7 +74,6 @@ uint32_t mca_coll_sm_one = 1; */ static int sm_module_enable(mca_coll_base_module_t *module, struct ompi_communicator_t *comm); -static bool have_local_peers(ompi_group_t *group, size_t size); static int bootstrap_comm(ompi_communicator_t *comm, mca_coll_sm_module_t *module); static int mca_coll_sm_module_disable(mca_coll_base_module_t *module, @@ -172,8 +171,7 @@ mca_coll_sm_comm_query(struct ompi_communicator_t *comm, int *priority) /* If we're intercomm, or if there's only one process in the communicator, or if not all the processes in the communicator are not on this node, then we don't want to run */ - if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm) || - !have_local_peers(comm->c_local_group, ompi_comm_size(comm))) { + if (OMPI_COMM_IS_INTER(comm) || 1 == ompi_comm_size(comm) || ompi_group_have_remote_peers (comm->c_local_group)) { opal_output_verbose(10, ompi_coll_base_framework.framework_output, "coll:sm:comm_query (%d/%s): intercomm, comm is too small, or not all peers local; disqualifying myself", comm->c_contextid, comm->c_name); return NULL; @@ -490,23 +488,6 @@ int ompi_coll_sm_lazy_enable(mca_coll_base_module_t *module, return OMPI_SUCCESS; } - -static bool have_local_peers(ompi_group_t *group, size_t size) -{ - size_t i; - ompi_proc_t *proc; - - for (i = 0; i < size; ++i) { - proc = ompi_group_peer_lookup(group,i); - if (!OPAL_PROC_ON_LOCAL_NODE(proc->super.proc_flags)) { - return false; - } - } - - return true; -} - - static int bootstrap_comm(ompi_communicator_t *comm, mca_coll_sm_module_t *module) {