This source file includes following definitions.
- mca_fcoll_base_file_select
- mca_fcoll_base_query_table
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 #include "ompi_config.h"
23
24 #include <string.h>
25
26 #include "opal/class/opal_list.h"
27 #include "opal/util/argv.h"
28 #include "ompi/mca/mca.h"
29 #include "opal/mca/base/base.h"
30 #include "ompi/mca/fcoll/fcoll.h"
31 #include "ompi/mca/fcoll/base/base.h"
32 #include "ompi/mca/common/ompio/common_ompio.h"
33
34
35
36
37
38
39
40 struct queried_module_t {
41 opal_list_item_t super;
42 mca_fcoll_base_component_t *om_component;
43 mca_fcoll_base_module_t *om_module;
44 };
45 typedef struct queried_module_t queried_module_t;
46 static OBJ_CLASS_INSTANCE(queried_module_t, opal_list_item_t, NULL, NULL);
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 int mca_fcoll_base_file_select (struct ompio_file_t *file,
68 mca_base_component_t *preferred)
69 {
70 int priority;
71 int best_priority;
72 opal_list_item_t *item;
73 mca_base_component_list_item_t *cli;
74 mca_fcoll_base_component_t *component;
75 mca_fcoll_base_component_t *best_component;
76 mca_fcoll_base_module_t *module;
77 opal_list_t queried;
78 queried_module_t *om;
79 int err = MPI_SUCCESS;
80
81
82
83 if (NULL != preferred) {
84
85
86
87 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
88 "fcoll:base:file_select: Checking preferred component: %s",
89 preferred->mca_component_name);
90
91
92
93
94 component = (mca_fcoll_base_component_t *)preferred;
95 module = component->fcollm_file_query (file, &priority);
96 if (NULL != module &&
97 NULL != module->fcoll_module_init) {
98
99
100
101
102
103
104
105 file->f_fcoll = module;
106 file->f_fcoll_component = preferred;
107
108 return module->fcoll_module_init(file);
109 }
110
111
112
113
114
115 }
116
117
118
119
120
121
122
123
124
125
126
127
128 best_component = NULL;
129 best_priority = -1;
130 OBJ_CONSTRUCT(&queried, opal_list_t);
131
132 OPAL_LIST_FOREACH(cli, &ompi_fcoll_base_framework.framework_components, mca_base_component_list_item_t) {
133 component = (mca_fcoll_base_component_t *) cli->cli_component;
134 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
135 "select: initialising %s component %s",
136 component->fcollm_version.mca_type_name,
137 component->fcollm_version.mca_component_name);
138
139
140
141
142 if (NULL == component->fcollm_file_query) {
143 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
144 "select: no query, ignoring the component");
145 } else {
146
147
148
149 module = component->fcollm_file_query (file, &priority);
150
151 if (NULL == module ||
152 NULL == module->fcoll_module_init) {
153
154
155
156 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
157 "select: query returned failure");
158 } else {
159 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
160 "select: query returned priority %d",
161 priority);
162
163
164
165 if (priority > best_priority) {
166 best_priority = priority;
167 best_component = component;
168 }
169
170 om = OBJ_NEW(queried_module_t);
171
172
173
174 if (NULL == om) {
175 OBJ_DESTRUCT(&queried);
176 return OMPI_ERR_OUT_OF_RESOURCE;
177 }
178 om->om_component = component;
179 om->om_module = module;
180 opal_list_append(&queried, (opal_list_item_t *)om);
181 }
182 }
183 }
184
185
186
187
188
189
190
191
192 if (NULL == best_component) {
193
194
195
196
197 OBJ_DESTRUCT(&queried);
198 return OMPI_ERROR;
199 }
200
201
202
203
204
205
206
207 while (NULL != (item = opal_list_remove_first(&queried))) {
208 om = (queried_module_t *) item;
209 if (om->om_component == best_component) {
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226 file->f_fcoll = om->om_module;
227 err = om->om_module->fcoll_module_init(file);
228 file->f_fcoll_component = (mca_base_component_t *)best_component;
229
230
231
232 } else {
233
234
235
236 if (NULL != om->om_component->fcollm_file_unquery) {
237
238
239
240
241
242 (void) om->om_component->fcollm_file_unquery(file);
243 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
244 "select: component %s is not selected",
245 om->om_component->fcollm_version.mca_component_name);
246 }
247 }
248 OBJ_RELEASE(om);
249 }
250
251 opal_output_verbose(10, ompi_fcoll_base_framework.framework_output,
252 "select: component %s selected",
253 best_component->fcollm_version.mca_component_name);
254
255 OBJ_DESTRUCT(&queried);
256
257 return err;
258 }
259
260 int mca_fcoll_base_query_table (struct ompio_file_t *file, char *name)
261 {
262 if (!strcmp (name, "individual")) {
263 if ((int)file->f_cc_size >= file->f_bytes_per_agg &&
264 file->f_cc_size >= file->f_stripe_size) {
265 return 1;
266 }
267 if ( 2 >= (int)file->f_size ){
268 return 1;
269 }
270 }
271 if (!strcmp (name, "vulcan")) {
272 if ( (LUSTRE != file->f_fstype)) {
273 return 1;
274 }
275 }
276 if (!strcmp (name, "dynamic")) {
277 if ((int)file->f_cc_size < file->f_bytes_per_agg &&
278 file->f_cc_size >= file->f_stripe_size) {
279 return 1;
280 }
281 }
282 if (!strcmp (name, "dynamic_gen2")) {
283 if ( LUSTRE == file->f_fstype ) {
284 return 1;
285 }
286 }
287 if (!strcmp (name, "two_phase")) {
288 #if OPAL_CUDA_SUPPORT
289
290
291
292
293 #else
294 if ((int)file->f_cc_size < file->f_bytes_per_agg &&
295 (0 == file->f_stripe_size || file->f_cc_size < file->f_stripe_size) &&
296 (LUSTRE != file->f_fstype) ) {
297 return 1;
298 }
299 #endif
300 }
301 return 0;
302 }