static mca_spml_base_module_t* mca_spml_yoda_component_init(int* priority, bool enable_progress_threads, bool enable_mpi_threads) { SPML_VERBOSE( 10, "in yoda, my priority is %d\n", mca_spml_yoda.priority); *priority = mca_spml_yoda.priority; if ((*priority) > mca_spml_yoda.priority) { return NULL ; } /* We use BML/BTL and need to start it */ if (!mca_bml_base_inited()) { SPML_VERBOSE(10, "starting bml\n"); if (OSHMEM_SUCCESS != mca_bml_base_init(enable_progress_threads, enable_mpi_threads)) { return NULL ; } } mca_spml_yoda.n_active_puts = 0; return &mca_spml_yoda.super; }
static mca_spml_base_module_t* mca_spml_yoda_component_init(int* priority, bool enable_progress_threads, bool enable_mpi_threads) { SPML_VERBOSE( 10, "in yoda, my priority is %d\n", mca_spml_yoda.priority); *priority = mca_spml_yoda.priority; if ((*priority) > mca_spml_yoda.priority) { return NULL ; } /* We use BML/BTL and need to start it */ if (!mca_bml_base_inited()) { SPML_VERBOSE(10, "can not select yoda because ompi has no bml component"); return NULL; } mca_spml_yoda.n_active_puts = 0; mca_spml_yoda.n_active_gets = 0; return &mca_spml_yoda.super; }
/* * 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. */ mca_coll_base_module_t * mca_coll_hierarch_comm_query(struct ompi_communicator_t *comm, int *priority ) { int size, rank; int color, ncount=0, maxncount; int level; int ret=OMPI_SUCCESS; int ignore_sm=0; int detection_alg=0; mca_coll_hierarch_module_t *hierarch_module; /* This module only works for intra-communicators at the moment */ if (OMPI_COMM_IS_INTER(comm)) { return NULL; } /* Get the priority level attached to this module. If priority is less * than or equal to 0, then the module is unavailable. */ *priority = mca_coll_hierarch_priority_param; if (0 >= mca_coll_hierarch_priority_param) { return NULL; } /* This module only works when the BTLs are alive. If they aren't, time to exit. */ if (!mca_bml_base_inited()) return NULL; size = ompi_comm_size(comm); if (size < 3) { /* No need for hierarchical collectives for 1 or 2 procs. */ return NULL; } hierarch_module = OBJ_NEW(mca_coll_hierarch_module_t); if (NULL == hierarch_module) { return NULL; } hierarch_module->super.coll_module_enable = mca_coll_hierarch_module_enable; hierarch_module->super.ft_event = mca_coll_hierarch_ft_event; hierarch_module->super.coll_allgather = NULL; hierarch_module->super.coll_allgatherv = NULL; hierarch_module->super.coll_allreduce = mca_coll_hierarch_allreduce_intra; hierarch_module->super.coll_alltoall = NULL; hierarch_module->super.coll_alltoallv = NULL; hierarch_module->super.coll_alltoallw = NULL; hierarch_module->super.coll_barrier = mca_coll_hierarch_barrier_intra; hierarch_module->super.coll_bcast = mca_coll_hierarch_bcast_intra; hierarch_module->super.coll_exscan = NULL; hierarch_module->super.coll_gather = NULL; hierarch_module->super.coll_gatherv = NULL; hierarch_module->super.coll_reduce = mca_coll_hierarch_reduce_intra; hierarch_module->super.coll_reduce_scatter = NULL; hierarch_module->super.coll_scan = NULL; hierarch_module->super.coll_scatter = NULL; hierarch_module->super.coll_scatterv = NULL; /* Check whether we should ignore sm. This might be necessary to take advantage of the some ib or gm collectives. */ ignore_sm = mca_coll_hierarch_ignore_sm_param; rank = ompi_comm_rank(comm); hierarch_module->hier_num_colorarr = size; hierarch_module->hier_colorarr = (int *) malloc ( sizeof(int) * size); if ( NULL == hierarch_module->hier_colorarr ) { *priority = 0; return NULL; } /* * walk through the list of registered protocols, and check which one * is feasible. * Later we start with level=0, and introduce the multi-cell check */ if ( ignore_sm ) { mca_coll_hierarch_max_protocol = HIER_MAXPROTOCOL - 1; } /* if number of levels is not specified, or if it is specified as ALL_LEVELS, * proceed in the usual way */ detection_alg = mca_coll_hierarch_detection_alg_param; if( TWO_LEVELS == detection_alg ) { mca_coll_hierarch_max_protocol = 2; if ( mca_coll_hierarch_verbose_param ) { printf("Using two level hierarchy detection\n"); } } for ( level = mca_coll_hierarch_max_protocol - 1; level >0 ; level--) { if ( ALL_LEVELS == detection_alg ) { mca_coll_hierarch_checkfor_component ( comm, level, hier_prot[level], &color, &ncount); } else if (TWO_LEVELS == detection_alg ) { mca_coll_hierarch_checkfor_sm ( comm, &color, &ncount ); } /* This is probably a no-no! but for the moment we agreed with Jeff, ** that this might be the best solution. These functions emulate an ** allreduce and an allgather. */ ret = mca_coll_hierarch_allreduce_tmp (&ncount, &maxncount, 1, MPI_INT, MPI_MAX, comm ); if ( OMPI_SUCCESS != ret ) { return NULL; } if ( 0 == maxncount ) { if ( mca_coll_hierarch_verbose_param ) { printf("%s:%d: nobody talks with %s. Continuing to next level.\n", comm->c_name, rank, hier_prot[level]); } continue; } else if ( maxncount == (size-1) ) { /* * everybody can talk to every other process with this protocol, * no need to continue in the hierarchy tree and for the * hierarchical component. * Its (size-1) because we do not count ourselves. * maxncount[1] should be zero. */ if ( mca_coll_hierarch_verbose_param ) { if ( ALL_LEVELS == detection_alg ) { printf("%s:%d: everybody talks with %s. No need to continue\n", comm->c_name, rank, hier_prot[level]); } else if ( TWO_LEVELS == detection_alg ) { printf("%s:%d: everybody talks with sm. No need to continue\n", comm->c_name, rank ); } } goto exit; } else { if ( mca_coll_hierarch_verbose_param ) { printf("%s:%d: %d procs talk with %s. Use this protocol, key %d\n", comm->c_name, rank, maxncount, hier_prot[level], color); } ret = mca_coll_hierarch_allgather_tmp (&color, 1, MPI_INT, hierarch_module->hier_colorarr, 1, MPI_INT, comm ); if ( OMPI_SUCCESS != ret ) { return NULL; } hierarch_module->hier_level = level; return &(hierarch_module->super); } } exit: *priority = 0; return NULL; }