1 /* selector for collective algorithms based on mvapich decision logic, with calibration from Stampede cluster at TACC*/
2 /* This is the tuning used by MVAPICH for Stampede platform based on (MV2_ARCH_INTEL_XEON_E5_2680_16,
3 * MV2_HCA_MLX_CX_FDR) */
5 /* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 /************ Alltoall variables and initializers */
12 #ifndef SMPI_MVAPICH2_SELECTOR_STAMPEDE_HPP
13 #define SMPI_MVAPICH2_SELECTOR_STAMPEDE_HPP
17 #define MV2_MAX_NB_THRESHOLDS 32
19 XBT_PUBLIC void smpi_coll_cleanup_mvapich2(void);
21 struct mv2_alltoall_tuning_element {
24 int (*MV2_pt_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
25 MPI_Datatype recvtype, MPI_Comm comm_ptr);
28 struct mv2_alltoall_tuning_table {
31 mv2_alltoall_tuning_element algo_table[MV2_MAX_NB_THRESHOLDS];
32 mv2_alltoall_tuning_element in_place_algo_table[MV2_MAX_NB_THRESHOLDS];
35 int (*MV2_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
36 MPI_Datatype recvtype, MPI_Comm comm_ptr) = NULL;
38 /* Indicates number of processes per node */
39 int* mv2_alltoall_table_ppn_conf = NULL;
40 /* Indicates total number of configurations */
41 int mv2_alltoall_num_ppn_conf = 1;
42 int* mv2_size_alltoall_tuning_table = NULL;
43 mv2_alltoall_tuning_table** mv2_alltoall_thresholds_table = NULL;
45 #define MPIR_Alltoall_bruck_MV2 simgrid::smpi::Coll_alltoall_bruck::alltoall
46 #define MPIR_Alltoall_RD_MV2 simgrid::smpi::Coll_alltoall_rdb::alltoall
47 #define MPIR_Alltoall_Scatter_dest_MV2 simgrid::smpi::Coll_alltoall_mvapich2_scatter_dest::alltoall
48 #define MPIR_Alltoall_pairwise_MV2 simgrid::smpi::Coll_alltoall_pair::alltoall
49 #define MPIR_Alltoall_inplace_MV2 simgrid::smpi::Coll_alltoall_ring::alltoall
51 static void init_mv2_alltoall_tables_stampede()
53 int agg_table_sum = 0;
54 mv2_alltoall_tuning_table** table_ptrs = NULL;
55 mv2_alltoall_num_ppn_conf = 3;
56 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
57 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
58 mv2_alltoall_thresholds_table = new mv2_alltoall_tuning_table*[mv2_alltoall_num_ppn_conf];
59 table_ptrs = new mv2_alltoall_tuning_table*[mv2_alltoall_num_ppn_conf];
60 mv2_size_alltoall_tuning_table = new int[mv2_alltoall_num_ppn_conf];
61 mv2_alltoall_table_ppn_conf = new int[mv2_alltoall_num_ppn_conf];
62 mv2_alltoall_table_ppn_conf[0] = 1;
63 mv2_size_alltoall_tuning_table[0] = 6;
64 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_1ppn[] = {
69 {0, -1, &MPIR_Alltoall_pairwise_MV2},
73 {0, -1, &MPIR_Alltoall_inplace_MV2},
81 {0, 262144, &MPIR_Alltoall_Scatter_dest_MV2}, {262144, -1, &MPIR_Alltoall_pairwise_MV2},
85 {0, -1, &MPIR_Alltoall_inplace_MV2},
93 {0, 8, &MPIR_Alltoall_RD_MV2}, {8, -1, &MPIR_Alltoall_Scatter_dest_MV2},
97 {0, -1, &MPIR_Alltoall_inplace_MV2},
105 {0, 64, &MPIR_Alltoall_RD_MV2},
106 {64, 512, &MPIR_Alltoall_bruck_MV2},
107 {512, -1, &MPIR_Alltoall_Scatter_dest_MV2},
111 {0, -1, &MPIR_Alltoall_inplace_MV2},
119 {0, 32, &MPIR_Alltoall_RD_MV2},
120 {32, 2048, &MPIR_Alltoall_bruck_MV2},
121 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
125 {0, -1, &MPIR_Alltoall_inplace_MV2},
133 {0, 8, &MPIR_Alltoall_RD_MV2},
134 {8, 1024, &MPIR_Alltoall_bruck_MV2},
135 {1024, -1, &MPIR_Alltoall_Scatter_dest_MV2},
139 {0, -1, &MPIR_Alltoall_inplace_MV2},
143 table_ptrs[0] = mv2_tmp_alltoall_thresholds_table_1ppn;
144 mv2_alltoall_table_ppn_conf[1] = 2;
145 mv2_size_alltoall_tuning_table[1] = 6;
146 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_2ppn[] = {
151 {0, 32, &MPIR_Alltoall_RD_MV2}, {32, -1, &MPIR_Alltoall_Scatter_dest_MV2},
155 {0, -1, &MPIR_Alltoall_inplace_MV2},
163 {0, 64, &MPIR_Alltoall_RD_MV2}, {64, -1, &MPIR_Alltoall_Scatter_dest_MV2},
167 {0, -1, &MPIR_Alltoall_inplace_MV2},
175 {0, 64, &MPIR_Alltoall_RD_MV2},
176 {64, 2048, &MPIR_Alltoall_bruck_MV2},
177 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
181 {0, -1, &MPIR_Alltoall_inplace_MV2},
189 {0, 16, &MPIR_Alltoall_RD_MV2},
190 {16, 2048, &MPIR_Alltoall_bruck_MV2},
191 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
195 {0, -1, &MPIR_Alltoall_inplace_MV2},
203 {0, 8, &MPIR_Alltoall_RD_MV2},
204 {8, 1024, &MPIR_Alltoall_bruck_MV2},
205 {1024, -1, &MPIR_Alltoall_Scatter_dest_MV2},
209 {0, -1, &MPIR_Alltoall_inplace_MV2},
217 {0, 4, &MPIR_Alltoall_RD_MV2},
218 {4, 2048, &MPIR_Alltoall_bruck_MV2},
219 {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
223 {0, -1, &MPIR_Alltoall_inplace_MV2},
227 table_ptrs[1] = mv2_tmp_alltoall_thresholds_table_2ppn;
228 mv2_alltoall_table_ppn_conf[2] = 16;
229 mv2_size_alltoall_tuning_table[2] = 7;
230 mv2_alltoall_tuning_table mv2_tmp_alltoall_thresholds_table_16ppn[] = {
235 {0, 2048, &MPIR_Alltoall_bruck_MV2}, {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
239 {32768, -1, &MPIR_Alltoall_inplace_MV2},
247 {0, 2048, &MPIR_Alltoall_bruck_MV2}, {2048, -1, &MPIR_Alltoall_Scatter_dest_MV2},
251 {16384, -1, &MPIR_Alltoall_inplace_MV2},
259 {0, 2048, &MPIR_Alltoall_bruck_MV2},
260 {2048, 16384, &MPIR_Alltoall_Scatter_dest_MV2},
261 {16384, -1, &MPIR_Alltoall_pairwise_MV2},
265 {32768, 131072, &MPIR_Alltoall_inplace_MV2},
273 {0, 2048, &MPIR_Alltoall_bruck_MV2}, {2048, -1, &MPIR_Alltoall_pairwise_MV2},
277 {16384, 65536, &MPIR_Alltoall_inplace_MV2},
285 {0, 1024, &MPIR_Alltoall_bruck_MV2}, {1024, -1, &MPIR_Alltoall_pairwise_MV2},
289 {16384, 65536, &MPIR_Alltoall_inplace_MV2},
297 {0, 1024, &MPIR_Alltoall_bruck_MV2}, {1024, -1, &MPIR_Alltoall_pairwise_MV2},
301 {16384, 65536, &MPIR_Alltoall_inplace_MV2},
308 {0, 1024, &MPIR_Alltoall_bruck_MV2}, {1024, -1, &MPIR_Alltoall_pairwise_MV2},
312 {16384, 65536, &MPIR_Alltoall_inplace_MV2},
317 table_ptrs[2] = mv2_tmp_alltoall_thresholds_table_16ppn;
319 for (int i = 0; i < mv2_alltoall_num_ppn_conf; i++) {
320 agg_table_sum += mv2_size_alltoall_tuning_table[i];
322 mv2_alltoall_thresholds_table[0] = new mv2_alltoall_tuning_table[agg_table_sum];
323 std::copy_n(table_ptrs[0], mv2_size_alltoall_tuning_table[0], mv2_alltoall_thresholds_table[0]);
324 for (int i = 1; i < mv2_alltoall_num_ppn_conf; i++) {
325 mv2_alltoall_thresholds_table[i] = mv2_alltoall_thresholds_table[i - 1] + mv2_size_alltoall_tuning_table[i - 1];
326 std::copy_n(table_ptrs[i], mv2_size_alltoall_tuning_table[i], mv2_alltoall_thresholds_table[i]);
331 /************ Allgather variables and initializers */
333 struct mv2_allgather_tuning_element {
336 int (*MV2_pt_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
337 MPI_Datatype recvtype, MPI_Comm comm_ptr);
340 struct mv2_allgather_tuning_table {
342 int two_level[MV2_MAX_NB_THRESHOLDS];
343 int size_inter_table;
344 mv2_allgather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
347 int (*MV2_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
348 MPI_Datatype recvtype, MPI_Comm comm);
350 int* mv2_allgather_table_ppn_conf = NULL;
351 int mv2_allgather_num_ppn_conf = 1;
352 int* mv2_size_allgather_tuning_table = NULL;
353 mv2_allgather_tuning_table** mv2_allgather_thresholds_table = NULL;
355 static int MPIR_Allgather_RD_Allgather_Comm_MV2(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf,
356 int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr)
361 #define MPIR_Allgather_Bruck_MV2 simgrid::smpi::Coll_allgather_bruck::allgather
362 #define MPIR_Allgather_RD_MV2 simgrid::smpi::Coll_allgather_rdb::allgather
363 #define MPIR_Allgather_Ring_MV2 simgrid::smpi::Coll_allgather_ring::allgather
364 #define MPIR_2lvl_Allgather_MV2 simgrid::smpi::Coll_allgather_mvapich2_smp::allgather
366 static void init_mv2_allgather_tables_stampede()
368 int agg_table_sum = 0;
370 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
371 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
372 mv2_allgather_tuning_table** table_ptrs = NULL;
373 mv2_allgather_num_ppn_conf = 3;
374 mv2_allgather_thresholds_table = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
375 table_ptrs = new mv2_allgather_tuning_table*[mv2_allgather_num_ppn_conf];
376 mv2_size_allgather_tuning_table = new int[mv2_allgather_num_ppn_conf];
377 mv2_allgather_table_ppn_conf = new int[mv2_allgather_num_ppn_conf];
378 mv2_allgather_table_ppn_conf[0] = 1;
379 mv2_size_allgather_tuning_table[0] = 6;
380 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_1ppn[] = {
386 {0, -1, &MPIR_Allgather_Ring_MV2},
394 {0, 262144, &MPIR_Allgather_RD_MV2}, {262144, -1, &MPIR_Allgather_Ring_MV2},
402 {0, 131072, &MPIR_Allgather_RD_MV2}, {131072, -1, &MPIR_Allgather_Ring_MV2},
410 {0, 131072, &MPIR_Allgather_RD_MV2}, {131072, -1, &MPIR_Allgather_Ring_MV2},
418 {0, 65536, &MPIR_Allgather_RD_MV2}, {65536, -1, &MPIR_Allgather_Ring_MV2},
426 {0, 32768, &MPIR_Allgather_RD_MV2}, {32768, -1, &MPIR_Allgather_Ring_MV2},
430 table_ptrs[0] = mv2_tmp_allgather_thresholds_table_1ppn;
431 mv2_allgather_table_ppn_conf[1] = 2;
432 mv2_size_allgather_tuning_table[1] = 6;
433 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_2ppn[] = {
439 {0, 524288, &MPIR_Allgather_RD_MV2}, {524288, -1, &MPIR_Allgather_Ring_MV2},
447 {0, 32768, &MPIR_Allgather_RD_MV2},
448 {32768, 524288, &MPIR_Allgather_Ring_MV2},
449 {524288, -1, &MPIR_Allgather_Ring_MV2},
457 {0, 16384, &MPIR_Allgather_RD_MV2},
458 {16384, 524288, &MPIR_Allgather_Ring_MV2},
459 {524288, -1, &MPIR_Allgather_Ring_MV2},
467 {0, 65536, &MPIR_Allgather_RD_MV2},
468 {65536, 524288, &MPIR_Allgather_Ring_MV2},
469 {524288, -1, &MPIR_Allgather_Ring_MV2},
477 {0, 32768, &MPIR_Allgather_RD_MV2},
478 {32768, 524288, &MPIR_Allgather_Ring_MV2},
479 {524288, -1, &MPIR_Allgather_Ring_MV2},
487 {0, 65536, &MPIR_Allgather_RD_MV2},
488 {65536, 524288, &MPIR_Allgather_Ring_MV2},
489 {524288, -1, &MPIR_Allgather_Ring_MV2},
493 table_ptrs[1] = mv2_tmp_allgather_thresholds_table_2ppn;
494 mv2_allgather_table_ppn_conf[2] = 16;
495 mv2_size_allgather_tuning_table[2] = 6;
496 mv2_allgather_tuning_table mv2_tmp_allgather_thresholds_table_16ppn[] = {
502 {0, 1024, &MPIR_Allgather_RD_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
510 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
518 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
526 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
534 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
542 {0, 1024, &MPIR_Allgather_RD_Allgather_Comm_MV2}, {1024, -1, &MPIR_Allgather_Ring_MV2},
547 table_ptrs[2] = mv2_tmp_allgather_thresholds_table_16ppn;
549 for (int i = 0; i < mv2_allgather_num_ppn_conf; i++) {
550 agg_table_sum += mv2_size_allgather_tuning_table[i];
552 mv2_allgather_thresholds_table[0] = new mv2_allgather_tuning_table[agg_table_sum];
553 std::copy_n(table_ptrs[0], mv2_size_allgather_tuning_table[0], mv2_allgather_thresholds_table[0]);
554 for (int i = 1; i < mv2_allgather_num_ppn_conf; i++) {
555 mv2_allgather_thresholds_table[i] = mv2_allgather_thresholds_table[i - 1] + mv2_size_allgather_tuning_table[i - 1];
556 std::copy_n(table_ptrs[i], mv2_size_allgather_tuning_table[i], mv2_allgather_thresholds_table[i]);
561 /************ Gather variables and initializers */
563 struct mv2_gather_tuning_element {
566 int (*MV2_pt_Gather_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
567 MPI_Datatype recvtype, int root, MPI_Comm comm_ptr);
570 struct mv2_gather_tuning_table {
572 int size_inter_table;
573 mv2_gather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
574 int size_intra_table;
575 mv2_gather_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
578 int mv2_size_gather_tuning_table = 7;
579 mv2_gather_tuning_table* mv2_gather_thresholds_table = NULL;
581 typedef int (*MV2_Gather_function_ptr)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
582 MPI_Datatype recvtype, int root, MPI_Comm comm);
584 MV2_Gather_function_ptr MV2_Gather_inter_leader_function = NULL;
585 MV2_Gather_function_ptr MV2_Gather_intra_node_function = NULL;
587 #define MPIR_Gather_MV2_Direct simgrid::smpi::Coll_gather_ompi_basic_linear::gather
588 #define MPIR_Gather_MV2_two_level_Direct simgrid::smpi::Coll_gather_mvapich2_two_level::gather
589 #define MPIR_Gather_intra simgrid::smpi::Coll_gather_mpich::gather
591 static void init_mv2_gather_tables_stampede()
594 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
595 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
596 mv2_size_gather_tuning_table = 7;
597 mv2_gather_thresholds_table = new mv2_gather_tuning_table[mv2_size_gather_tuning_table];
598 mv2_gather_tuning_table mv2_tmp_gather_thresholds_table[] = {
601 {{0, 524288, &MPIR_Gather_MV2_Direct}, {524288, -1, &MPIR_Gather_intra}},
603 {{0, -1, &MPIR_Gather_MV2_Direct}}},
606 {{0, 16384, &MPIR_Gather_MV2_Direct},
607 {16384, 131072, &MPIR_Gather_intra},
608 {131072, -1, &MPIR_Gather_MV2_two_level_Direct}},
610 {{0, -1, &MPIR_Gather_intra}}},
613 {{0, 256, &MPIR_Gather_MV2_two_level_Direct},
614 {256, 16384, &MPIR_Gather_MV2_Direct},
615 {256, -1, &MPIR_Gather_MV2_two_level_Direct}},
617 {{0, -1, &MPIR_Gather_intra}}},
620 {{0, 512, &MPIR_Gather_MV2_two_level_Direct},
621 {512, 16384, &MPIR_Gather_MV2_Direct},
622 {16384, -1, &MPIR_Gather_MV2_two_level_Direct}},
624 {{0, -1, &MPIR_Gather_intra}}},
627 {{0, 512, &MPIR_Gather_MV2_two_level_Direct},
628 {512, 16384, &MPIR_Gather_MV2_Direct},
629 {16384, -1, &MPIR_Gather_MV2_two_level_Direct}},
631 {{0, -1, &MPIR_Gather_intra}}},
634 {{0, 512, &MPIR_Gather_MV2_two_level_Direct},
635 {512, 16384, &MPIR_Gather_MV2_Direct},
636 {8196, -1, &MPIR_Gather_MV2_two_level_Direct}},
638 {{0, -1, &MPIR_Gather_intra}}},
641 {{0, 512, &MPIR_Gather_MV2_two_level_Direct},
642 {512, 16384, &MPIR_Gather_MV2_Direct},
643 {8196, -1, &MPIR_Gather_MV2_two_level_Direct}},
645 {{0, -1, &MPIR_Gather_intra}}},
648 std::copy_n(mv2_tmp_gather_thresholds_table, mv2_size_gather_tuning_table, mv2_gather_thresholds_table);
651 /************ Allgatherv variables and initializers */
653 struct mv2_allgatherv_tuning_element {
656 int (*MV2_pt_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts,
657 int* displs, MPI_Datatype recvtype, MPI_Comm commg);
660 struct mv2_allgatherv_tuning_table {
662 int size_inter_table;
663 mv2_allgatherv_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
666 int (*MV2_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts,
667 int* displs, MPI_Datatype recvtype, MPI_Comm comm);
669 int mv2_size_allgatherv_tuning_table = 0;
670 mv2_allgatherv_tuning_table* mv2_allgatherv_thresholds_table = NULL;
672 #define MPIR_Allgatherv_Rec_Doubling_MV2 simgrid::smpi::Coll_allgatherv_mpich_rdb::allgatherv
673 #define MPIR_Allgatherv_Bruck_MV2 simgrid::smpi::Coll_allgatherv_ompi_bruck::allgatherv
674 #define MPIR_Allgatherv_Ring_MV2 simgrid::smpi::Coll_allgatherv_mpich_ring::allgatherv
676 static void init_mv2_allgatherv_tables_stampede()
678 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
679 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
680 mv2_size_allgatherv_tuning_table = 6;
681 mv2_allgatherv_thresholds_table = new mv2_allgatherv_tuning_table[mv2_size_allgatherv_tuning_table];
682 mv2_allgatherv_tuning_table mv2_tmp_allgatherv_thresholds_table[] = {
687 {0, 512, &MPIR_Allgatherv_Rec_Doubling_MV2}, {512, -1, &MPIR_Allgatherv_Ring_MV2},
694 {0, 512, &MPIR_Allgatherv_Rec_Doubling_MV2}, {512, -1, &MPIR_Allgatherv_Ring_MV2},
701 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2}, {256, -1, &MPIR_Allgatherv_Ring_MV2},
708 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2}, {256, -1, &MPIR_Allgatherv_Ring_MV2},
715 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2}, {256, -1, &MPIR_Allgatherv_Ring_MV2},
722 {0, 256, &MPIR_Allgatherv_Rec_Doubling_MV2}, {256, -1, &MPIR_Allgatherv_Ring_MV2},
727 std::copy_n(mv2_tmp_allgatherv_thresholds_table, mv2_size_allgatherv_tuning_table, mv2_allgatherv_thresholds_table);
730 /************ Allreduce variables and initializers */
732 struct mv2_allreduce_tuning_element {
735 int (*MV2_pt_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
739 struct mv2_allreduce_tuning_table {
742 int is_two_level_allreduce[MV2_MAX_NB_THRESHOLDS];
743 int size_inter_table;
744 mv2_allreduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
745 int size_intra_table;
746 mv2_allreduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
749 int (*MV2_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
750 MPI_Comm comm) = NULL;
752 int (*MV2_Allreduce_intra_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
753 MPI_Comm comm) = NULL;
755 int mv2_size_allreduce_tuning_table = 0;
756 mv2_allreduce_tuning_table* mv2_allreduce_thresholds_table = NULL;
758 static int MPIR_Allreduce_mcst_reduce_two_level_helper_MV2(void* sendbuf, void* recvbuf, int count,
759 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
764 static int MPIR_Allreduce_mcst_reduce_redscat_gather_MV2(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype,
765 MPI_Op op, MPI_Comm comm)
770 static int MPIR_Allreduce_reduce_p2p_MV2(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
773 simgrid::smpi::Colls::reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
777 static int MPIR_Allreduce_reduce_shmem_MV2(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
780 simgrid::smpi::Colls::reduce(sendbuf, recvbuf, count, datatype, op, 0, comm);
784 #define MPIR_Allreduce_pt2pt_rd_MV2 simgrid::smpi::Coll_allreduce_rdb::allreduce
785 #define MPIR_Allreduce_pt2pt_rs_MV2 simgrid::smpi::Coll_allreduce_mvapich2_rs::allreduce
786 #define MPIR_Allreduce_two_level_MV2 simgrid::smpi::Coll_allreduce_mvapich2_two_level::allreduce
788 static void init_mv2_allreduce_tables_stampede()
790 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
791 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
792 mv2_size_allreduce_tuning_table = 8;
793 mv2_allreduce_thresholds_table = new mv2_allreduce_tuning_table[mv2_size_allreduce_tuning_table];
794 mv2_allreduce_tuning_table mv2_tmp_allreduce_thresholds_table[] = {
801 {0, 1024, &MPIR_Allreduce_pt2pt_rd_MV2}, {1024, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
805 {0, 1024, &MPIR_Allreduce_reduce_shmem_MV2}, {1024, -1, &MPIR_Allreduce_reduce_p2p_MV2},
814 {0, 1024, &MPIR_Allreduce_pt2pt_rd_MV2},
815 {1024, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
816 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
820 {0, 1024, &MPIR_Allreduce_reduce_shmem_MV2}, {1024, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
829 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
830 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
831 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
835 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
844 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
845 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
846 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
850 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
859 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
860 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
861 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
865 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
874 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
875 {512, 16384, &MPIR_Allreduce_pt2pt_rd_MV2},
876 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
880 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, 16384, &MPIR_Allreduce_reduce_p2p_MV2},
889 {0, 512, &MPIR_Allreduce_pt2pt_rd_MV2},
890 {512, 8192, &MPIR_Allreduce_pt2pt_rd_MV2},
891 {8192, 65536, &MPIR_Allreduce_pt2pt_rs_MV2},
892 {65536, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
896 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
905 {0, 64, &MPIR_Allreduce_pt2pt_rd_MV2},
906 {64, 512, &MPIR_Allreduce_reduce_p2p_MV2},
907 {512, 4096, &MPIR_Allreduce_mcst_reduce_two_level_helper_MV2},
908 {4096, 16384, &MPIR_Allreduce_pt2pt_rs_MV2},
909 {16384, -1, &MPIR_Allreduce_pt2pt_rs_MV2},
913 {0, 512, &MPIR_Allreduce_reduce_shmem_MV2}, {512, -1, &MPIR_Allreduce_reduce_p2p_MV2},
918 std::copy_n(mv2_tmp_allreduce_thresholds_table, mv2_size_allreduce_tuning_table, mv2_allreduce_thresholds_table);
921 struct mv2_bcast_tuning_element {
924 int (*MV2_pt_Bcast_function)(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr);
925 int zcpy_pipelined_knomial_factor;
928 struct mv2_bcast_tuning_table {
930 int bcast_segment_size;
931 int intra_node_knomial_factor;
932 int inter_node_knomial_factor;
933 int is_two_level_bcast[MV2_MAX_NB_THRESHOLDS];
934 int size_inter_table;
935 mv2_bcast_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
936 int size_intra_table;
937 mv2_bcast_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
940 int mv2_size_bcast_tuning_table = 0;
941 mv2_bcast_tuning_table* mv2_bcast_thresholds_table = NULL;
943 int (*MV2_Bcast_function)(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr) = NULL;
945 int (*MV2_Bcast_intra_node_function)(void* buffer, int count, MPI_Datatype datatype, int root,
946 MPI_Comm comm_ptr) = NULL;
948 int zcpy_knomial_factor = 2;
949 int mv2_pipelined_zcpy_knomial_factor = -1;
950 int bcast_segment_size = 8192;
951 int mv2_inter_node_knomial_factor = 4;
952 int mv2_intra_node_knomial_factor = 4;
953 #define mv2_bcast_two_level_system_size 64
954 #define mv2_bcast_short_msg 16384
955 #define mv2_bcast_large_msg 512 * 1024
957 #define INTRA_NODE_ROOT 0
959 #define MPIR_Pipelined_Bcast_Zcpy_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
960 #define MPIR_Pipelined_Bcast_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
961 #define MPIR_Bcast_binomial_MV2 simgrid::smpi::Coll_bcast_binomial_tree::bcast
962 #define MPIR_Bcast_scatter_ring_allgather_shm_MV2 simgrid::smpi::Coll_bcast_scatter_LR_allgather::bcast
963 #define MPIR_Bcast_scatter_doubling_allgather_MV2 simgrid::smpi::Coll_bcast_scatter_rdb_allgather::bcast
964 #define MPIR_Bcast_scatter_ring_allgather_MV2 simgrid::smpi::Coll_bcast_scatter_LR_allgather::bcast
965 #define MPIR_Shmem_Bcast_MV2 simgrid::smpi::Coll_bcast_mpich::bcast
966 #define MPIR_Bcast_tune_inter_node_helper_MV2 simgrid::smpi::Coll_bcast_mvapich2_inter_node::bcast
967 #define MPIR_Bcast_inter_node_helper_MV2 simgrid::smpi::Coll_bcast_mvapich2_inter_node::bcast
968 #define MPIR_Knomial_Bcast_intra_node_MV2 simgrid::smpi::Coll_bcast_mvapich2_knomial_intra_node::bcast
969 #define MPIR_Bcast_intra_MV2 simgrid::smpi::Coll_bcast_mvapich2_intra_node::bcast
971 static void init_mv2_bcast_tables_stampede()
974 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
975 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
976 mv2_size_bcast_tuning_table = 8;
977 mv2_bcast_thresholds_table = new mv2_bcast_tuning_table[mv2_size_bcast_tuning_table];
979 mv2_bcast_tuning_table mv2_tmp_bcast_thresholds_table[] = {
984 {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
986 {{0, 8, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
987 {8, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
988 {16, 1024, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
989 {1024, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
990 {8192, 16384, &MPIR_Bcast_binomial_MV2, -1},
991 {16384, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
992 {32768, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
993 {65536, 131072, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1},
994 {131072, 262144, &MPIR_Bcast_scatter_ring_allgather_MV2, -1},
995 {262144, 524288, &MPIR_Bcast_scatter_doubling_allgather_MV2, -1},
996 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_MV2, -1}},
998 {{0, 8, &MPIR_Shmem_Bcast_MV2, 2},
999 {8, 16, &MPIR_Shmem_Bcast_MV2, 4},
1000 {16, 1024, &MPIR_Shmem_Bcast_MV2, 2},
1001 {1024, 8192, &MPIR_Shmem_Bcast_MV2, 4},
1002 {8192, 16384, &MPIR_Shmem_Bcast_MV2, -1},
1003 {16384, 32768, &MPIR_Shmem_Bcast_MV2, 4},
1004 {32768, 65536, &MPIR_Shmem_Bcast_MV2, 2},
1005 {65536, 131072, &MPIR_Shmem_Bcast_MV2, -1},
1006 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1007 {262144, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1008 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}}},
1013 {1, 1, 1, 1, 1, 1, 1, 1},
1015 {{0, 128, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1016 {128, 256, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1017 {256, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1018 {32768, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1019 {65536, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1020 {131072, 262144, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1021 {262144, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1022 {524288, -1, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8}},
1024 {{0, 128, &MPIR_Shmem_Bcast_MV2, 2},
1025 {128, 256, &MPIR_Shmem_Bcast_MV2, 4},
1026 {256, 32768, &MPIR_Shmem_Bcast_MV2, 2},
1027 {32768, 65536, &MPIR_Shmem_Bcast_MV2, 4},
1028 {65536, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1029 {131072, 262144, &MPIR_Shmem_Bcast_MV2, 8},
1030 {262144, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1031 {524288, -1, &MPIR_Shmem_Bcast_MV2, 8}}},
1036 {1, 1, 1, 1, 1, 1, 1, 1, 1},
1038 {{0, 2, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1039 {2, 4, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1040 {4, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1041 {16, 32, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1042 {32, 128, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1043 {128, 256, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1044 {256, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1045 {4096, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1046 {32768, -1, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2}},
1048 {{0, 2, &MPIR_Shmem_Bcast_MV2, 4},
1049 {2, 4, &MPIR_Shmem_Bcast_MV2, 8},
1050 {4, 16, &MPIR_Shmem_Bcast_MV2, 4},
1051 {16, 32, &MPIR_Shmem_Bcast_MV2, 8},
1052 {32, 128, &MPIR_Shmem_Bcast_MV2, 4},
1053 {128, 256, &MPIR_Shmem_Bcast_MV2, 8},
1054 {256, 4096, &MPIR_Shmem_Bcast_MV2, 4},
1055 {4096, 32768, &MPIR_Shmem_Bcast_MV2, 8},
1056 {32768, -1, &MPIR_Shmem_Bcast_MV2, 2}}},
1063 {{0, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1064 {8192, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1065 {16384, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1066 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_MV2, -1}},
1068 {{0, 8192, &MPIR_Shmem_Bcast_MV2, 8},
1069 {8192, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1070 {16384, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1071 {524288, -1, NULL, -1}}},
1078 {{0, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1079 {16384, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1080 {131072, 262144, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1},
1081 {262144, 524288, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1082 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}},
1084 {{0, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1085 {16384, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1086 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1087 {262144, 524288, &MPIR_Shmem_Bcast_MV2, 2},
1088 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}}},
1095 {{0, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1096 {4096, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1097 {16384, 131072, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1098 {131072, 262144, &MPIR_Pipelined_Bcast_MV2, -1},
1099 {262144, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}},
1101 {{0, 4096, &MPIR_Shmem_Bcast_MV2, 8},
1102 {4096, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1103 {16384, 131072, &MPIR_Shmem_Bcast_MV2, 2},
1104 {131072, 262144, &MPIR_Shmem_Bcast_MV2, -1},
1105 {262144, -1, &MPIR_Shmem_Bcast_MV2, -1}}},
1112 {{0, 8192, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1113 {8192, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1114 {16384, 65536, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1115 {65536, 524288, &MPIR_Pipelined_Bcast_MV2, -1},
1116 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}},
1118 {{0, 8192, &MPIR_Shmem_Bcast_MV2, 8},
1119 {8192, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1120 {16384, 65536, &MPIR_Shmem_Bcast_MV2, 2},
1121 {65536, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1122 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}}},
1127 {1, 1, 1, 1, 1, 1, 1},
1129 {{0, 16, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1130 {16, 32, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1131 {32, 4096, &MPIR_Pipelined_Bcast_Zcpy_MV2, 8},
1132 {4096, 16384, &MPIR_Pipelined_Bcast_Zcpy_MV2, 4},
1133 {16384, 32768, &MPIR_Pipelined_Bcast_Zcpy_MV2, 2},
1134 {32768, 524288, &MPIR_Pipelined_Bcast_MV2, -1},
1135 {524288, -1, &MPIR_Bcast_scatter_ring_allgather_shm_MV2, -1}},
1137 {{0, 16, &MPIR_Shmem_Bcast_MV2, 8},
1138 {16, 32, &MPIR_Shmem_Bcast_MV2, 4},
1139 {32, 4096, &MPIR_Shmem_Bcast_MV2, 8},
1140 {4096, 16384, &MPIR_Shmem_Bcast_MV2, 4},
1141 {16384, 32768, &MPIR_Shmem_Bcast_MV2, 2},
1142 {32768, 524288, &MPIR_Shmem_Bcast_MV2, -1},
1143 {524288, -1, &MPIR_Shmem_Bcast_MV2, -1}}}};
1145 std::copy_n(mv2_tmp_bcast_thresholds_table, mv2_size_bcast_tuning_table, mv2_bcast_thresholds_table);
1148 /************ Reduce variables and initializers */
1150 struct mv2_reduce_tuning_element {
1153 int (*MV2_pt_Reduce_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
1157 struct mv2_reduce_tuning_table {
1161 int is_two_level_reduce[MV2_MAX_NB_THRESHOLDS];
1162 int size_inter_table;
1163 mv2_reduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1164 int size_intra_table;
1165 mv2_reduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
1168 int mv2_size_reduce_tuning_table = 0;
1169 mv2_reduce_tuning_table* mv2_reduce_thresholds_table = NULL;
1171 int mv2_reduce_intra_knomial_factor = -1;
1172 int mv2_reduce_inter_knomial_factor = -1;
1174 int (*MV2_Reduce_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
1175 MPI_Comm comm_ptr) = NULL;
1177 int (*MV2_Reduce_intra_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root,
1178 MPI_Comm comm_ptr) = NULL;
1180 #define MPIR_Reduce_inter_knomial_wrapper_MV2 simgrid::smpi::Coll_reduce_mvapich2_knomial::reduce
1181 #define MPIR_Reduce_intra_knomial_wrapper_MV2 simgrid::smpi::Coll_reduce_mvapich2_knomial::reduce
1182 #define MPIR_Reduce_binomial_MV2 simgrid::smpi::Coll_reduce_binomial::reduce
1183 #define MPIR_Reduce_redscat_gather_MV2 simgrid::smpi::Coll_reduce_scatter_gather::reduce
1184 #define MPIR_Reduce_shmem_MV2 simgrid::smpi::Coll_reduce_ompi_basic_linear::reduce
1185 #define MPIR_Reduce_two_level_helper_MV2 simgrid::smpi::Coll_reduce_mvapich2_two_level::reduce
1187 static void init_mv2_reduce_tables_stampede()
1189 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
1190 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
1192 mv2_size_reduce_tuning_table = 8;
1193 mv2_reduce_thresholds_table = new mv2_reduce_tuning_table[mv2_size_reduce_tuning_table];
1194 mv2_reduce_tuning_table mv2_tmp_reduce_thresholds_table[] = {
1202 {0, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1203 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1204 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1208 {0, 65536, &MPIR_Reduce_shmem_MV2}, {65536, -1, &MPIR_Reduce_binomial_MV2},
1215 {1, 1, 1, 1, 0, 0, 0},
1218 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1219 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1220 {16384, 32768, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1221 {32768, 65536, &MPIR_Reduce_binomial_MV2},
1222 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1223 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1224 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1228 {0, 8192, &MPIR_Reduce_shmem_MV2},
1229 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1230 {16384, 32768, &MPIR_Reduce_shmem_MV2},
1231 {32768, 65536, &MPIR_Reduce_shmem_MV2},
1232 {65536, 262144, &MPIR_Reduce_shmem_MV2},
1233 {262144, -1, &MPIR_Reduce_binomial_MV2},
1243 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1244 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1245 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1246 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1247 {262144, -1, &MPIR_Reduce_redscat_gather_MV2},
1251 {0, 8192, &MPIR_Reduce_shmem_MV2},
1252 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1253 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1254 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1255 {262144, -1, &MPIR_Reduce_binomial_MV2},
1265 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1266 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1267 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1268 {65536, 262144, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1269 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1270 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1274 {0, 8192, &MPIR_Reduce_shmem_MV2},
1275 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1276 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1277 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1278 {262144, -1, &MPIR_Reduce_binomial_MV2},
1285 {1, 1, 1, 0, 1, 1, 0},
1288 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1289 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1290 {16384, 32768, &MPIR_Reduce_binomial_MV2},
1291 {32768, 65536, &MPIR_Reduce_binomial_MV2},
1292 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1293 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1294 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1298 {0, 8192, &MPIR_Reduce_shmem_MV2},
1299 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1300 {16384, 32768, &MPIR_Reduce_shmem_MV2},
1301 {32768, 65536, &MPIR_Reduce_shmem_MV2},
1302 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1303 {262144, -1, &MPIR_Reduce_binomial_MV2},
1313 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1314 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1315 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1316 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1317 {262144, 1048576, &MPIR_Reduce_binomial_MV2},
1318 {1048576, -1, &MPIR_Reduce_redscat_gather_MV2},
1322 {0, 8192, &MPIR_Reduce_shmem_MV2},
1323 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1324 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1325 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1326 {262144, -1, &MPIR_Reduce_binomial_MV2},
1336 {0, 8192, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1337 {8192, 16384, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1338 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1339 {65536, 262144, &MPIR_Reduce_binomial_MV2},
1340 {262144, -1, &MPIR_Reduce_binomial_MV2},
1344 {0, 8192, &MPIR_Reduce_shmem_MV2},
1345 {8192, 16384, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1346 {16384, 65536, &MPIR_Reduce_shmem_MV2},
1347 {65536, 262144, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1348 {262144, -1, &MPIR_Reduce_binomial_MV2},
1358 {0, 2048, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1359 {2048, 4096, &MPIR_Reduce_inter_knomial_wrapper_MV2},
1360 {4096, 16384, &MPIR_Reduce_binomial_MV2},
1361 {16384, 65536, &MPIR_Reduce_binomial_MV2},
1362 {65536, 131072, &MPIR_Reduce_binomial_MV2},
1363 {131072, -1, &MPIR_Reduce_binomial_MV2},
1367 {0, 2048, &MPIR_Reduce_shmem_MV2},
1368 {2048, 4096, &MPIR_Reduce_shmem_MV2},
1369 {4096, 16384, &MPIR_Reduce_shmem_MV2},
1370 {16384, 65536, &MPIR_Reduce_intra_knomial_wrapper_MV2},
1371 {65536, 131072, &MPIR_Reduce_binomial_MV2},
1372 {131072, -1, &MPIR_Reduce_shmem_MV2},
1377 std::copy_n(mv2_tmp_reduce_thresholds_table, mv2_size_reduce_tuning_table, mv2_reduce_thresholds_table);
1380 /************ Reduce scatter variables and initializers */
1382 struct mv2_red_scat_tuning_element {
1385 int (*MV2_pt_Red_scat_function)(void* sendbuf, void* recvbuf, int* recvcnts, MPI_Datatype datatype, MPI_Op op,
1389 struct mv2_red_scat_tuning_table {
1391 int size_inter_table;
1392 mv2_red_scat_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1395 int mv2_size_red_scat_tuning_table = 0;
1396 mv2_red_scat_tuning_table* mv2_red_scat_thresholds_table = NULL;
1398 int (*MV2_Red_scat_function)(void* sendbuf, void* recvbuf, int* recvcnts, MPI_Datatype datatype, MPI_Op op,
1401 static int MPIR_Reduce_Scatter_Basic_MV2(void* sendbuf, void* recvbuf, int* recvcnts, MPI_Datatype datatype, MPI_Op op,
1404 simgrid::smpi::Coll_reduce_scatter_default::reduce_scatter(sendbuf, recvbuf, recvcnts, datatype, op, comm);
1407 #define MPIR_Reduce_scatter_non_comm_MV2 simgrid::smpi::Coll_reduce_scatter_mpich_noncomm::reduce_scatter
1408 #define MPIR_Reduce_scatter_Rec_Halving_MV2 \
1409 simgrid::smpi::Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter
1410 #define MPIR_Reduce_scatter_Pair_Wise_MV2 simgrid::smpi::Coll_reduce_scatter_mpich_pair::reduce_scatter
1412 static void init_mv2_reduce_scatter_tables_stampede()
1414 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
1415 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
1416 mv2_size_red_scat_tuning_table = 6;
1417 mv2_red_scat_thresholds_table = new mv2_red_scat_tuning_table[mv2_size_red_scat_tuning_table];
1418 mv2_red_scat_tuning_table mv2_tmp_red_scat_thresholds_table[] = {
1423 {0, 64, &MPIR_Reduce_Scatter_Basic_MV2},
1424 {64, 65536, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1425 {65536, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1432 {0, 64, &MPIR_Reduce_Scatter_Basic_MV2},
1433 {64, 131072, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1434 {131072, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1441 {0, 1024, &MPIR_Reduce_Scatter_Basic_MV2},
1442 {1024, 262144, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1443 {262144, -1, &MPIR_Reduce_scatter_Pair_Wise_MV2},
1450 {0, 128, &MPIR_Reduce_Scatter_Basic_MV2}, {128, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1457 {0, 128, &MPIR_Reduce_Scatter_Basic_MV2}, {128, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1464 {0, 256, &MPIR_Reduce_Scatter_Basic_MV2}, {256, -1, &MPIR_Reduce_scatter_Rec_Halving_MV2},
1469 std::copy_n(mv2_tmp_red_scat_thresholds_table, mv2_size_red_scat_tuning_table, mv2_red_scat_thresholds_table);
1472 /************ Scatter variables and initializers */
1474 struct mv2_scatter_tuning_element {
1477 int (*MV2_pt_Scatter_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
1478 MPI_Datatype recvtype, int root, MPI_Comm comm);
1481 struct mv2_scatter_tuning_table {
1483 int size_inter_table;
1484 mv2_scatter_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS];
1485 int size_intra_table;
1486 mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS];
1489 int* mv2_scatter_table_ppn_conf = NULL;
1490 int mv2_scatter_num_ppn_conf = 1;
1491 int* mv2_size_scatter_tuning_table = NULL;
1492 mv2_scatter_tuning_table** mv2_scatter_thresholds_table = NULL;
1494 int (*MV2_Scatter_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1495 MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;
1497 int (*MV2_Scatter_intra_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1498 MPI_Datatype recvtype, int root, MPI_Comm comm) = NULL;
1499 int MPIR_Scatter_mcst_wrap_MV2(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
1500 MPI_Datatype recvtype, int root, MPI_Comm comm_ptr);
1502 int MPIR_Scatter_mcst_wrap_MV2(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt,
1503 MPI_Datatype recvtype, int root, MPI_Comm comm_ptr)
1508 #define MPIR_Scatter_MV2_Binomial simgrid::smpi::Coll_scatter_ompi_binomial::scatter
1509 #define MPIR_Scatter_MV2_Direct simgrid::smpi::Coll_scatter_ompi_basic_linear::scatter
1510 #define MPIR_Scatter_MV2_two_level_Binomial simgrid::smpi::Coll_scatter_mvapich2_two_level_binomial::scatter
1511 #define MPIR_Scatter_MV2_two_level_Direct simgrid::smpi::Coll_scatter_mvapich2_two_level_direct::scatter
1513 static void init_mv2_scatter_tables_stampede()
1515 if (simgrid::smpi::Colls::smpi_coll_cleanup_callback == NULL)
1516 simgrid::smpi::Colls::smpi_coll_cleanup_callback = &smpi_coll_cleanup_mvapich2;
1518 int agg_table_sum = 0;
1519 mv2_scatter_tuning_table** table_ptrs = NULL;
1520 mv2_scatter_num_ppn_conf = 3;
1521 mv2_scatter_thresholds_table = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf];
1522 table_ptrs = new mv2_scatter_tuning_table*[mv2_scatter_num_ppn_conf];
1523 mv2_size_scatter_tuning_table = new int[mv2_scatter_num_ppn_conf];
1524 mv2_scatter_table_ppn_conf = new int[mv2_scatter_num_ppn_conf];
1525 mv2_scatter_table_ppn_conf[0] = 1;
1526 mv2_size_scatter_tuning_table[0] = 6;
1527 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_1ppn[] = {
1532 {0, -1, &MPIR_Scatter_MV2_Binomial},
1536 {0, -1, &MPIR_Scatter_MV2_Binomial},
1544 {0, -1, &MPIR_Scatter_MV2_Direct},
1548 {0, -1, &MPIR_Scatter_MV2_Direct},
1556 {0, -1, &MPIR_Scatter_MV2_Direct},
1560 {0, -1, &MPIR_Scatter_MV2_Direct},
1568 {0, -1, &MPIR_Scatter_MV2_Direct},
1572 {0, -1, &MPIR_Scatter_MV2_Direct},
1580 {0, -1, &MPIR_Scatter_MV2_Direct},
1584 {0, -1, &MPIR_Scatter_MV2_Direct},
1592 {0, 32, &MPIR_Scatter_MV2_Binomial}, {32, -1, &MPIR_Scatter_MV2_Direct},
1596 {0, -1, &MPIR_Scatter_MV2_Binomial},
1600 table_ptrs[0] = mv2_tmp_scatter_thresholds_table_1ppn;
1601 mv2_scatter_table_ppn_conf[1] = 2;
1602 mv2_size_scatter_tuning_table[1] = 6;
1603 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_2ppn[] = {
1608 {0, 4096, &MPIR_Scatter_MV2_Binomial}, {4096, -1, &MPIR_Scatter_MV2_Direct},
1612 {0, -1, &MPIR_Scatter_MV2_Direct},
1620 {0, 512, &MPIR_Scatter_MV2_two_level_Direct}, {512, -1, &MPIR_Scatter_MV2_Direct},
1624 {0, -1, &MPIR_Scatter_MV2_Binomial},
1632 {0, 2048, &MPIR_Scatter_MV2_two_level_Direct}, {2048, -1, &MPIR_Scatter_MV2_Direct},
1636 {0, -1, &MPIR_Scatter_MV2_Binomial},
1644 {0, 2048, &MPIR_Scatter_MV2_two_level_Direct}, {2048, -1, &MPIR_Scatter_MV2_Direct},
1648 {0, -1, &MPIR_Scatter_MV2_Binomial},
1656 {0, 8192, &MPIR_Scatter_MV2_two_level_Direct}, {8192, -1, &MPIR_Scatter_MV2_Direct},
1660 {0, -1, &MPIR_Scatter_MV2_Binomial},
1668 {0, 16, &MPIR_Scatter_MV2_Binomial},
1669 {16, 128, &MPIR_Scatter_MV2_two_level_Binomial},
1670 {128, 16384, &MPIR_Scatter_MV2_two_level_Direct},
1671 {16384, -1, &MPIR_Scatter_MV2_Direct},
1675 {0, 128, &MPIR_Scatter_MV2_Direct}, {128, -1, &MPIR_Scatter_MV2_Binomial},
1679 table_ptrs[1] = mv2_tmp_scatter_thresholds_table_2ppn;
1680 mv2_scatter_table_ppn_conf[2] = 16;
1681 mv2_size_scatter_tuning_table[2] = 8;
1682 mv2_scatter_tuning_table mv2_tmp_scatter_thresholds_table_16ppn[] = {
1687 {0, 256, &MPIR_Scatter_MV2_Binomial}, {256, -1, &MPIR_Scatter_MV2_Direct},
1691 {0, -1, &MPIR_Scatter_MV2_Direct},
1699 {0, 512, &MPIR_Scatter_MV2_Binomial}, {512, -1, &MPIR_Scatter_MV2_Direct},
1703 {0, -1, &MPIR_Scatter_MV2_Direct},
1711 {0, 1024, &MPIR_Scatter_MV2_two_level_Direct}, {1024, -1, &MPIR_Scatter_MV2_Direct},
1715 {0, -1, &MPIR_Scatter_MV2_Direct},
1723 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1724 {0, 16, &MPIR_Scatter_MV2_two_level_Direct},
1725 {16, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1726 {2048, -1, &MPIR_Scatter_MV2_Direct},
1730 {0, -1, &MPIR_Scatter_MV2_Direct},
1738 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1739 {0, 16, &MPIR_Scatter_MV2_two_level_Direct},
1740 {16, 2048, &MPIR_Scatter_MV2_two_level_Direct},
1741 {2048, -1, &MPIR_Scatter_MV2_Direct},
1745 {0, -1, &MPIR_Scatter_MV2_Direct},
1753 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1754 {16, 16, &MPIR_Scatter_MV2_two_level_Direct},
1755 {16, 4096, &MPIR_Scatter_MV2_two_level_Direct},
1756 {4096, -1, &MPIR_Scatter_MV2_Direct},
1760 {0, -1, &MPIR_Scatter_MV2_Binomial},
1767 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1768 {0, 16, &MPIR_Scatter_MV2_Binomial},
1769 {16, 32, &MPIR_Scatter_MV2_Binomial},
1770 {32, 4096, &MPIR_Scatter_MV2_two_level_Direct},
1771 {4096, -1, &MPIR_Scatter_MV2_Direct},
1775 {0, -1, &MPIR_Scatter_MV2_Binomial},
1782 {0, 16, &MPIR_Scatter_mcst_wrap_MV2},
1783 {0, 16, &MPIR_Scatter_MV2_two_level_Binomial},
1784 {16, 128, &MPIR_Scatter_MV2_two_level_Binomial},
1785 {128, 1024, &MPIR_Scatter_MV2_two_level_Direct},
1786 {1024, 16384, &MPIR_Scatter_MV2_two_level_Direct},
1787 {16384, 65536, &MPIR_Scatter_MV2_Direct},
1788 {65536, -1, &MPIR_Scatter_MV2_two_level_Direct},
1792 {0, 16, &MPIR_Scatter_MV2_Binomial},
1793 {16, 128, &MPIR_Scatter_MV2_Binomial},
1794 {128, 1024, &MPIR_Scatter_MV2_Binomial},
1795 {1024, 16384, &MPIR_Scatter_MV2_Direct},
1796 {16384, 65536, &MPIR_Scatter_MV2_Direct},
1797 {65536, -1, &MPIR_Scatter_MV2_Direct},
1801 table_ptrs[2] = mv2_tmp_scatter_thresholds_table_16ppn;
1803 for (int i = 0; i < mv2_scatter_num_ppn_conf; i++) {
1804 agg_table_sum += mv2_size_scatter_tuning_table[i];
1806 mv2_scatter_thresholds_table[0] = new mv2_scatter_tuning_table[agg_table_sum];
1807 std::copy_n(table_ptrs[0], mv2_size_scatter_tuning_table[0], mv2_scatter_thresholds_table[0]);
1808 for (int i = 1; i < mv2_scatter_num_ppn_conf; i++) {
1809 mv2_scatter_thresholds_table[i] = mv2_scatter_thresholds_table[i - 1] + mv2_size_scatter_tuning_table[i - 1];
1810 std::copy_n(table_ptrs[i], mv2_size_scatter_tuning_table[i], mv2_scatter_thresholds_table[i]);
1812 delete[] table_ptrs;