This source file includes following definitions.
- ompi_coll_tuned_bcast_intra_check_forced_init
- ompi_coll_tuned_bcast_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 "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_tags.h"
23 #include "ompi/mca/pml/pml.h"
24 #include "coll_tuned.h"
25 #include "ompi/mca/coll/base/coll_base_topo.h"
26 #include "ompi/mca/coll/base/coll_base_util.h"
27
28
29 static int coll_tuned_bcast_forced_algorithm = 0;
30 static int coll_tuned_bcast_segment_size = 0;
31 static int coll_tuned_bcast_tree_fanout;
32 static int coll_tuned_bcast_chain_fanout;
33
34 static int coll_tuned_bcast_knomial_radix = 4;
35
36
37 static mca_base_var_enum_value_t bcast_algorithms[] = {
38 {0, "ignore"},
39 {1, "basic_linear"},
40 {2, "chain"},
41 {3, "pipeline"},
42 {4, "split_binary_tree"},
43 {5, "binary_tree"},
44 {6, "binomial"},
45 {7, "knomial"},
46 {8, "scatter_allgather"},
47 {9, "scatter_allgather_ring"},
48 {0, NULL}
49 };
50
51
52
53
54
55
56
57
58
59
60 int ompi_coll_tuned_bcast_intra_check_forced_init (coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
61 {
62 mca_base_var_enum_t *new_enum;
63 int cnt;
64
65 for( cnt = 0; NULL != bcast_algorithms[cnt].string; cnt++ );
66 ompi_coll_tuned_forced_max_algorithms[BCAST] = cnt;
67
68 (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
69 "bcast_algorithm_count",
70 "Number of bcast algorithms available",
71 MCA_BASE_VAR_TYPE_INT, NULL, 0,
72 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
73 OPAL_INFO_LVL_5,
74 MCA_BASE_VAR_SCOPE_CONSTANT,
75 &ompi_coll_tuned_forced_max_algorithms[BCAST]);
76
77
78 coll_tuned_bcast_forced_algorithm = 0;
79 (void) mca_base_var_enum_create("coll_tuned_bcast_algorithms", bcast_algorithms, &new_enum);
80 mca_param_indices->algorithm_param_index =
81 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
82 "bcast_algorithm",
83 "Which bcast algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 chain, 3: pipeline, 4: split binary tree, 5: binary tree, 6: binomial tree, 7: knomial tree, 8: scatter_allgather, 9: scatter_allgather_ring.",
84 MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
85 OPAL_INFO_LVL_5,
86 MCA_BASE_VAR_SCOPE_ALL,
87 &coll_tuned_bcast_forced_algorithm);
88 OBJ_RELEASE(new_enum);
89 if (mca_param_indices->algorithm_param_index < 0) {
90 return mca_param_indices->algorithm_param_index;
91 }
92
93 coll_tuned_bcast_segment_size = 0;
94 mca_param_indices->segsize_param_index =
95 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
96 "bcast_algorithm_segmentsize",
97 "Segment size in bytes used by default for bcast algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation.",
98 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
99 OPAL_INFO_LVL_5,
100 MCA_BASE_VAR_SCOPE_ALL,
101 &coll_tuned_bcast_segment_size);
102
103 coll_tuned_bcast_tree_fanout = ompi_coll_tuned_init_tree_fanout;
104 mca_param_indices->tree_fanout_param_index =
105 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
106 "bcast_algorithm_tree_fanout",
107 "Fanout for n-tree used for bcast algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation.",
108 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
109 OPAL_INFO_LVL_5,
110 MCA_BASE_VAR_SCOPE_ALL,
111 &coll_tuned_bcast_tree_fanout);
112
113 coll_tuned_bcast_chain_fanout = ompi_coll_tuned_init_chain_fanout;
114 mca_param_indices->chain_fanout_param_index =
115 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
116 "bcast_algorithm_chain_fanout",
117 "Fanout for chains used for bcast algorithms. Only has meaning if algorithm is forced and supports chain topo based operation.",
118 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
119 OPAL_INFO_LVL_5,
120 MCA_BASE_VAR_SCOPE_ALL,
121 &coll_tuned_bcast_chain_fanout);
122
123 coll_tuned_bcast_knomial_radix = 4;
124 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
125 "bcast_algorithm_knomial_radix",
126 "k-nomial tree radix for the bcast algorithm (radix > 1).",
127 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
128 OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL,
129 &coll_tuned_bcast_knomial_radix);
130
131 return (MPI_SUCCESS);
132 }
133
134 int ompi_coll_tuned_bcast_intra_do_this(void *buf, int count,
135 struct ompi_datatype_t *dtype,
136 int root,
137 struct ompi_communicator_t *comm,
138 mca_coll_base_module_t *module,
139 int algorithm, int faninout, int segsize)
140 {
141 OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_do_this algorithm %d topo faninout %d segsize %d",
142 algorithm, faninout, segsize));
143
144 switch (algorithm) {
145 case (0):
146 return ompi_coll_tuned_bcast_intra_dec_fixed( buf, count, dtype, root, comm, module );
147 case (1):
148 return ompi_coll_base_bcast_intra_basic_linear( buf, count, dtype, root, comm, module );
149 case (2):
150 return ompi_coll_base_bcast_intra_chain( buf, count, dtype, root, comm, module, segsize, faninout );
151 case (3):
152 return ompi_coll_base_bcast_intra_pipeline( buf, count, dtype, root, comm, module, segsize );
153 case (4):
154 return ompi_coll_base_bcast_intra_split_bintree( buf, count, dtype, root, comm, module, segsize );
155 case (5):
156 return ompi_coll_base_bcast_intra_bintree( buf, count, dtype, root, comm, module, segsize );
157 case (6):
158 return ompi_coll_base_bcast_intra_binomial( buf, count, dtype, root, comm, module, segsize );
159 case (7):
160 return ompi_coll_base_bcast_intra_knomial(buf, count, dtype, root, comm, module,
161 segsize, coll_tuned_bcast_knomial_radix);
162 case (8):
163 return ompi_coll_base_bcast_intra_scatter_allgather(buf, count, dtype, root, comm, module, segsize);
164 case (9):
165 return ompi_coll_base_bcast_intra_scatter_allgather_ring(buf, count, dtype, root, comm, module, segsize);
166 }
167 OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:bcast_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
168 algorithm, ompi_coll_tuned_forced_max_algorithms[BCAST]));
169 return (MPI_ERR_ARG);
170 }