This source file includes following definitions.
- ompi_coll_tuned_reduce_scatter_block_intra_check_forced_init
- ompi_coll_tuned_reduce_scatter_block_intra_do_this
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include "ompi_config.h"
15
16 #include "mpi.h"
17 #include "opal/util/bit_ops.h"
18 #include "ompi/constants.h"
19 #include "ompi/datatype/ompi_datatype.h"
20 #include "ompi/communicator/communicator.h"
21 #include "ompi/mca/coll/coll.h"
22 #include "ompi/mca/coll/base/coll_base_topo.h"
23 #include "ompi/mca/coll/base/coll_tags.h"
24 #include "ompi/mca/pml/pml.h"
25 #include "ompi/op/op.h"
26 #include "coll_tuned.h"
27
28
29 static int coll_tuned_reduce_scatter_block_forced_algorithm = 0;
30 static int coll_tuned_reduce_scatter_block_segment_size = 0;
31 static int coll_tuned_reduce_scatter_block_tree_fanout;
32
33
34 static mca_base_var_enum_value_t reduce_scatter_block_algorithms[] = {
35 {0, "ignore"},
36 {1, "basic_linear"},
37 {2, "recursive_doubling"},
38 {3, "recursive_halving"},
39 {4, "butterfly"},
40 {0, NULL}
41 };
42
43
44
45
46
47
48
49
50
51
52
53
54
55 int ompi_coll_tuned_reduce_scatter_block_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
56 {
57 mca_base_var_enum_t *new_enum;
58 int cnt;
59
60 for( cnt = 0; NULL != reduce_scatter_block_algorithms[cnt].string; cnt++ );
61 ompi_coll_tuned_forced_max_algorithms[REDUCESCATTERBLOCK] = cnt;
62
63 (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
64 "reduce_scatter_block_algorithm_count",
65 "Number of reduce_scatter_block algorithms available",
66 MCA_BASE_VAR_TYPE_INT, NULL, 0,
67 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
68 OPAL_INFO_LVL_5,
69 MCA_BASE_VAR_SCOPE_CONSTANT,
70 &ompi_coll_tuned_forced_max_algorithms[REDUCESCATTERBLOCK]);
71
72
73 coll_tuned_reduce_scatter_block_forced_algorithm = 0;
74 (void) mca_base_var_enum_create("coll_tuned_reduce_scatter_block_algorithms", reduce_scatter_block_algorithms, &new_enum);
75 mca_param_indices->algorithm_param_index =
76 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
77 "reduce_scatter_block_algorithm",
78 "Which reduce reduce_scatter_block algorithm is used. "
79 "Can be locked down to choice of: 0 ignore, 1 basic_linear, 2 recursive_doubling, "
80 "3 recursive_halving, 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_block_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_block_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_block_algorithm_segmentsize",
94 "Segment size in bytes used by default for reduce_scatter_block 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_block_segment_size);
99
100 coll_tuned_reduce_scatter_block_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_block_algorithm_tree_fanout",
104 "Fanout for n-tree used for reduce_scatter_block 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_block_tree_fanout);
109
110 return (MPI_SUCCESS);
111 }
112
113 int ompi_coll_tuned_reduce_scatter_block_intra_do_this(const void *sbuf, void *rbuf,
114 int rcount,
115 struct ompi_datatype_t *dtype,
116 struct ompi_op_t *op,
117 struct ompi_communicator_t *comm,
118 mca_coll_base_module_t *module,
119 int algorithm, int faninout, int segsize)
120 {
121 OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:reduce_scatter_block_intra_do_this selected algorithm %d topo faninout %d segsize %d",
122 algorithm, faninout, segsize));
123
124 switch (algorithm) {
125 case (0): return ompi_coll_tuned_reduce_scatter_block_intra_dec_fixed(sbuf, rbuf, rcount,
126 dtype, op, comm, module);
127 case (1): return ompi_coll_base_reduce_scatter_block_basic_linear(sbuf, rbuf, rcount,
128 dtype, op, comm, module);
129 case (2): return ompi_coll_base_reduce_scatter_block_intra_recursivedoubling(sbuf, rbuf, rcount,
130 dtype, op, comm, module);
131 case (3): return ompi_coll_base_reduce_scatter_block_intra_recursivehalving(sbuf, rbuf, rcount,
132 dtype, op, comm, module);
133 case (4): return ompi_coll_base_reduce_scatter_block_intra_butterfly(sbuf, rbuf, rcount, dtype, op, comm,
134 module);
135 }
136 OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:reduce_scatter_block_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
137 algorithm, ompi_coll_tuned_forced_max_algorithms[REDUCESCATTERBLOCK]));
138 return (MPI_ERR_ARG);
139 }