This source file includes following definitions.
- ompi_coll_tuned_reduce_scatter_intra_check_forced_init
- ompi_coll_tuned_reduce_scatter_intra_do_this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include "ompi_config.h"
16
17 #include "mpi.h"
18 #include "opal/util/bit_ops.h"
19 #include "ompi/constants.h"
20 #include "ompi/datatype/ompi_datatype.h"
21 #include "ompi/communicator/communicator.h"
22 #include "ompi/mca/coll/coll.h"
23 #include "ompi/mca/coll/base/coll_base_topo.h"
24 #include "ompi/mca/coll/base/coll_tags.h"
25 #include "ompi/mca/pml/pml.h"
26 #include "ompi/op/op.h"
27 #include "coll_tuned.h"
28
29
30 static int coll_tuned_reduce_scatter_forced_algorithm = 0;
31 static int coll_tuned_reduce_scatter_segment_size = 0;
32 static int coll_tuned_reduce_scatter_tree_fanout;
33 static int coll_tuned_reduce_scatter_chain_fanout;
34
35
36 static mca_base_var_enum_value_t reduce_scatter_algorithms[] = {
37 {0, "ignore"},
38 {1, "non-overlapping"},
39 {2, "recursive_halving"},
40 {3, "ring"},
41 {4, "butterfly"},
42 {0, NULL}
43 };
44
45
46
47
48
49
50
51
52
53
54
55
56
57 int ompi_coll_tuned_reduce_scatter_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
58 {
59 mca_base_var_enum_t *new_enum;
60 int cnt;
61
62 for( cnt = 0; NULL != reduce_scatter_algorithms[cnt].string; cnt++ );
63 ompi_coll_tuned_forced_max_algorithms[REDUCESCATTER] = cnt;
64
65 (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
66 "reduce_scatter_algorithm_count",
67 "Number of reduce_scatter algorithms available",
68 MCA_BASE_VAR_TYPE_INT, NULL, 0,
69 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
70 OPAL_INFO_LVL_5,
71 MCA_BASE_VAR_SCOPE_CONSTANT,
72 &ompi_coll_tuned_forced_max_algorithms[REDUCESCATTER]);
73
74
75 coll_tuned_reduce_scatter_forced_algorithm = 0;
76 (void) mca_base_var_enum_create("coll_tuned_reduce_scatter_algorithms", reduce_scatter_algorithms, &new_enum);
77 mca_param_indices->algorithm_param_index =
78 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
79 "reduce_scatter_algorithm",
80 "Which reduce reduce_scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 non-overlapping (Reduce + Scatterv), 2 recursive halving, 3 ring, 4 butterfly",
81 MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
82 OPAL_INFO_LVL_5,
83 MCA_BASE_VAR_SCOPE_ALL,
84 &coll_tuned_reduce_scatter_forced_algorithm);
85 OBJ_RELEASE(new_enum);
86 if (mca_param_indices->algorithm_param_index < 0) {
87 return mca_param_indices->algorithm_param_index;
88 }
89
90 coll_tuned_reduce_scatter_segment_size = 0;
91 mca_param_indices->segsize_param_index =
92 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
93 "reduce_scatter_algorithm_segmentsize",
94 "Segment size in bytes used by default for reduce_scatter algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation.",
95 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
96 OPAL_INFO_LVL_5,
97 MCA_BASE_VAR_SCOPE_ALL,
98 &coll_tuned_reduce_scatter_segment_size);
99
100 coll_tuned_reduce_scatter_tree_fanout = ompi_coll_tuned_init_tree_fanout;
101 mca_param_indices->tree_fanout_param_index =
102 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
103 "reduce_scatter_algorithm_tree_fanout",
104 "Fanout for n-tree used for reduce_scatter algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation.",
105 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
106 OPAL_INFO_LVL_5,
107 MCA_BASE_VAR_SCOPE_ALL,
108 &coll_tuned_reduce_scatter_tree_fanout);
109
110 coll_tuned_reduce_scatter_chain_fanout = ompi_coll_tuned_init_chain_fanout;
111 mca_param_indices->chain_fanout_param_index =
112 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
113 "reduce_scatter_algorithm_chain_fanout",
114 "Fanout for chains used for reduce_scatter algorithms. Only has meaning if algorithm is forced and supports chain topo based operation.",
115 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
116 OPAL_INFO_LVL_5,
117 MCA_BASE_VAR_SCOPE_ALL,
118 &coll_tuned_reduce_scatter_chain_fanout);
119
120 return (MPI_SUCCESS);
121 }
122
123 int ompi_coll_tuned_reduce_scatter_intra_do_this(const void *sbuf, void* rbuf,
124 const int *rcounts,
125 struct ompi_datatype_t *dtype,
126 struct ompi_op_t *op,
127 struct ompi_communicator_t *comm,
128 mca_coll_base_module_t *module,
129 int algorithm, int faninout, int segsize)
130 {
131 OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:reduce_scatter_intra_do_this selected algorithm %d topo faninout %d segsize %d",
132 algorithm, faninout, segsize));
133
134 switch (algorithm) {
135 case (0): return ompi_coll_tuned_reduce_scatter_intra_dec_fixed(sbuf, rbuf, rcounts,
136 dtype, op, comm, module);
137 case (1): return ompi_coll_base_reduce_scatter_intra_nonoverlapping(sbuf, rbuf, rcounts,
138 dtype, op, comm, module);
139 case (2): return ompi_coll_base_reduce_scatter_intra_basic_recursivehalving(sbuf, rbuf, rcounts,
140 dtype, op, comm, module);
141 case (3): return ompi_coll_base_reduce_scatter_intra_ring(sbuf, rbuf, rcounts,
142 dtype, op, comm, module);
143 case (4): return ompi_coll_base_reduce_scatter_intra_butterfly(sbuf, rbuf, rcounts,
144 dtype, op, comm, module);
145 }
146 OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:reduce_scatter_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
147 algorithm, ompi_coll_tuned_forced_max_algorithms[REDUCESCATTER]));
148 return (MPI_ERR_ARG);
149 }