1 /* selector for collective algorithms based on mvapich decision logic */
3 /* Copyright (c) 2009-2010, 2013-2014. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is xbt_free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "colls_private.h"
11 #include "smpi_mvapich2_selector_stampede.h"
15 int smpi_coll_tuned_alltoall_mvapich2( void *sendbuf, int sendcount,
16 MPI_Datatype sendtype,
17 void* recvbuf, int recvcount,
18 MPI_Datatype recvtype,
22 if(mv2_alltoall_table_ppn_conf==NULL)
23 init_mv2_alltoall_tables_stampede();
25 int sendtype_size, recvtype_size, nbytes, comm_size;
26 char * tmp_buf = NULL;
27 int mpi_errno=MPI_SUCCESS;
29 int range_threshold = 0;
31 comm_size = smpi_comm_size(comm);
33 sendtype_size=smpi_datatype_size(sendtype);
34 recvtype_size=smpi_datatype_size(recvtype);
35 nbytes = sendtype_size * sendcount;
37 /* check if safe to use partial subscription mode */
39 /* Search for the corresponding system size inside the tuning table */
40 while ((range < (mv2_size_alltoall_tuning_table[conf_index] - 1)) &&
41 (comm_size > mv2_alltoall_thresholds_table[conf_index][range].numproc)) {
44 /* Search for corresponding inter-leader function */
45 while ((range_threshold < (mv2_alltoall_thresholds_table[conf_index][range].size_table - 1))
47 mv2_alltoall_thresholds_table[conf_index][range].algo_table[range_threshold].max)
48 && (mv2_alltoall_thresholds_table[conf_index][range].algo_table[range_threshold].max != -1)) {
51 MV2_Alltoall_function = mv2_alltoall_thresholds_table[conf_index][range].algo_table[range_threshold]
52 .MV2_pt_Alltoall_function;
54 if(sendbuf != MPI_IN_PLACE) {
55 mpi_errno = MV2_Alltoall_function(sendbuf, sendcount, sendtype,
56 recvbuf, recvcount, recvtype,
61 mv2_alltoall_thresholds_table[conf_index][range].in_place_algo_table[range_threshold].min
62 ||nbytes > mv2_alltoall_thresholds_table[conf_index][range].in_place_algo_table[range_threshold].max
64 tmp_buf = (char *)xbt_malloc( comm_size * recvcount * recvtype_size );
65 mpi_errno = smpi_datatype_copy((char *)recvbuf,
66 comm_size*recvcount, recvtype,
68 comm_size*recvcount, recvtype);
70 mpi_errno = MV2_Alltoall_function(tmp_buf, recvcount, recvtype,
71 recvbuf, recvcount, recvtype,
75 mpi_errno = MPIR_Alltoall_inplace_MV2(sendbuf, sendcount, sendtype,
76 recvbuf, recvcount, recvtype,
87 int smpi_coll_tuned_allgather_mvapich2(void *sendbuf, int sendcount, MPI_Datatype sendtype,
88 void *recvbuf, int recvcount, MPI_Datatype recvtype,
92 int mpi_errno = MPI_SUCCESS;
93 int nbytes = 0, comm_size, recvtype_size;
95 //int partial_sub_ok = 0;
97 int range_threshold = 0;
99 //int local_size = -1;
100 //MPI_Comm shmem_comm;
101 //MPI_Comm *shmem_commptr=NULL;
102 /* Get the size of the communicator */
103 comm_size = smpi_comm_size(comm);
104 recvtype_size=smpi_datatype_size(recvtype);
105 nbytes = recvtype_size * recvcount;
107 if(mv2_allgather_table_ppn_conf==NULL)
108 init_mv2_allgather_tables_stampede();
111 /* check if safe to use partial subscription mode */
112 /* if (comm->ch.shmem_coll_ok == 1 && comm->ch.is_uniform) {
114 shmem_comm = comm->ch.shmem_comm;
115 MPID_Comm_get_ptr(shmem_comm, shmem_commptr);
116 local_size = shmem_commptr->local_size;
118 if (mv2_allgather_table_ppn_conf[0] == -1) {
119 // Indicating user defined tuning
124 if (local_size == mv2_allgather_table_ppn_conf[i]) {
130 } while(i < mv2_allgather_num_ppn_conf);
134 if (partial_sub_ok != 1) {
137 /* Search for the corresponding system size inside the tuning table */
138 while ((range < (mv2_size_allgather_tuning_table[conf_index] - 1)) &&
140 mv2_allgather_thresholds_table[conf_index][range].numproc)) {
143 /* Search for corresponding inter-leader function */
144 while ((range_threshold <
145 (mv2_allgather_thresholds_table[conf_index][range].size_inter_table - 1))
146 && (nbytes > mv2_allgather_thresholds_table[conf_index][range].inter_leader[range_threshold].max)
147 && (mv2_allgather_thresholds_table[conf_index][range].inter_leader[range_threshold].max !=
152 /* Set inter-leader pt */
153 MV2_Allgather_function =
154 mv2_allgather_thresholds_table[conf_index][range].inter_leader[range_threshold].
155 MV2_pt_Allgather_function;
157 is_two_level = mv2_allgather_thresholds_table[conf_index][range].two_level[range_threshold];
159 /* intracommunicator */
160 if(is_two_level ==1){
162 /* if(comm->ch.shmem_coll_ok == 1){
163 MPIR_T_PVAR_COUNTER_INC(MV2, mv2_num_shmem_coll_calls, 1);
164 if (1 == comm->ch.is_blocked) {
165 mpi_errno = MPIR_2lvl_Allgather_MV2(sendbuf, sendcount, sendtype,
166 recvbuf, recvcount, recvtype,
170 mpi_errno = MPIR_Allgather_intra(sendbuf, sendcount, sendtype,
171 recvbuf, recvcount, recvtype,
175 mpi_errno = MPIR_Allgather_RD_MV2(sendbuf, sendcount, sendtype,
176 recvbuf, recvcount, recvtype,
179 } else if(MV2_Allgather_function == &MPIR_Allgather_Bruck_MV2
180 || MV2_Allgather_function == &MPIR_Allgather_RD_MV2
181 || MV2_Allgather_function == &MPIR_Allgather_Ring_MV2) {
182 mpi_errno = MV2_Allgather_function(sendbuf, sendcount, sendtype,
183 recvbuf, recvcount, recvtype,
186 return MPI_ERR_OTHER;
193 int smpi_coll_tuned_gather_mvapich2(void *sendbuf,
195 MPI_Datatype sendtype,
198 MPI_Datatype recvtype,
199 int root, MPI_Comm comm)
201 if(mv2_gather_thresholds_table==NULL)
202 init_mv2_gather_tables_stampede();
204 int mpi_errno = MPI_SUCCESS;
206 int range_threshold = 0;
207 int range_intra_threshold = 0;
210 int recvtype_size, sendtype_size;
212 comm_size = smpi_comm_size(comm);
213 rank = smpi_comm_rank(comm);
216 recvtype_size=smpi_datatype_size(recvtype);
217 nbytes = recvcnt * recvtype_size;
219 sendtype_size=smpi_datatype_size(sendtype);
220 nbytes = sendcnt * sendtype_size;
223 /* Search for the corresponding system size inside the tuning table */
224 while ((range < (mv2_size_gather_tuning_table - 1)) &&
225 (comm_size > mv2_gather_thresholds_table[range].numproc)) {
228 /* Search for corresponding inter-leader function */
229 while ((range_threshold < (mv2_gather_thresholds_table[range].size_inter_table - 1))
231 mv2_gather_thresholds_table[range].inter_leader[range_threshold].max)
232 && (mv2_gather_thresholds_table[range].inter_leader[range_threshold].max !=
237 /* Search for corresponding intra node function */
238 while ((range_intra_threshold < (mv2_gather_thresholds_table[range].size_intra_table - 1))
240 mv2_gather_thresholds_table[range].intra_node[range_intra_threshold].max)
241 && (mv2_gather_thresholds_table[range].intra_node[range_intra_threshold].max !=
243 range_intra_threshold++;
246 if (comm->ch.is_global_block == 1 && mv2_use_direct_gather == 1 &&
247 mv2_use_two_level_gather == 1 && comm->ch.shmem_coll_ok == 1) {
248 // Set intra-node function pt for gather_two_level
249 MV2_Gather_intra_node_function =
250 mv2_gather_thresholds_table[range].intra_node[range_intra_threshold].
251 MV2_pt_Gather_function;
252 //Set inter-leader pt
253 MV2_Gather_inter_leader_function =
254 mv2_gather_thresholds_table[range].inter_leader[range_threshold].
255 MV2_pt_Gather_function;
256 // We call Gather function
258 MV2_Gather_inter_leader_function(sendbuf, sendcnt, sendtype, recvbuf, recvcnt,
259 recvtype, root, comm);
262 // Indded, direct (non SMP-aware)gather is MPICH one
263 mpi_errno = smpi_coll_tuned_gather_mpich(sendbuf, sendcnt, sendtype,
264 recvbuf, recvcnt, recvtype,
272 int smpi_coll_tuned_allgatherv_mvapich2(void *sendbuf, int sendcount, MPI_Datatype sendtype,
273 void *recvbuf, int *recvcounts, int *displs,
274 MPI_Datatype recvtype, MPI_Comm comm )
276 int mpi_errno = MPI_SUCCESS;
277 int range = 0, comm_size, total_count, recvtype_size, i;
278 int range_threshold = 0;
281 if(mv2_allgatherv_thresholds_table==NULL)
282 init_mv2_allgatherv_tables_stampede();
284 comm_size = smpi_comm_size(comm);
286 for (i = 0; i < comm_size; i++)
287 total_count += recvcounts[i];
289 recvtype_size=smpi_datatype_size(recvtype);
290 nbytes = total_count * recvtype_size;
292 /* Search for the corresponding system size inside the tuning table */
293 while ((range < (mv2_size_allgatherv_tuning_table - 1)) &&
294 (comm_size > mv2_allgatherv_thresholds_table[range].numproc)) {
297 /* Search for corresponding inter-leader function */
298 while ((range_threshold < (mv2_allgatherv_thresholds_table[range].size_inter_table - 1))
300 comm_size * mv2_allgatherv_thresholds_table[range].inter_leader[range_threshold].max)
301 && (mv2_allgatherv_thresholds_table[range].inter_leader[range_threshold].max !=
305 /* Set inter-leader pt */
306 MV2_Allgatherv_function =
307 mv2_allgatherv_thresholds_table[range].inter_leader[range_threshold].
308 MV2_pt_Allgatherv_function;
310 if (MV2_Allgatherv_function == &MPIR_Allgatherv_Rec_Doubling_MV2)
312 if(!(comm_size & (comm_size - 1)))
315 MPIR_Allgatherv_Rec_Doubling_MV2(sendbuf, sendcount,
321 MPIR_Allgatherv_Bruck_MV2(sendbuf, sendcount,
328 MV2_Allgatherv_function(sendbuf, sendcount, sendtype,
329 recvbuf, recvcounts, displs,
338 int smpi_coll_tuned_allreduce_mvapich2(void *sendbuf,
341 MPI_Datatype datatype,
342 MPI_Op op, MPI_Comm comm)
345 int mpi_errno = MPI_SUCCESS;
349 comm_size = smpi_comm_size(comm);
350 //rank = smpi_comm_rank(comm);
356 if (mv2_allreduce_thresholds_table == NULL)
357 init_mv2_allreduce_tables_stampede();
359 /* check if multiple threads are calling this collective function */
361 MPI_Aint sendtype_size = 0;
363 int range = 0, range_threshold = 0, range_threshold_intra = 0;
364 int is_two_level = 0;
365 //int is_commutative = 0;
366 MPI_Aint true_lb, true_extent;
368 sendtype_size=smpi_datatype_size(datatype);
369 nbytes = count * sendtype_size;
371 smpi_datatype_extent(datatype, &true_lb, &true_extent);
373 //is_commutative = smpi_op_is_commute(op);
376 /* Search for the corresponding system size inside the tuning table */
377 while ((range < (mv2_size_allreduce_tuning_table - 1)) &&
378 (comm_size > mv2_allreduce_thresholds_table[range].numproc)) {
381 /* Search for corresponding inter-leader function */
382 /* skip mcast poiters if mcast is not available */
383 if(mv2_allreduce_thresholds_table[range].mcast_enabled != 1){
384 while ((range_threshold < (mv2_allreduce_thresholds_table[range].size_inter_table - 1))
385 && ((mv2_allreduce_thresholds_table[range].
386 inter_leader[range_threshold].MV2_pt_Allreduce_function
387 == &MPIR_Allreduce_mcst_reduce_redscat_gather_MV2) ||
388 (mv2_allreduce_thresholds_table[range].
389 inter_leader[range_threshold].MV2_pt_Allreduce_function
390 == &MPIR_Allreduce_mcst_reduce_two_level_helper_MV2)
395 while ((range_threshold < (mv2_allreduce_thresholds_table[range].size_inter_table - 1))
397 mv2_allreduce_thresholds_table[range].inter_leader[range_threshold].max)
398 && (mv2_allreduce_thresholds_table[range].inter_leader[range_threshold].max != -1)) {
401 if(mv2_allreduce_thresholds_table[range].is_two_level_allreduce[range_threshold] == 1){
404 /* Search for corresponding intra-node function */
405 while ((range_threshold_intra <
406 (mv2_allreduce_thresholds_table[range].size_intra_table - 1))
408 mv2_allreduce_thresholds_table[range].intra_node[range_threshold_intra].max)
409 && (mv2_allreduce_thresholds_table[range].intra_node[range_threshold_intra].max !=
411 range_threshold_intra++;
414 MV2_Allreduce_function = mv2_allreduce_thresholds_table[range].inter_leader[range_threshold]
415 .MV2_pt_Allreduce_function;
417 MV2_Allreduce_intra_function = mv2_allreduce_thresholds_table[range].intra_node[range_threshold_intra]
418 .MV2_pt_Allreduce_function;
420 /* check if mcast is ready, otherwise replace mcast with other algorithm */
421 if((MV2_Allreduce_function == &MPIR_Allreduce_mcst_reduce_redscat_gather_MV2)||
422 (MV2_Allreduce_function == &MPIR_Allreduce_mcst_reduce_two_level_helper_MV2)){
424 MV2_Allreduce_function = &MPIR_Allreduce_pt2pt_rd_MV2;
426 if(is_two_level != 1) {
427 MV2_Allreduce_function = &MPIR_Allreduce_pt2pt_rd_MV2;
431 if(is_two_level == 1){
432 // check if shm is ready, if not use other algorithm first
433 /*if ((comm->ch.shmem_coll_ok == 1)
434 && (mv2_enable_shmem_allreduce)
436 && (mv2_enable_shmem_collectives)) {
437 mpi_errno = MPIR_Allreduce_two_level_MV2(sendbuf, recvbuf, count,
440 mpi_errno = MPIR_Allreduce_pt2pt_rd_MV2(sendbuf, recvbuf, count,
444 mpi_errno = MV2_Allreduce_function(sendbuf, recvbuf, count,
449 //comm->ch.intra_node_done=0;
457 int smpi_coll_tuned_alltoallv_mvapich2(void *sbuf, int *scounts, int *sdisps,
459 void *rbuf, int *rcounts, int *rdisps,
465 if (sbuf == MPI_IN_PLACE) {
466 return smpi_coll_tuned_alltoallv_ompi_basic_linear(sbuf, scounts, sdisps, sdtype,
467 rbuf, rcounts, rdisps,rdtype,
469 } else /* For starters, just keep the original algorithm. */
470 return smpi_coll_tuned_alltoallv_ring(sbuf, scounts, sdisps, sdtype,
471 rbuf, rcounts, rdisps,rdtype,
476 int smpi_coll_tuned_barrier_mvapich2(MPI_Comm comm)
478 return smpi_coll_tuned_barrier_mvapich2_pair(comm);
484 int smpi_coll_tuned_bcast_mvapich2(void *buffer,
486 MPI_Datatype datatype,
487 int root, MPI_Comm comm)
490 //TODO : Bcast really needs intra/inter phases in mvapich. Default to mpich if not available
491 return smpi_coll_tuned_bcast_mpich(buffer, count, datatype, root, comm);
497 int smpi_coll_tuned_reduce_mvapich2( void *sendbuf,
500 MPI_Datatype datatype,
501 MPI_Op op, int root, MPI_Comm comm)
503 if(mv2_reduce_thresholds_table == NULL)
504 init_mv2_reduce_tables_stampede();
506 int mpi_errno = MPI_SUCCESS;
508 int range_threshold = 0;
509 int range_intra_threshold = 0;
510 int is_commutative, pof2;
514 int is_two_level = 0;
516 comm_size = smpi_comm_size(comm);
517 sendtype_size=smpi_datatype_size(datatype);
518 nbytes = count * sendtype_size;
523 is_commutative = smpi_op_is_commute(op);
525 /* find nearest power-of-two less than or equal to comm_size */
526 for( pof2 = 1; pof2 <= comm_size; pof2 <<= 1 );
530 /* Search for the corresponding system size inside the tuning table */
531 while ((range < (mv2_size_reduce_tuning_table - 1)) &&
532 (comm_size > mv2_reduce_thresholds_table[range].numproc)) {
535 /* Search for corresponding inter-leader function */
536 while ((range_threshold < (mv2_reduce_thresholds_table[range].size_inter_table - 1))
538 mv2_reduce_thresholds_table[range].inter_leader[range_threshold].max)
539 && (mv2_reduce_thresholds_table[range].inter_leader[range_threshold].max !=
544 /* Search for corresponding intra node function */
545 while ((range_intra_threshold < (mv2_reduce_thresholds_table[range].size_intra_table - 1))
547 mv2_reduce_thresholds_table[range].intra_node[range_intra_threshold].max)
548 && (mv2_reduce_thresholds_table[range].intra_node[range_intra_threshold].max !=
550 range_intra_threshold++;
553 /* Set intra-node function pt for reduce_two_level */
554 MV2_Reduce_intra_function =
555 mv2_reduce_thresholds_table[range].intra_node[range_intra_threshold].
556 MV2_pt_Reduce_function;
557 /* Set inter-leader pt */
558 MV2_Reduce_function =
559 mv2_reduce_thresholds_table[range].inter_leader[range_threshold].
560 MV2_pt_Reduce_function;
562 if(mv2_reduce_intra_knomial_factor<0)
564 mv2_reduce_intra_knomial_factor = mv2_reduce_thresholds_table[range].intra_k_degree;
566 if(mv2_reduce_inter_knomial_factor<0)
568 mv2_reduce_inter_knomial_factor = mv2_reduce_thresholds_table[range].inter_k_degree;
570 if(mv2_reduce_thresholds_table[range].is_two_level_reduce[range_threshold] == 1){
573 /* We call Reduce function */
574 if(is_two_level == 1)
576 /* if (comm->ch.shmem_coll_ok == 1
577 && is_commutative == 1) {
578 mpi_errno = MPIR_Reduce_two_level_helper_MV2(sendbuf, recvbuf, count,
579 datatype, op, root, comm, errflag);
581 mpi_errno = MPIR_Reduce_binomial_MV2(sendbuf, recvbuf, count,
582 datatype, op, root, comm);
584 } else if(MV2_Reduce_function == &MPIR_Reduce_inter_knomial_wrapper_MV2 ){
585 if(is_commutative ==1)
587 mpi_errno = MV2_Reduce_function(sendbuf, recvbuf, count,
588 datatype, op, root, comm);
590 mpi_errno = MPIR_Reduce_binomial_MV2(sendbuf, recvbuf, count,
591 datatype, op, root, comm);
593 } else if(MV2_Reduce_function == &MPIR_Reduce_redscat_gather_MV2){
594 if (/*(HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) &&*/ (count >= pof2))
596 mpi_errno = MV2_Reduce_function(sendbuf, recvbuf, count,
597 datatype, op, root, comm);
599 mpi_errno = MPIR_Reduce_binomial_MV2(sendbuf, recvbuf, count,
600 datatype, op, root, comm);
603 mpi_errno = MV2_Reduce_function(sendbuf, recvbuf, count,
604 datatype, op, root, comm);
613 int smpi_coll_tuned_reduce_scatter_mvapich2(void *sendbuf, void *recvbuf, int *recvcnts,
614 MPI_Datatype datatype, MPI_Op op,
617 int mpi_errno = MPI_SUCCESS;
618 int i = 0, comm_size = smpi_comm_size(comm), total_count = 0, type_size =
621 int range_threshold = 0;
622 int is_commutative = 0;
623 int *disps = xbt_malloc(comm_size * sizeof (int));
625 if(mv2_red_scat_thresholds_table==NULL)
626 init_mv2_reduce_scatter_tables_stampede();
628 is_commutative=smpi_op_is_commute(op);
629 for (i = 0; i < comm_size; i++) {
630 disps[i] = total_count;
631 total_count += recvcnts[i];
634 type_size=smpi_datatype_size(datatype);
635 nbytes = total_count * type_size;
637 if (is_commutative) {
639 /* Search for the corresponding system size inside the tuning table */
640 while ((range < (mv2_size_red_scat_tuning_table - 1)) &&
641 (comm_size > mv2_red_scat_thresholds_table[range].numproc)) {
644 /* Search for corresponding inter-leader function */
645 while ((range_threshold < (mv2_red_scat_thresholds_table[range].size_inter_table - 1))
647 mv2_red_scat_thresholds_table[range].inter_leader[range_threshold].max)
648 && (mv2_red_scat_thresholds_table[range].inter_leader[range_threshold].max !=
653 /* Set inter-leader pt */
654 MV2_Red_scat_function =
655 mv2_red_scat_thresholds_table[range].inter_leader[range_threshold].
656 MV2_pt_Red_scat_function;
658 mpi_errno = MV2_Red_scat_function(sendbuf, recvbuf,
662 int is_block_regular = 1;
663 for (i = 0; i < (comm_size - 1); ++i) {
664 if (recvcnts[i] != recvcnts[i+1]) {
665 is_block_regular = 0;
670 while (pof2 < comm_size) pof2 <<= 1;
671 if (pof2 == comm_size && is_block_regular) {
672 /* noncommutative, pof2 size, and block regular */
673 mpi_errno = MPIR_Reduce_scatter_non_comm_MV2(sendbuf, recvbuf,
677 mpi_errno = smpi_coll_tuned_reduce_scatter_mpich_rdb(sendbuf, recvbuf,
688 int smpi_coll_tuned_scatter_mvapich2(void *sendbuf,
690 MPI_Datatype sendtype,
693 MPI_Datatype recvtype,
694 int root, MPI_Comm comm_ptr)
696 int range = 0, range_threshold = 0, range_threshold_intra = 0;
697 int mpi_errno = MPI_SUCCESS;
698 // int mpi_errno_ret = MPI_SUCCESS;
699 int rank, nbytes, comm_size;
700 int recvtype_size, sendtype_size;
701 int partial_sub_ok = 0;
703 // int local_size = -1;
705 // MPI_Comm shmem_comm;
706 // MPID_Comm *shmem_commptr=NULL;
707 if(mv2_scatter_thresholds_table==NULL)
708 init_mv2_scatter_tables_stampede();
710 comm_size = smpi_comm_size(comm_ptr);
712 rank = smpi_comm_rank(comm_ptr);
715 sendtype_size=smpi_datatype_size(sendtype);
716 nbytes = sendcnt * sendtype_size;
718 recvtype_size=smpi_datatype_size(recvtype);
719 nbytes = recvcnt * recvtype_size;
722 // check if safe to use partial subscription mode
723 if (comm_ptr->ch.shmem_coll_ok == 1 && comm_ptr->ch.is_uniform) {
725 shmem_comm = comm_ptr->ch.shmem_comm;
726 MPID_Comm_get_ptr(shmem_comm, shmem_commptr);
727 local_size = shmem_commptr->local_size;
729 if (mv2_scatter_table_ppn_conf[0] == -1) {
730 // Indicating user defined tuning
735 if (local_size == mv2_scatter_table_ppn_conf[i]) {
741 } while(i < mv2_scatter_num_ppn_conf);
744 if (partial_sub_ok != 1) {
748 /* Search for the corresponding system size inside the tuning table */
749 while ((range < (mv2_size_scatter_tuning_table[conf_index] - 1)) &&
750 (comm_size > mv2_scatter_thresholds_table[conf_index][range].numproc)) {
753 /* Search for corresponding inter-leader function */
754 while ((range_threshold < (mv2_scatter_thresholds_table[conf_index][range].size_inter_table - 1))
756 mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold].max)
757 && (mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold].max != -1)) {
761 /* Search for corresponding intra-node function */
762 while ((range_threshold_intra <
763 (mv2_scatter_thresholds_table[conf_index][range].size_intra_table - 1))
765 mv2_scatter_thresholds_table[conf_index][range].intra_node[range_threshold_intra].max)
766 && (mv2_scatter_thresholds_table[conf_index][range].intra_node[range_threshold_intra].max !=
768 range_threshold_intra++;
771 MV2_Scatter_function = mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold]
772 .MV2_pt_Scatter_function;
774 if(MV2_Scatter_function == &MPIR_Scatter_mcst_wrap_MV2) {
775 #if defined(_MCST_SUPPORT_)
776 if(comm_ptr->ch.is_mcast_ok == 1
777 && mv2_use_mcast_scatter == 1
778 && comm_ptr->ch.shmem_coll_ok == 1) {
779 MV2_Scatter_function = &MPIR_Scatter_mcst_MV2;
781 #endif /*#if defined(_MCST_SUPPORT_) */
783 if(mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1].
784 MV2_pt_Scatter_function != NULL) {
785 MV2_Scatter_function = mv2_scatter_thresholds_table[conf_index][range].inter_leader[range_threshold + 1]
786 .MV2_pt_Scatter_function;
789 MV2_Scatter_function = &MPIR_Scatter_MV2_Binomial;
794 if( (MV2_Scatter_function == &MPIR_Scatter_MV2_two_level_Direct) ||
795 (MV2_Scatter_function == &MPIR_Scatter_MV2_two_level_Binomial)) {
796 /* if( comm_ptr->ch.shmem_coll_ok == 1 &&
797 comm_ptr->ch.is_global_block == 1 ) {
798 MV2_Scatter_intra_function = mv2_scatter_thresholds_table[conf_index][range].intra_node[range_threshold_intra]
799 .MV2_pt_Scatter_function;
802 MV2_Scatter_function(sendbuf, sendcnt, sendtype,
803 recvbuf, recvcnt, recvtype, root,
806 mpi_errno = MPIR_Scatter_MV2_Binomial(sendbuf, sendcnt, sendtype,
807 recvbuf, recvcnt, recvtype, root,
812 mpi_errno = MV2_Scatter_function(sendbuf, sendcnt, sendtype,
813 recvbuf, recvcnt, recvtype, root,