This source file includes following definitions.
- ompi_coll_tuned_scatter_intra_check_forced_init
- ompi_coll_tuned_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 "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/coll/base/coll_base_topo.h"
24 #include "ompi/mca/coll/base/coll_base_util.h"
25 #include "ompi/mca/pml/pml.h"
26 #include "coll_tuned.h"
27
28
29 static int coll_tuned_scatter_forced_algorithm = 0;
30 static int coll_tuned_scatter_segment_size = 0;
31 static int coll_tuned_scatter_tree_fanout;
32 static int coll_tuned_scatter_chain_fanout;
33
34
35 static mca_base_var_enum_value_t scatter_algorithms[] = {
36 {0, "ignore"},
37 {1, "basic_linear"},
38 {2, "binomial"},
39 {0, NULL}
40 };
41
42
43
44
45
46
47
48
49
50
51
52
53 int
54 ompi_coll_tuned_scatter_intra_check_forced_init(coll_tuned_force_algorithm_mca_param_indices_t *mca_param_indices)
55 {
56 mca_base_var_enum_t *new_enum;
57 int cnt;
58
59 for( cnt = 0; NULL != scatter_algorithms[cnt].string; cnt++ );
60 ompi_coll_tuned_forced_max_algorithms[SCATTER] = cnt;
61
62 (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
63 "scatter_algorithm_count",
64 "Number of scatter algorithms available",
65 MCA_BASE_VAR_TYPE_INT, NULL, 0,
66 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
67 OPAL_INFO_LVL_5,
68 MCA_BASE_VAR_SCOPE_CONSTANT,
69 &ompi_coll_tuned_forced_max_algorithms[SCATTER]);
70
71
72 coll_tuned_scatter_forced_algorithm = 0;
73 (void) mca_base_var_enum_create("coll_tuned_scatter_algorithms", scatter_algorithms, &new_enum);
74 mca_param_indices->algorithm_param_index =
75 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
76 "scatter_algorithm",
77 "Which scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial.",
78 MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
79 OPAL_INFO_LVL_5,
80 MCA_BASE_VAR_SCOPE_ALL,
81 &coll_tuned_scatter_forced_algorithm);
82 OBJ_RELEASE(new_enum);
83 if (mca_param_indices->algorithm_param_index < 0) {
84 return mca_param_indices->algorithm_param_index;
85 }
86
87 coll_tuned_scatter_segment_size = 0;
88 mca_param_indices->segsize_param_index =
89 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
90 "scatter_algorithm_segmentsize",
91 "Segment size in bytes used by default for scatter algorithms. Only has meaning if algorithm is forced and supports segmenting. 0 bytes means no segmentation. Currently, available algorithms do not support segmentation.",
92 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
93 OPAL_INFO_LVL_5,
94 MCA_BASE_VAR_SCOPE_ALL,
95 &coll_tuned_scatter_segment_size);
96
97 coll_tuned_scatter_tree_fanout = ompi_coll_tuned_init_tree_fanout;
98 mca_param_indices->tree_fanout_param_index =
99 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
100 "scatter_algorithm_tree_fanout",
101 "Fanout for n-tree used for scatter algorithms. Only has meaning if algorithm is forced and supports n-tree topo based operation. Currently, available algorithms do not support n-tree topologies.",
102 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
103 OPAL_INFO_LVL_5,
104 MCA_BASE_VAR_SCOPE_ALL,
105 &coll_tuned_scatter_tree_fanout);
106
107 coll_tuned_scatter_chain_fanout = ompi_coll_tuned_init_chain_fanout;
108 mca_param_indices->chain_fanout_param_index=
109 mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version,
110 "scatter_algorithm_chain_fanout",
111 "Fanout for chains used for scatter algorithms. Only has meaning if algorithm is forced and supports chain topo based operation. Currently, available algorithms do not support chain topologies.",
112 MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE,
113 OPAL_INFO_LVL_5,
114 MCA_BASE_VAR_SCOPE_ALL,
115 &coll_tuned_scatter_chain_fanout);
116
117 return (MPI_SUCCESS);
118 }
119
120 int
121 ompi_coll_tuned_scatter_intra_do_this(const void *sbuf, int scount,
122 struct ompi_datatype_t *sdtype,
123 void* rbuf, int rcount,
124 struct ompi_datatype_t *rdtype,
125 int root,
126 struct ompi_communicator_t *comm,
127 mca_coll_base_module_t *module,
128 int algorithm, int faninout, int segsize)
129 {
130 OPAL_OUTPUT((ompi_coll_tuned_stream,
131 "coll:tuned:scatter_intra_do_this selected algorithm %d topo faninout %d segsize %d",
132 algorithm, faninout, segsize));
133
134 switch (algorithm) {
135 case (0):
136 return ompi_coll_tuned_scatter_intra_dec_fixed(sbuf, scount, sdtype,
137 rbuf, rcount, rdtype,
138 root, comm, module);
139 case (1):
140 return ompi_coll_base_scatter_intra_basic_linear(sbuf, scount, sdtype,
141 rbuf, rcount, rdtype,
142 root, comm, module);
143 case (2):
144 return ompi_coll_base_scatter_intra_binomial(sbuf, scount, sdtype,
145 rbuf, rcount, rdtype,
146 root, comm, module);
147 }
148 OPAL_OUTPUT((ompi_coll_tuned_stream,
149 "coll:tuned:scatter_intra_do_this attempt to select algorithm %d when only 0-%d is valid?",
150 algorithm, ompi_coll_tuned_forced_max_algorithms[SCATTER]));
151 return MPI_ERR_ARG;
152 }