1 /* selector for collective algorithms based on mvapich decision logic, with calibration from Stampede cluster at TACC*/
3 /* Copyright (c) 2009-2010, 2013-2014. The SimGrid Team.
4 * All rights reserved. */
6 /* This is the tuning used by MVAPICH for Stampede platform based on (MV2_ARCH_INTEL_XEON_E5_2680_16, MV2_HCA_MLX_CX_FDR) */
10 /************ Alltoall variables and initializers */
12 #define MV2_MAX_NB_THRESHOLDS 32
18 int (*MV2_pt_Alltoall_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
19 void *recvbuf, int recvcount, MPI_Datatype recvtype,
21 } mv2_alltoall_tuning_element;
26 mv2_alltoall_tuning_element algo_table[MV2_MAX_NB_THRESHOLDS];
27 mv2_alltoall_tuning_element in_place_algo_table[MV2_MAX_NB_THRESHOLDS];
28 } mv2_alltoall_tuning_table;
30 int (*MV2_Alltoall_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr)=NULL;
32 /* Indicates number of processes per node */
33 int *mv2_alltoall_table_ppn_conf = NULL;
34 /* Indicates total number of configurations */
35 int mv2_alltoall_num_ppn_conf = 1;
36 int *mv2_size_alltoall_tuning_table = NULL;
37 mv2_alltoall_tuning_table **mv2_alltoall_thresholds_table = NULL;
40 #define MPIR_Alltoall_bruck_MV2 smpi_coll_tuned_alltoall_bruck
41 #define MPIR_Alltoall_RD_MV2 smpi_coll_tuned_alltoall_rdb
42 #define MPIR_Alltoall_Scatter_dest_MV2 smpi_coll_tuned_alltoall_mvapich2_scatter_dest
43 #define MPIR_Alltoall_pairwise_MV2 smpi_coll_tuned_alltoall_pair
44 #define MPIR_Alltoall_inplace_MV2 smpi_coll_tuned_alltoall_ring
47 static void init_mv2_alltoall_tables_stampede(){
49 int agg_table_sum = 0;
50 mv2_alltoall_tuning_table **table_ptrs = NULL;
51 mv2_alltoall_num_ppn_conf = 3;
52 if(smpi_coll_cleanup_callback==NULL)
53 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
54 mv2_alltoall_thresholds_table = xbt_malloc(sizeof(mv2_alltoall_tuning_table *)
55 * mv2_alltoall_num_ppn_conf);
56 table_ptrs = xbt_malloc(sizeof(mv2_alltoall_tuning_table *)
57 * mv2_alltoall_num_ppn_conf);
58 mv2_size_alltoall_tuning_table = xbt_malloc(sizeof(int) *
59 mv2_alltoall_num_ppn_conf);
60 mv2_alltoall_table_ppn_conf = xbt_malloc(mv2_alltoall_num_ppn_conf * sizeof(int));
61 mv2_alltoall_table_ppn_conf[0] = 1;
62 mv2_size_alltoall_tuning_table[0] = 6;
63 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_1ppn[] = {
66 {{0, -1, &MPIR_Alltoall_pairwise_MV2},
69 {{0, -1, &MPIR_Alltoall_inplace_MV2},
75 {{0, 262144, &MPIR_Alltoall_Scatter_dest_MV2},
76 {262144, -1, &MPIR_Alltoall_pairwise_MV2},
79 {{0, -1, &MPIR_Alltoall_inplace_MV2},
85 {{0, 8, &MPIR_Alltoall_RD_MV2},
86 {8, -1, &MPIR_Alltoall_Scatter_dest_MV2},
89 {{0, -1, &MPIR_Alltoall_inplace_MV2},
95 {{0, 64, &MPIR_Alltoall_RD_MV2},
96 {64, 512, &MPIR_Alltoall_bruck_MV2},
97 {512, -1, &MPIR_Alltoall_Scatter_dest_MV2},
100 {{0,-1, &MPIR_Alltoall_inplace_MV2},
106 {{0, 32, &MPIR_Alltoall_RD_MV2},
107 {32, 2048, &MPIR_Alltoall_bruck_MV2},
108 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
111 {{0, -1, &MPIR_Alltoall_inplace_MV2},
117 {{0, 8, &MPIR_Alltoall_RD_MV2},
118 {8, 1024, &MPIR_Alltoall_bruck_MV2},
119 {1024, -1, &MPIR_Alltoall_Scatter_dest_MV2},
122 {{0, -1, &MPIR_Alltoall_inplace_MV2},
126 table_ptrs[0] = mv2_tmp_alltoall_thresholds_table_1ppn;
127 mv2_alltoall_table_ppn_conf[1] = 2;
128 mv2_size_alltoall_tuning_table[1] = 6;
129 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_2ppn[] = {
132 {{0, 32, &MPIR_Alltoall_RD_MV2},
133 {32, -1, &MPIR_Alltoall_Scatter_dest_MV2},
136 {{0, -1, &MPIR_Alltoall_inplace_MV2},
142 {{0, 64, &MPIR_Alltoall_RD_MV2},
143 {64, -1, &MPIR_Alltoall_Scatter_dest_MV2},
146 {{0, -1, &MPIR_Alltoall_inplace_MV2},
152 {{0, 64, &MPIR_Alltoall_RD_MV2},
153 {64, 2048, &MPIR_Alltoall_bruck_MV2},
154 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
157 {{0,-1, &MPIR_Alltoall_inplace_MV2},
163 {{0, 16, &MPIR_Alltoall_RD_MV2},
164 {16, 2048, &MPIR_Alltoall_bruck_MV2},
165 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
168 {{0, -1, &MPIR_Alltoall_inplace_MV2},
174 {{0, 8, &MPIR_Alltoall_RD_MV2},
175 {8, 1024, &MPIR_Alltoall_bruck_MV2},
176 {1024, -1, &MPIR_Alltoall_Scatter_dest_MV2},
179 {{0, -1, &MPIR_Alltoall_inplace_MV2},
185 {{0, 4, &MPIR_Alltoall_RD_MV2},
186 {4, 2048, &MPIR_Alltoall_bruck_MV2},
187 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
190 {{0, -1, &MPIR_Alltoall_inplace_MV2},
194 table_ptrs[1] = mv2_tmp_alltoall_thresholds_table_2ppn;
195 mv2_alltoall_table_ppn_conf[2] = 16;
196 mv2_size_alltoall_tuning_table[2] = 7;
197 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_16ppn[] = {
200 {{0, 2048, &MPIR_Alltoall_bruck_MV2},
201 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
204 {{32768, -1, &MPIR_Alltoall_inplace_MV2},
210 {{0, 2048, &MPIR_Alltoall_bruck_MV2},
211 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
214 {{16384, -1, &MPIR_Alltoall_inplace_MV2},
220 {{0, 2048, &MPIR_Alltoall_bruck_MV2},
221 {2048, 16384, &MPIR_Alltoall_Scatter_dest_MV2},
222 {16384, -1, &MPIR_Alltoall_pairwise_MV2},
225 {{32768, 131072, &MPIR_Alltoall_inplace_MV2},
231 {{0, 2048, &MPIR_Alltoall_bruck_MV2},
232 {2048, -1, &MPIR_Alltoall_pairwise_MV2},
235 {{16384,65536, &MPIR_Alltoall_inplace_MV2},
241 {{0, 1024, &MPIR_Alltoall_bruck_MV2},
242 {1024, -1, &MPIR_Alltoall_pairwise_MV2},
245 {{16384, 65536, &MPIR_Alltoall_inplace_MV2},
251 {{0, 1024, &MPIR_Alltoall_bruck_MV2},
252 {1024, -1, &MPIR_Alltoall_pairwise_MV2},
255 {{16384, 65536, &MPIR_Alltoall_inplace_MV2},
260 {{0, 1024, &MPIR_Alltoall_bruck_MV2},
261 {1024, -1, &MPIR_Alltoall_pairwise_MV2},
264 {{16384, 65536, &MPIR_Alltoall_inplace_MV2},
269 table_ptrs[2] = mv2_tmp_alltoall_thresholds_table_16ppn;
271 for (i = 0; i < mv2_alltoall_num_ppn_conf; i++) {
272 agg_table_sum += mv2_size_alltoall_tuning_table[i];
274 mv2_alltoall_thresholds_table[0] =
275 xbt_malloc(agg_table_sum * sizeof (mv2_alltoall_tuning_table));
276 memcpy(mv2_alltoall_thresholds_table[0], table_ptrs[0],
277 (sizeof(mv2_alltoall_tuning_table)
278 * mv2_size_alltoall_tuning_table[0]));
279 for (i = 1; i < mv2_alltoall_num_ppn_conf; i++) {
280 mv2_alltoall_thresholds_table[i] =
281 mv2_alltoall_thresholds_table[i - 1]
282 + mv2_size_alltoall_tuning_table[i - 1];
283 memcpy(mv2_alltoall_thresholds_table[i], table_ptrs[i],
284 (sizeof(mv2_alltoall_tuning_table)
285 * mv2_size_alltoall_tuning_table[i]));
287 xbt_free(table_ptrs);
293 /************ Allgather variables and initializers */
298 int (*MV2_pt_Allgather_function)(void *sendbuf,
300 MPI_Datatype sendtype,
303 MPI_Datatype recvtype, MPI_Comm comm_ptr);
304 } mv2_allgather_tuning_element;
308 int two_level[MV2_MAX_NB_THRESHOLDS];
309 int size_inter_table;
310 mv2_allgather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
311 } mv2_allgather_tuning_table;
313 int (*MV2_Allgather_function)(void *sendbuf,
315 MPI_Datatype sendtype,
318 MPI_Datatype recvtype, MPI_Comm comm);
320 int *mv2_allgather_table_ppn_conf = NULL;
321 int mv2_allgather_num_ppn_conf = 1;
322 int *mv2_size_allgather_tuning_table = NULL;
323 mv2_allgather_tuning_table **mv2_allgather_thresholds_table = NULL;
325 static int MPIR_Allgather_RD_Allgather_Comm_MV2( void *sendbuf,
327 MPI_Datatype sendtype,
330 MPI_Datatype recvtype, MPI_Comm comm_ptr)
335 #define MPIR_Allgather_Bruck_MV2 smpi_coll_tuned_allgather_bruck
336 #define MPIR_Allgather_RD_MV2 smpi_coll_tuned_allgather_rdb
337 #define MPIR_Allgather_Ring_MV2 smpi_coll_tuned_allgather_ring
338 #define MPIR_2lvl_Allgather_MV2 smpi_coll_tuned_allgather_mvapich2_smp
340 static void init_mv2_allgather_tables_stampede(){
342 int agg_table_sum = 0;
344 if(smpi_coll_cleanup_callback==NULL)
345 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
346 mv2_allgather_tuning_table **table_ptrs = NULL;
347 mv2_allgather_num_ppn_conf = 3;
348 mv2_allgather_thresholds_table
349 = xbt_malloc(sizeof(mv2_allgather_tuning_table *)
350 * mv2_allgather_num_ppn_conf);
351 table_ptrs = xbt_malloc(sizeof(mv2_allgather_tuning_table *)
352 * mv2_allgather_num_ppn_conf);
353 mv2_size_allgather_tuning_table = xbt_malloc(sizeof(int) *
354 mv2_allgather_num_ppn_conf);
355 mv2_allgather_table_ppn_conf
356 = xbt_malloc(mv2_allgather_num_ppn_conf * sizeof(int));
357 mv2_allgather_table_ppn_conf[0] = 1;
358 mv2_size_allgather_tuning_table[0] = 6;
359 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_1ppn[] = {
365 {0, -1, &MPIR_Allgather_Ring_MV2},
373 {0, 262144, &MPIR_Allgather_RD_MV2},
374 {262144, -1, &MPIR_Allgather_Ring_MV2},
382 {0, 131072, &MPIR_Allgather_RD_MV2},
383 {131072, -1, &MPIR_Allgather_Ring_MV2},
391 {0, 131072, &MPIR_Allgather_RD_MV2},
392 {131072, -1, &MPIR_Allgather_Ring_MV2},
400 {0, 65536, &MPIR_Allgather_RD_MV2},
401 {65536, -1, &MPIR_Allgather_Ring_MV2},
409 {0, 32768, &MPIR_Allgather_RD_MV2},
410 {32768, -1, &MPIR_Allgather_Ring_MV2},
414 table_ptrs[0] = mv2_tmp_allgather_thresholds_table_1ppn;
415 mv2_allgather_table_ppn_conf[1] = 2;
416 mv2_size_allgather_tuning_table[1] = 6;
417 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_2ppn[] = {
423 {0, 524288, &MPIR_Allgather_RD_MV2},
424 {524288, -1, &MPIR_Allgather_Ring_MV2},
432 {0, 32768, &MPIR_Allgather_RD_MV2},
433 {32768, 524288, &MPIR_Allgather_Ring_MV2},
434 {524288, -1, &MPIR_Allgather_Ring_MV2},
442 {0, 16384, &MPIR_Allgather_RD_MV2},
443 {16384, 524288, &MPIR_Allgather_Ring_MV2},
444 {524288, -1, &MPIR_Allgather_Ring_MV2},
452 {0, 65536, &MPIR_Allgather_RD_MV2},
453 {65536, 524288, &MPIR_Allgather_Ring_MV2},
454 {524288, -1, &MPIR_Allgather_Ring_MV2},
462 {0, 32768, &MPIR_Allgather_RD_MV2},
463 {32768, 524288, &MPIR_Allgather_Ring_MV2},
464 {524288, -1, &MPIR_Allgather_Ring_MV2},
472 {0, 65536, &MPIR_Allgather_RD_MV2},
473 {65536, 524288, &MPIR_Allgather_Ring_MV2},
474 {524288, -1, &MPIR_Allgather_Ring_MV2},
478 table_ptrs[1] = mv2_tmp_allgather_thresholds_table_2ppn;
479 mv2_allgather_table_ppn_conf[2] = 16;
480 mv2_size_allgather_tuning_table[2] = 6;
481 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_16ppn[] = {
487 {0, 1024, &MPIR_Allgather_RD_MV2},
488 {1024, -1, &MPIR_Allgather_Ring_MV2},
496 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2},
497 {1024, -1, &MPIR_Allgather_Ring_MV2},
505 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2},
506 {1024, -1, &MPIR_Allgather_Ring_MV2},
514 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2},
515 {1024, -1, &MPIR_Allgather_Ring_MV2},
523 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2},
524 {1024, -1, &MPIR_Allgather_Ring_MV2},
532 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2},
533 {1024, -1, &MPIR_Allgather_Ring_MV2},
538 table_ptrs[2] = mv2_tmp_allgather_thresholds_table_16ppn;
540 for (i = 0; i < mv2_allgather_num_ppn_conf; i++) {
541 agg_table_sum += mv2_size_allgather_tuning_table[i];
543 mv2_allgather_thresholds_table[0] =
544 xbt_malloc(agg_table_sum * sizeof (mv2_allgather_tuning_table));
545 memcpy(mv2_allgather_thresholds_table[0], table_ptrs[0],
546 (sizeof(mv2_allgather_tuning_table)
547 * mv2_size_allgather_tuning_table[0]));
548 for (i = 1; i < mv2_allgather_num_ppn_conf; i++) {
549 mv2_allgather_thresholds_table[i] =
550 mv2_allgather_thresholds_table[i - 1]
551 + mv2_size_allgather_tuning_table[i - 1];
552 memcpy(mv2_allgather_thresholds_table[i], table_ptrs[i],
553 (sizeof(mv2_allgather_tuning_table)
554 * mv2_size_allgather_tuning_table[i]));
556 xbt_free(table_ptrs);
560 /************ Gather variables and initializers */
565 int (*MV2_pt_Gather_function)(void *sendbuf, int sendcnt,
566 MPI_Datatype sendtype, void *recvbuf, int recvcnt,
567 MPI_Datatype recvtype, int root, MPI_Comm comm_ptr);
568 } mv2_gather_tuning_element;
573 int size_inter_table;
574 mv2_gather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
575 int size_intra_table;
576 mv2_gather_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
577 } mv2_gather_tuning_table;
579 int mv2_size_gather_tuning_table=7;
580 mv2_gather_tuning_table * mv2_gather_thresholds_table=NULL;
582 typedef int (*MV2_Gather_function_ptr) (void *sendbuf,
584 MPI_Datatype sendtype,
587 MPI_Datatype recvtype,
588 int root, MPI_Comm comm);
590 MV2_Gather_function_ptr MV2_Gather_inter_leader_function = NULL;
591 MV2_Gather_function_ptr MV2_Gather_intra_node_function = NULL;
594 #define MPIR_Gather_MV2_Direct smpi_coll_tuned_gather_ompi_basic_linear
595 #define MPIR_Gather_MV2_two_level_Direct smpi_coll_tuned_gather_mvapich2_two_level
596 #define MPIR_Gather_intra smpi_coll_tuned_gather_mpich
599 static void init_mv2_gather_tables_stampede(){
601 if(smpi_coll_cleanup_callback==NULL)
602 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
603 mv2_size_gather_tuning_table=7;
604 mv2_gather_thresholds_table = xbt_malloc(mv2_size_gather_tuning_table*
605 sizeof (mv2_gather_tuning_table));
606 mv2_gather_tuning_table mv2_tmp_gather_thresholds_table[]={
608 2,{{0, 524288, &MPIR_Gather_MV2_Direct},
609 {524288, -1, &MPIR_Gather_intra}},
610 1,{{0, -1, &MPIR_Gather_MV2_Direct}}},
612 3,{{0, 16384, &MPIR_Gather_MV2_Direct},
613 {16384, 131072, &MPIR_Gather_intra},
614 {131072, -1, &MPIR_Gather_MV2_two_level_Direct}},
615 1,{{0, -1, &MPIR_Gather_intra}}},
617 3,{{0, 256, &MPIR_Gather_MV2_two_level_Direct},
618 {256, 16384, &MPIR_Gather_MV2_Direct},
619 {256, -1, &MPIR_Gather_MV2_two_level_Direct}},
620 1,{{0, -1, &MPIR_Gather_intra}}},
622 3,{{0, 512, &MPIR_Gather_MV2_two_level_Direct},
623 {512, 16384, &MPIR_Gather_MV2_Direct},
624 {16384, -1, &MPIR_Gather_MV2_two_level_Direct}},
625 1,{{0, -1, &MPIR_Gather_intra}}},
627 3,{{0, 512, &MPIR_Gather_MV2_two_level_Direct},
628 {512, 16384, &MPIR_Gather_MV2_Direct},
629 {16384, -1, &MPIR_Gather_MV2_two_level_Direct}},
630 1,{{0, -1, &MPIR_Gather_intra}}},
632 3,{{0, 512, &MPIR_Gather_MV2_two_level_Direct},
633 {512, 16384, &MPIR_Gather_MV2_Direct},
634 {8196, -1, &MPIR_Gather_MV2_two_level_Direct}},
635 1,{{0, -1, &MPIR_Gather_intra}}},
637 3,{{0, 512, &MPIR_Gather_MV2_two_level_Direct},
638 {512, 16384, &MPIR_Gather_MV2_Direct},
639 {8196, -1, &MPIR_Gather_MV2_two_level_Direct}},
640 1,{{0, -1, &MPIR_Gather_intra}}},
643 memcpy(mv2_gather_thresholds_table, mv2_tmp_gather_thresholds_table,
644 mv2_size_gather_tuning_table * sizeof (mv2_gather_tuning_table));
649 /************ Allgatherv variables and initializers */
654 int (*MV2_pt_Allgatherv_function)(void *sendbuf,
656 MPI_Datatype sendtype,
660 MPI_Datatype recvtype,
662 } mv2_allgatherv_tuning_element;
666 int size_inter_table;
667 mv2_allgatherv_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
668 } mv2_allgatherv_tuning_table;
670 int (*MV2_Allgatherv_function)(void *sendbuf,
672 MPI_Datatype sendtype,
676 MPI_Datatype recvtype,
679 int mv2_size_allgatherv_tuning_table = 0;
680 mv2_allgatherv_tuning_table *mv2_allgatherv_thresholds_table = NULL;
682 #define MPIR_Allgatherv_Rec_Doubling_MV2 smpi_coll_tuned_allgatherv_mpich_rdb
683 #define MPIR_Allgatherv_Bruck_MV2 smpi_coll_tuned_allgatherv_ompi_bruck
684 #define MPIR_Allgatherv_Ring_MV2 smpi_coll_tuned_allgatherv_mpich_ring
687 static void init_mv2_allgatherv_tables_stampede(){
688 if(smpi_coll_cleanup_callback==NULL)
689 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
690 mv2_size_allgatherv_tuning_table = 6;
691 mv2_allgatherv_thresholds_table = xbt_malloc(mv2_size_allgatherv_tuning_table *
692 sizeof (mv2_allgatherv_tuning_table));
693 mv2_allgatherv_tuning_table mv2_tmp_allgatherv_thresholds_table[] = {
698 {0, 512, &MPIR_Allgatherv_Rec_Doubling_MV2},
699 {512, -1, &MPIR_Allgatherv_Ring_MV2},
706 {0, 512, &MPIR_Allgatherv_Rec_Doubling_MV2},
707 {512, -1, &MPIR_Allgatherv_Ring_MV2},
714 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2},
715 {256, -1, &MPIR_Allgatherv_Ring_MV2},
722 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2},
723 {256, -1, &MPIR_Allgatherv_Ring_MV2},
730 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2},
731 {256, -1, &MPIR_Allgatherv_Ring_MV2},
738 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2},
739 {256, -1, &MPIR_Allgatherv_Ring_MV2},
744 memcpy(mv2_allgatherv_thresholds_table, mv2_tmp_allgatherv_thresholds_table,
745 mv2_size_allgatherv_tuning_table * sizeof (mv2_allgatherv_tuning_table));
749 /************ Allreduce variables and initializers */
754 int (*MV2_pt_Allreduce_function)(void *sendbuf,
757 MPI_Datatype datatype,
758 MPI_Op op, MPI_Comm comm);
759 } mv2_allreduce_tuning_element;
764 int is_two_level_allreduce[MV2_MAX_NB_THRESHOLDS];
765 int size_inter_table;
766 mv2_allreduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
767 int size_intra_table;
768 mv2_allreduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
769 } mv2_allreduce_tuning_table;
772 int (*MV2_Allreduce_function)(void *sendbuf,
775 MPI_Datatype datatype,
776 MPI_Op op, MPI_Comm comm)=NULL;
779 int (*MV2_Allreduce_intra_function)( void *sendbuf,
782 MPI_Datatype datatype,
783 MPI_Op op, MPI_Comm comm)=NULL;
785 int mv2_size_allreduce_tuning_table = 0;
786 mv2_allreduce_tuning_table *mv2_allreduce_thresholds_table = NULL;
792 static int MPIR_Allreduce_mcst_reduce_two_level_helper_MV2( void *sendbuf,
795 MPI_Datatype datatype,
796 MPI_Op op, MPI_Comm comm)
801 static int MPIR_Allreduce_mcst_reduce_redscat_gather_MV2( void *sendbuf,
804 MPI_Datatype datatype,
805 MPI_Op op, MPI_Comm comm)
810 static int MPIR_Allreduce_reduce_p2p_MV2( void *sendbuf,
813 MPI_Datatype datatype,
814 MPI_Op op, MPI_Comm comm)
816 mpi_coll_reduce_fun(sendbuf,recvbuf,count,datatype,op,0,comm);
820 static int MPIR_Allreduce_reduce_shmem_MV2( void *sendbuf,
823 MPI_Datatype datatype,
824 MPI_Op op, MPI_Comm comm)
826 mpi_coll_reduce_fun(sendbuf,recvbuf,count,datatype,op,0,comm);
830 #define MPIR_Allreduce_pt2pt_rd_MV2 smpi_coll_tuned_allreduce_rdb
831 #define MPIR_Allreduce_pt2pt_rs_MV2 smpi_coll_tuned_allreduce_mvapich2_rs
832 #define MPIR_Allreduce_two_level_MV2 smpi_coll_tuned_allreduce_mvapich2_two_level
835 static void init_mv2_allreduce_tables_stampede(){
836 if(smpi_coll_cleanup_callback==NULL)
837 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
838 mv2_size_allreduce_tuning_table = 8;
839 mv2_allreduce_thresholds_table = xbt_malloc(mv2_size_allreduce_tuning_table *
840 sizeof (mv2_allreduce_tuning_table));
841 mv2_allreduce_tuning_table mv2_tmp_allreduce_thresholds_table[] = {
848 {0, 1024, &MPIR_Allreduce_pt2pt_rd_MV2},
849 {1024, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
853 {0, 1024, &MPIR_Allreduce_reduce_shmem_MV2},
854 {1024, -1, &MPIR_Allreduce_reduce_p2p_MV2},
863 {0, 1024, &MPIR_Allreduce_pt2pt_rd_MV2},
864 {1024, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
865 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
869 {0, 1024, &MPIR_Allreduce_reduce_shmem_MV2},
870 {1024, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
879 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
880 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
881 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
885 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
886 {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
895 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
896 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
897 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
901 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
902 {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
911 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
912 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
913 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
917 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
918 {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
927 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
928 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
929 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
933 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
934 {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
943 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
944 {512, 8192, &MPIR_Allreduce_pt2pt_rd_MV2},
945 {8192, 65536, &MPIR_Allreduce_pt2pt_rs_MV2},
946 {65536, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
950 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
951 {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
960 {0, 64, &MPIR_Allreduce_pt2pt_rd_MV2},
961 {64, 512, &MPIR_Allreduce_reduce_p2p_MV2},
962 {512, 4096, &MPIR_Allreduce_mcst_reduce_two_level_helper_MV2},
963 {4096, 16384, &MPIR_Allreduce_pt2pt_rs_MV2},
964 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
968 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2},
969 {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
974 memcpy(mv2_allreduce_thresholds_table, mv2_tmp_allreduce_thresholds_table,
975 mv2_size_allreduce_tuning_table * sizeof (mv2_allreduce_tuning_table));
984 int (*MV2_pt_Bcast_function) (void *buf, int count, MPI_Datatype datatype,
985 int root, MPI_Comm comm_ptr);
986 int zcpy_pipelined_knomial_factor;
987 } mv2_bcast_tuning_element;
991 int bcast_segment_size;
992 int intra_node_knomial_factor;
993 int inter_node_knomial_factor;
994 int is_two_level_bcast[MV2_MAX_NB_THRESHOLDS];
995 int size_inter_table;
996 mv2_bcast_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
997 int size_intra_table;
998 mv2_bcast_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
999 } mv2_bcast_tuning_table;
1001 int mv2_size_bcast_tuning_table = 0;
1002 mv2_bcast_tuning_table *mv2_bcast_thresholds_table = NULL;
1005 int (*MV2_Bcast_function) (void *buffer, int count, MPI_Datatype datatype,
1006 int root, MPI_Comm comm_ptr) = NULL;
1008 int (*MV2_Bcast_intra_node_function) (void *buffer, int count, MPI_Datatype datatype,
1009 int root, MPI_Comm comm_ptr) = NULL;
1011 int zcpy_knomial_factor = 2;
1012 int mv2_pipelined_zcpy_knomial_factor = -1;
1013 int bcast_segment_size = 8192;
1014 int mv2_inter_node_knomial_factor = 4;
1015 int mv2_intra_node_knomial_factor = 4;
1016 #define mv2_bcast_two_level_system_size 64
1017 #define mv2_bcast_short_msg 16384
1018 #define mv2_bcast_large_msg 512*1024
1020 #define INTRA_NODE_ROOT 0
1022 #define MPIR_Pipelined_Bcast_Zcpy_MV2 smpi_coll_tuned_bcast_mpich
1023 #define MPIR_Pipelined_Bcast_MV2 smpi_coll_tuned_bcast_mpich
1024 #define MPIR_Bcast_binomial_MV2 smpi_coll_tuned_bcast_binomial_tree
1025 #define MPIR_Bcast_scatter_ring_allgather_shm_MV2 smpi_coll_tuned_bcast_scatter_LR_allgather
1026 #define MPIR_Bcast_scatter_doubling_allgather_MV2 smpi_coll_tuned_bcast_scatter_rdb_allgather
1027 #define MPIR_Bcast_scatter_ring_allgather_MV2 smpi_coll_tuned_bcast_scatter_LR_allgather
1028 #define MPIR_Shmem_Bcast_MV2 smpi_coll_tuned_bcast_mpich
1029 #define MPIR_Bcast_tune_inter_node_helper_MV2 smpi_coll_tuned_bcast_mvapich2_inter_node
1030 #define MPIR_Bcast_inter_node_helper_MV2 smpi_coll_tuned_bcast_mvapich2_inter_node
1031 #define MPIR_Knomial_Bcast_intra_node_MV2 smpi_coll_tuned_bcast_mvapich2_knomial_intra_node
1032 #define MPIR_Bcast_intra_MV2 smpi_coll_tuned_bcast_mvapich2_intra_node
1034 static void init_mv2_bcast_tables_stampede(){
1036 if(smpi_coll_cleanup_callback==NULL)
1037 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
1038 mv2_size_bcast_tuning_table=8;
1039 mv2_bcast_thresholds_table = xbt_malloc(mv2_size_bcast_tuning_table *
1040 sizeof (mv2_bcast_tuning_table));
1042 mv2_bcast_tuning_table mv2_tmp_bcast_thresholds_table[]={
1046 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
1049 {0, 8, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1050 {8, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1051 {16, 1024, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1052 {1024, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1053 {8192, 16384, &MPIR_Bcast_binomial_MV2, -1},
1054 {16384, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1055 {32768, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1056 {65536, 131072, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1},
1057 {131072, 262144, &MPIR_Bcast_scatter_ring_allgather_MV2, -1},
1058 {262144, 524288, &MPIR_Bcast_scatter_doubling_allgather_MV2, -1},
1059 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_MV2, -1}
1063 {0, 8, &MPIR_Shmem_Bcast_MV2, 2},
1064 {8, 16, &MPIR_Shmem_Bcast_MV2, 4},
1065 {16, 1024, &MPIR_Shmem_Bcast_MV2, 2},
1066 {1024, 8192, &MPIR_Shmem_Bcast_MV2, 4},
1067 {8192, 16384, &MPIR_Shmem_Bcast_MV2, -1},
1068 {16384, 32768, &MPIR_Shmem_Bcast_MV2, 4},
1069 {32768, 65536, &MPIR_Shmem_Bcast_MV2, 2},
1070 {65536, 131072, &MPIR_Shmem_Bcast_MV2, -1},
1071 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1072 {262144, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1073 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}
1079 {1, 1, 1, 1, 1, 1, 1, 1},
1082 {0, 128, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1083 {128, 256, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1084 {256, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1085 {32768, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1086 {65536, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1087 {131072, 262144, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1088 {262144, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1089 {524288, -1, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8}
1093 {0, 128, &MPIR_Shmem_Bcast_MV2, 2},
1094 {128, 256, &MPIR_Shmem_Bcast_MV2, 4},
1095 {256, 32768, &MPIR_Shmem_Bcast_MV2, 2},
1096 {32768, 65536, &MPIR_Shmem_Bcast_MV2, 4},
1097 {65536, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1098 {131072, 262144, &MPIR_Shmem_Bcast_MV2, 8},
1099 {262144, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1100 {524288, -1, &MPIR_Shmem_Bcast_MV2, 8}
1106 {1, 1, 1, 1, 1, 1, 1, 1, 1},
1109 {0, 2, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1110 {2, 4, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1111 {4, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1112 {16, 32, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1113 {32, 128, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1114 {128, 256, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1115 {256, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1116 {4096, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1117 {32768, -1, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2}
1121 {0, 2, &MPIR_Shmem_Bcast_MV2, 4},
1122 {2, 4, &MPIR_Shmem_Bcast_MV2, 8},
1123 {4, 16, &MPIR_Shmem_Bcast_MV2, 4},
1124 {16, 32, &MPIR_Shmem_Bcast_MV2, 8},
1125 {32, 128, &MPIR_Shmem_Bcast_MV2, 4},
1126 {128, 256, &MPIR_Shmem_Bcast_MV2, 8},
1127 {256, 4096, &MPIR_Shmem_Bcast_MV2, 4},
1128 {4096, 32768, &MPIR_Shmem_Bcast_MV2, 8},
1129 {32768, -1, &MPIR_Shmem_Bcast_MV2, 2}
1138 {0, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1139 {8192, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1140 {16384, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1141 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_MV2, -1}
1145 {0, 8192, &MPIR_Shmem_Bcast_MV2, 8},
1146 {8192, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1147 {16384, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1148 {524288, -1, NULL, -1}
1157 {0, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1158 {16384, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1159 {131072, 262144, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1},
1160 {262144, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1161 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}
1165 {0, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1166 {16384, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1167 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1168 {262144, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1169 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}
1178 {0, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1179 {4096, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1180 {16384, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1181 {131072, 262144, &MPIR_Pipelined_Bcast_MV2, -1},
1182 {262144, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}
1186 {0, 4096, &MPIR_Shmem_Bcast_MV2, 8},
1187 {4096, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1188 {16384, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1189 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1190 {262144, -1, &MPIR_Shmem_Bcast_MV2, -1}
1199 {0, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1200 {8192, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1201 {16384, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1202 {65536, 524288, &MPIR_Pipelined_Bcast_MV2, -1},
1203 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}
1207 {0, 8192, &MPIR_Shmem_Bcast_MV2, 8},
1208 {8192, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1209 {16384, 65536, &MPIR_Shmem_Bcast_MV2, 2},
1210 {65536, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1211 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}
1217 {1, 1, 1, 1, 1, 1, 1},
1220 {0, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1221 {16, 32, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1222 {32, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1223 {4096, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1224 {16384, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1225 {32768, 524288, &MPIR_Pipelined_Bcast_MV2, -1},
1226 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}
1230 {0, 16, &MPIR_Shmem_Bcast_MV2, 8},
1231 {16, 32, &MPIR_Shmem_Bcast_MV2, 4},
1232 {32, 4096, &MPIR_Shmem_Bcast_MV2, 8},
1233 {4096, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1234 {16384, 32768, &MPIR_Shmem_Bcast_MV2, 2},
1235 {32768, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1236 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}
1241 memcpy(mv2_bcast_thresholds_table, mv2_tmp_bcast_thresholds_table,
1242 mv2_size_bcast_tuning_table * sizeof (mv2_bcast_tuning_table));
1246 /************ Reduce variables and initializers */
1251 int (*MV2_pt_Reduce_function)(void *sendbuf,
1254 MPI_Datatype datatype,
1258 } mv2_reduce_tuning_element;
1264 int is_two_level_reduce[MV2_MAX_NB_THRESHOLDS];
1265 int size_inter_table;
1266 mv2_reduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1267 int size_intra_table;
1268 mv2_reduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
1269 } mv2_reduce_tuning_table;
1271 int mv2_size_reduce_tuning_table = 0;
1272 mv2_reduce_tuning_table *mv2_reduce_thresholds_table = NULL;
1275 int mv2_reduce_intra_knomial_factor = -1;
1276 int mv2_reduce_inter_knomial_factor = -1;
1278 int (*MV2_Reduce_function)( void *sendbuf,
1281 MPI_Datatype datatype,
1284 MPI_Comm comm_ptr)=NULL;
1286 int (*MV2_Reduce_intra_function)( void *sendbuf,
1289 MPI_Datatype datatype,
1292 MPI_Comm comm_ptr)=NULL;
1295 #define MPIR_Reduce_inter_knomial_wrapper_MV2 smpi_coll_tuned_reduce_mvapich2_knomial
1296 #define MPIR_Reduce_intra_knomial_wrapper_MV2 smpi_coll_tuned_reduce_mvapich2_knomial
1297 #define MPIR_Reduce_binomial_MV2 smpi_coll_tuned_reduce_binomial
1298 #define MPIR_Reduce_redscat_gather_MV2 smpi_coll_tuned_reduce_scatter_gather
1299 #define MPIR_Reduce_shmem_MV2 smpi_coll_tuned_reduce_ompi_basic_linear
1300 #define MPIR_Reduce_two_level_helper_MV2 smpi_coll_tuned_reduce_mvapich2_two_level
1303 static void init_mv2_reduce_tables_stampede(){
1304 if(smpi_coll_cleanup_callback==NULL)
1305 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
1307 mv2_size_reduce_tuning_table = 8;
1308 mv2_reduce_thresholds_table = xbt_malloc(mv2_size_reduce_tuning_table *
1309 sizeof (mv2_reduce_tuning_table));
1310 mv2_reduce_tuning_table mv2_tmp_reduce_thresholds_table[] = {
1318 {0, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1319 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1320 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1324 {0, 65536, &MPIR_Reduce_shmem_MV2},
1325 {65536,-1, &MPIR_Reduce_binomial_MV2},
1332 {1, 1, 1, 1, 0, 0, 0},
1335 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1336 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1337 {16384, 32768, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1338 {32768, 65536, &MPIR_Reduce_binomial_MV2},
1339 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1340 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1341 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1345 {0, 8192, &MPIR_Reduce_shmem_MV2},
1346 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1347 {16384, 32768, &MPIR_Reduce_shmem_MV2},
1348 {32768, 65536, &MPIR_Reduce_shmem_MV2},
1349 {65536, 262144, &MPIR_Reduce_shmem_MV2},
1350 {262144,-1, &MPIR_Reduce_binomial_MV2},
1360 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1361 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1362 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1363 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1364 {262144, -1, &MPIR_Reduce_redscat_gather_MV2},
1368 {0, 8192, &MPIR_Reduce_shmem_MV2},
1369 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1370 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1371 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1372 {262144, -1, &MPIR_Reduce_binomial_MV2},
1382 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1383 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1384 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1385 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1386 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1387 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1391 {0, 8192, &MPIR_Reduce_shmem_MV2},
1392 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1393 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1394 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1395 {262144, -1, &MPIR_Reduce_binomial_MV2},
1402 {1, 1, 1, 0, 1, 1, 0},
1405 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1406 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1407 {16384, 32768, &MPIR_Reduce_binomial_MV2},
1408 {32768, 65536, &MPIR_Reduce_binomial_MV2},
1409 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1410 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1411 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1415 {0, 8192, &MPIR_Reduce_shmem_MV2},
1416 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1417 {16384, 32768, &MPIR_Reduce_shmem_MV2},
1418 {32768, 65536, &MPIR_Reduce_shmem_MV2},
1419 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1420 {262144, -1, &MPIR_Reduce_binomial_MV2},
1430 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1431 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1432 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1433 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1434 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1435 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1439 {0, 8192, &MPIR_Reduce_shmem_MV2},
1440 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1441 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1442 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1443 {262144, -1, &MPIR_Reduce_binomial_MV2},
1453 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1454 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1455 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1456 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1457 {262144, -1, &MPIR_Reduce_binomial_MV2},
1461 {0, 8192, &MPIR_Reduce_shmem_MV2},
1462 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1463 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1464 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1465 {262144, -1, &MPIR_Reduce_binomial_MV2},
1475 {0, 2048, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1476 {2048, 4096, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1477 {4096, 16384, &MPIR_Reduce_binomial_MV2},
1478 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1479 {65536, 131072, &MPIR_Reduce_binomial_MV2},
1480 {131072, -1, &MPIR_Reduce_binomial_MV2},
1484 {0, 2048, &MPIR_Reduce_shmem_MV2},
1485 {2048, 4096, &MPIR_Reduce_shmem_MV2},
1486 {4096, 16384, &MPIR_Reduce_shmem_MV2},
1487 {16384, 65536, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1488 {65536, 131072, &MPIR_Reduce_binomial_MV2},
1489 {131072, -1, &MPIR_Reduce_shmem_MV2},
1494 memcpy(mv2_reduce_thresholds_table, mv2_tmp_reduce_thresholds_table,
1495 mv2_size_reduce_tuning_table * sizeof (mv2_reduce_tuning_table));
1498 /************ Reduce scatter variables and initializers */
1503 int (*MV2_pt_Red_scat_function)(void *sendbuf,
1506 MPI_Datatype datatype,
1509 } mv2_red_scat_tuning_element;
1513 int size_inter_table;
1514 mv2_red_scat_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1515 } mv2_red_scat_tuning_table;
1517 int mv2_size_red_scat_tuning_table = 0;
1518 mv2_red_scat_tuning_table *mv2_red_scat_thresholds_table = NULL;
1521 int (*MV2_Red_scat_function)(void *sendbuf,
1524 MPI_Datatype datatype,
1530 static int MPIR_Reduce_Scatter_Basic_MV2(void *sendbuf,
1533 MPI_Datatype datatype,
1537 smpi_mpi_reduce_scatter(sendbuf,recvbuf,recvcnts,datatype,op,comm);
1540 #define MPIR_Reduce_scatter_non_comm_MV2 smpi_coll_tuned_reduce_scatter_mpich_noncomm
1541 #define MPIR_Reduce_scatter_Rec_Halving_MV2 smpi_coll_tuned_reduce_scatter_ompi_basic_recursivehalving
1542 #define MPIR_Reduce_scatter_Pair_Wise_MV2 smpi_coll_tuned_reduce_scatter_mpich_pair
1547 static void init_mv2_reduce_scatter_tables_stampede(){
1548 if(smpi_coll_cleanup_callback==NULL)
1549 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
1550 mv2_size_red_scat_tuning_table = 6;
1551 mv2_red_scat_thresholds_table = xbt_malloc(mv2_size_red_scat_tuning_table *
1552 sizeof (mv2_red_scat_tuning_table));
1553 mv2_red_scat_tuning_table mv2_tmp_red_scat_thresholds_table[] = {
1558 {0, 64, &MPIR_Reduce_Scatter_Basic_MV2},
1559 {64, 65536, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1560 {65536, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1567 {0, 64, &MPIR_Reduce_Scatter_Basic_MV2},
1568 {64, 131072, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1569 {131072, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1576 {0, 1024, &MPIR_Reduce_Scatter_Basic_MV2},
1577 {1024, 262144, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1578 {262144, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1585 {0, 128, &MPIR_Reduce_Scatter_Basic_MV2},
1586 {128, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1593 {0, 128, &MPIR_Reduce_Scatter_Basic_MV2},
1594 {128, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1601 {0, 256, &MPIR_Reduce_Scatter_Basic_MV2},
1602 {256, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1607 memcpy(mv2_red_scat_thresholds_table, mv2_tmp_red_scat_thresholds_table,
1608 mv2_size_red_scat_tuning_table * sizeof (mv2_red_scat_tuning_table));
1611 /************ Scatter variables and initializers */
1616 int (*MV2_pt_Scatter_function)(void *sendbuf,
1618 MPI_Datatype sendtype,
1621 MPI_Datatype recvtype,
1622 int root, MPI_Comm comm);
1623 } mv2_scatter_tuning_element;
1627 int size_inter_table;
1628 mv2_scatter_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1629 int size_intra_table;
1630 mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
1631 } mv2_scatter_tuning_table;
1634 int *mv2_scatter_table_ppn_conf = NULL;
1635 int mv2_scatter_num_ppn_conf = 1;
1636 int *mv2_size_scatter_tuning_table = NULL;
1637 mv2_scatter_tuning_table **mv2_scatter_thresholds_table = NULL;
1639 int (*MV2_Scatter_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1640 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1641 int root, MPI_Comm comm)=NULL;
1643 int (*MV2_Scatter_intra_function) (void *sendbuf, int sendcount, MPI_Datatype sendtype,
1644 void *recvbuf, int recvcount, MPI_Datatype recvtype,
1645 int root, MPI_Comm comm)=NULL;
1646 int MPIR_Scatter_mcst_wrap_MV2(void *sendbuf,
1648 MPI_Datatype sendtype,
1651 MPI_Datatype recvtype,
1652 int root, MPI_Comm comm_ptr);
1654 int MPIR_Scatter_mcst_wrap_MV2(void *sendbuf,
1656 MPI_Datatype sendtype,
1659 MPI_Datatype recvtype,
1660 int root, MPI_Comm comm_ptr)
1665 #define MPIR_Scatter_MV2_Binomial smpi_coll_tuned_scatter_ompi_binomial
1666 #define MPIR_Scatter_MV2_Direct smpi_coll_tuned_scatter_ompi_basic_linear
1667 #define MPIR_Scatter_MV2_two_level_Binomial smpi_coll_tuned_scatter_mvapich2_two_level_binomial
1668 #define MPIR_Scatter_MV2_two_level_Direct smpi_coll_tuned_scatter_mvapich2_two_level_direct
1673 static void init_mv2_scatter_tables_stampede(){
1674 if(smpi_coll_cleanup_callback==NULL)
1675 smpi_coll_cleanup_callback=&smpi_coll_cleanup_mvapich2;
1677 int agg_table_sum = 0;
1679 mv2_scatter_tuning_table **table_ptrs = NULL;
1680 mv2_scatter_num_ppn_conf = 3;
1681 mv2_scatter_thresholds_table
1682 = xbt_malloc(sizeof(mv2_scatter_tuning_table *)
1683 * mv2_scatter_num_ppn_conf);
1684 table_ptrs = xbt_malloc(sizeof(mv2_scatter_tuning_table *)
1685 * mv2_scatter_num_ppn_conf);
1686 mv2_size_scatter_tuning_table = xbt_malloc(sizeof(int) *
1687 mv2_scatter_num_ppn_conf);
1688 mv2_scatter_table_ppn_conf
1689 = xbt_malloc(mv2_scatter_num_ppn_conf * sizeof(int));
1690 mv2_scatter_table_ppn_conf[0] = 1;
1691 mv2_size_scatter_tuning_table[0] = 6;
1692 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_1ppn[] = {
1696 {0, -1, &MPIR_Scatter_MV2_Binomial},
1700 {0, -1, &MPIR_Scatter_MV2_Binomial},
1707 {0, -1, &MPIR_Scatter_MV2_Direct},
1711 {0, -1, &MPIR_Scatter_MV2_Direct},
1718 {0, -1, &MPIR_Scatter_MV2_Direct},
1722 {0, -1, &MPIR_Scatter_MV2_Direct},
1729 {0, -1, &MPIR_Scatter_MV2_Direct},
1733 {0, -1, &MPIR_Scatter_MV2_Direct},
1740 {0, -1, &MPIR_Scatter_MV2_Direct},
1744 {0, -1, &MPIR_Scatter_MV2_Direct},
1751 {0, 32, &MPIR_Scatter_MV2_Binomial},
1752 {32, -1, &MPIR_Scatter_MV2_Direct},
1756 {0, -1, &MPIR_Scatter_MV2_Binomial},
1760 table_ptrs[0] = mv2_tmp_scatter_thresholds_table_1ppn;
1761 mv2_scatter_table_ppn_conf[1] = 2;
1762 mv2_size_scatter_tuning_table[1] = 6;
1763 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_2ppn[] = {
1767 {0, 4096, &MPIR_Scatter_MV2_Binomial},
1768 {4096, -1, &MPIR_Scatter_MV2_Direct},
1772 {0, -1, &MPIR_Scatter_MV2_Direct},
1779 {0, 512, &MPIR_Scatter_MV2_two_level_Direct},
1780 {512, -1, &MPIR_Scatter_MV2_Direct},
1784 {0, -1, &MPIR_Scatter_MV2_Binomial},
1791 {0, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1792 {2048, -1, &MPIR_Scatter_MV2_Direct},
1796 {0, -1, &MPIR_Scatter_MV2_Binomial},
1803 {0, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1804 {2048, -1, &MPIR_Scatter_MV2_Direct},
1808 {0, -1, &MPIR_Scatter_MV2_Binomial},
1815 {0, 8192, &MPIR_Scatter_MV2_two_level_Direct},
1816 {8192, -1, &MPIR_Scatter_MV2_Direct},
1820 {0, -1, &MPIR_Scatter_MV2_Binomial},
1827 {0, 16, &MPIR_Scatter_MV2_Binomial},
1828 {16, 128, &MPIR_Scatter_MV2_two_level_Binomial},
1829 {128, 16384, &MPIR_Scatter_MV2_two_level_Direct},
1830 {16384, -1, &MPIR_Scatter_MV2_Direct},
1834 {0, 128, &MPIR_Scatter_MV2_Direct},
1835 {128, -1, &MPIR_Scatter_MV2_Binomial},
1839 table_ptrs[1] = mv2_tmp_scatter_thresholds_table_2ppn;
1840 mv2_scatter_table_ppn_conf[2] = 16;
1841 mv2_size_scatter_tuning_table[2] = 8;
1842 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_16ppn[] = {
1847 {0, 256, &MPIR_Scatter_MV2_Binomial},
1848 {256, -1, &MPIR_Scatter_MV2_Direct},
1852 { 0, -1, &MPIR_Scatter_MV2_Direct},
1860 {0, 512, &MPIR_Scatter_MV2_Binomial},
1861 {512, -1, &MPIR_Scatter_MV2_Direct},
1865 { 0, -1, &MPIR_Scatter_MV2_Direct},
1873 {0, 1024, &MPIR_Scatter_MV2_two_level_Direct},
1874 {1024, -1, &MPIR_Scatter_MV2_Direct},
1878 { 0, -1, &MPIR_Scatter_MV2_Direct},
1886 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1887 {0, 16, &MPIR_Scatter_MV2_two_level_Direct},
1888 {16, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1889 {2048, -1, &MPIR_Scatter_MV2_Direct},
1893 { 0, -1, &MPIR_Scatter_MV2_Direct},
1901 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1902 {0, 16, &MPIR_Scatter_MV2_two_level_Direct},
1903 {16, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1904 {2048, -1, &MPIR_Scatter_MV2_Direct},
1908 { 0, -1, &MPIR_Scatter_MV2_Direct},
1916 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1917 {16, 16, &MPIR_Scatter_MV2_two_level_Direct},
1918 {16, 4096, &MPIR_Scatter_MV2_two_level_Direct},
1919 {4096, -1, &MPIR_Scatter_MV2_Direct},
1923 { 0, -1, &MPIR_Scatter_MV2_Binomial},
1930 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1931 {0, 16, &MPIR_Scatter_MV2_Binomial},
1932 {16, 32, &MPIR_Scatter_MV2_Binomial},
1933 {32, 4096, &MPIR_Scatter_MV2_two_level_Direct},
1934 {4096, -1, &MPIR_Scatter_MV2_Direct},
1938 { 0, -1, &MPIR_Scatter_MV2_Binomial},
1945 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1946 {0, 16, &MPIR_Scatter_MV2_two_level_Binomial},
1947 {16, 128, &MPIR_Scatter_MV2_two_level_Binomial},
1948 {128, 1024, &MPIR_Scatter_MV2_two_level_Direct},
1949 {1024, 16384, &MPIR_Scatter_MV2_two_level_Direct},
1950 {16384, 65536, &MPIR_Scatter_MV2_Direct},
1951 {65536, -1, &MPIR_Scatter_MV2_two_level_Direct},
1955 {0, 16, &MPIR_Scatter_MV2_Binomial},
1956 {16, 128, &MPIR_Scatter_MV2_Binomial},
1957 {128, 1024, &MPIR_Scatter_MV2_Binomial},
1958 {1024, 16384, &MPIR_Scatter_MV2_Direct},
1959 {16384, 65536, &MPIR_Scatter_MV2_Direct},
1960 {65536, -1, &MPIR_Scatter_MV2_Direct},
1964 table_ptrs[2] = mv2_tmp_scatter_thresholds_table_16ppn;
1966 for (i = 0; i < mv2_scatter_num_ppn_conf; i++) {
1967 agg_table_sum += mv2_size_scatter_tuning_table[i];
1969 mv2_scatter_thresholds_table[0] =
1970 xbt_malloc(agg_table_sum * sizeof (mv2_scatter_tuning_table));
1971 memcpy(mv2_scatter_thresholds_table[0], table_ptrs[0],
1972 (sizeof(mv2_scatter_tuning_table)
1973 * mv2_size_scatter_tuning_table[0]));
1974 for (i = 1; i < mv2_scatter_num_ppn_conf; i++) {
1975 mv2_scatter_thresholds_table[i] =
1976 mv2_scatter_thresholds_table[i - 1]
1977 + mv2_size_scatter_tuning_table[i - 1];
1978 memcpy(mv2_scatter_thresholds_table[i], table_ptrs[i],
1979 (sizeof(mv2_scatter_tuning_table)
1980 * mv2_size_scatter_tuning_table[i]));
1982 xbt_free(table_ptrs);