int nbytes = 0;
int range = 0, range_threshold = 0, range_threshold_intra = 0;
int is_two_level = 0;
- //int is_commutative = 0;
+ int is_commutative = 0;
MPI_Aint true_lb, true_extent;
sendtype_size=smpi_datatype_size(datatype);
if(is_two_level == 1){
// check if shm is ready, if not use other algorithm first
- /*if ((comm->ch.shmem_coll_ok == 1)
- && (mv2_enable_shmem_allreduce)
- && (is_commutative)
- && (mv2_enable_shmem_collectives)) {
- mpi_errno = MPIR_Allreduce_two_level_MV2(sendbuf, recvbuf, count,
+ if (is_commutative) {
+ if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL){
+ smpi_comm_init_smp(comm);
+ }
+ mpi_errno = MPIR_Allreduce_two_level_MV2(sendbuf, recvbuf, count,
datatype, op, comm);
- } else {*/
+ } else {
mpi_errno = MPIR_Allreduce_pt2pt_rd_MV2(sendbuf, recvbuf, count,
datatype, op, comm);
- // }
+ }
} else {
mpi_errno = MV2_Allreduce_function(sendbuf, recvbuf, count,
datatype, op, comm);
/* We call Reduce function */
if(is_two_level == 1)
{
- /* if (comm->ch.shmem_coll_ok == 1
- && is_commutative == 1) {
- mpi_errno = MPIR_Reduce_two_level_helper_MV2(sendbuf, recvbuf, count,
- datatype, op, root, comm, errflag);
- } else {*/
+ if (is_commutative == 1) {
+ if(smpi_comm_get_leaders_comm(comm)==MPI_COMM_NULL){
+ smpi_comm_init_smp(comm);
+ }
+ mpi_errno = MPIR_Reduce_two_level_helper_MV2(sendbuf, recvbuf, count,
+ datatype, op, root, comm);
+ } else {
mpi_errno = MPIR_Reduce_binomial_MV2(sendbuf, recvbuf, count,
datatype, op, root, comm);
- //}
+ }
} else if(MV2_Reduce_function == &MPIR_Reduce_inter_knomial_wrapper_MV2 ){
if(is_commutative ==1)
{