This source file includes following definitions.
- register_component
- open_component
- close_component
- init_query
- file_query
- file_unquery
- delete_query
- delete_select
- register_datarep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 #include "ompi_config.h"
28
29 #include "mpi.h"
30 #include "opal/class/opal_list.h"
31 #include "opal/threads/mutex.h"
32 #include "opal/mca/base/base.h"
33 #include "ompi/mca/io/io.h"
34 #include "ompi/mca/fs/base/base.h"
35 #include "io_ompio.h"
36 #include "ompi/mca/common/ompio/common_ompio_request.h"
37 #include "ompi/mca/common/ompio/common_ompio_buffer.h"
38
39 #ifdef HAVE_IME_NATIVE_H
40 #include "ompi/mca/fs/ime/fs_ime.h"
41 #endif
42
43
44 int mca_io_ompio_cycle_buffer_size = OMPIO_DEFAULT_CYCLE_BUF_SIZE;
45 int mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE;
46 int mca_io_ompio_num_aggregators = -1;
47 int mca_io_ompio_record_offset_info = 0;
48 int mca_io_ompio_coll_timing_info = 0;
49 int mca_io_ompio_max_aggregators_ratio=8;
50 int mca_io_ompio_aggregators_cutoff_threshold=3;
51 int mca_io_ompio_overwrite_amode = 1;
52 int mca_io_ompio_verbose_info_parsing = 0;
53
54 int mca_io_ompio_grouping_option=5;
55
56
57
58
59 static int register_component(void);
60 static int open_component(void);
61 static int close_component(void);
62 static int init_query(bool enable_progress_threads,
63 bool enable_mpi_threads);
64 static const struct mca_io_base_module_2_0_0_t *
65 file_query (struct ompi_file_t *file,
66 struct mca_io_base_file_t **private_data,
67 int *priority);
68 static int file_unquery(struct ompi_file_t *file,
69 struct mca_io_base_file_t *private_data);
70
71 static int delete_query(const char *filename, struct opal_info_t *info,
72 struct mca_io_base_delete_t **private_data,
73 bool *usable, int *priorty);
74
75 static int delete_select(const char *filename, struct opal_info_t *info,
76 struct mca_io_base_delete_t *private_data);
77
78 static int register_datarep(const char *,
79 MPI_Datarep_conversion_function*,
80 MPI_Datarep_conversion_function*,
81 MPI_Datarep_extent_function*,
82 void*);
83
84
85
86
87
88
89
90
91 static int priority_param = 30;
92 static int delete_priority_param = 30;
93
94
95
96
97
98 opal_mutex_t mca_io_ompio_mutex = {{0}};
99
100
101
102
103
104
105 const char *mca_io_ompio_component_version_string =
106 "OMPI/MPI OMPIO io MCA component version " OMPI_VERSION;
107
108
109 mca_io_base_component_2_0_0_t mca_io_ompio_component = {
110
111
112
113 .io_version = {
114 MCA_IO_BASE_VERSION_2_0_0,
115 .mca_component_name = "ompio",
116 MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
117 OMPI_RELEASE_VERSION),
118 .mca_open_component = open_component,
119 .mca_close_component = close_component,
120 .mca_register_component_params = register_component,
121 },
122 .io_data = {
123
124 MCA_BASE_METADATA_PARAM_CHECKPOINT
125 },
126
127
128
129 .io_init_query = init_query,
130 .io_file_query = file_query,
131 .io_file_unquery = file_unquery,
132
133
134
135 .io_delete_query = delete_query,
136 .io_delete_select = delete_select,
137
138 .io_register_datarep = register_datarep,
139 };
140
141 static int register_component(void)
142 {
143 priority_param = 30;
144 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
145 "priority", "Priority of the io ompio component",
146 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
147 OPAL_INFO_LVL_9,
148 MCA_BASE_VAR_SCOPE_READONLY,
149 &priority_param);
150 delete_priority_param = 30;
151 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
152 "delete_priority", "Delete priority of the io ompio component",
153 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
154 OPAL_INFO_LVL_9,
155 MCA_BASE_VAR_SCOPE_READONLY,
156 &delete_priority_param);
157
158 mca_io_ompio_record_offset_info = 0;
159 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
160 "record_file_offset_info",
161 "The information of the file offset/length",
162 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
163 OPAL_INFO_LVL_9,
164 MCA_BASE_VAR_SCOPE_READONLY,
165 &mca_io_ompio_record_offset_info);
166
167 mca_io_ompio_coll_timing_info = 0;
168 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
169 "coll_timing_info",
170 "Enable collective algorithm timing information",
171 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
172 OPAL_INFO_LVL_9,
173 MCA_BASE_VAR_SCOPE_READONLY,
174 &mca_io_ompio_coll_timing_info);
175
176 mca_io_ompio_cycle_buffer_size = OMPIO_DEFAULT_CYCLE_BUF_SIZE;
177 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
178 "cycle_buffer_size",
179 "Data size issued by individual reads/writes per call",
180 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
181 OPAL_INFO_LVL_9,
182 MCA_BASE_VAR_SCOPE_READONLY,
183 &mca_io_ompio_cycle_buffer_size);
184
185 mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE;
186 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
187 "bytes_per_agg",
188 "Size of temporary buffer for collective I/O operations",
189 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
190 OPAL_INFO_LVL_9,
191 MCA_BASE_VAR_SCOPE_READONLY,
192 &mca_io_ompio_bytes_per_agg);
193
194 mca_io_ompio_num_aggregators = -1;
195 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
196 "num_aggregators",
197 "number of aggregators for collective I/O operations",
198 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
199 OPAL_INFO_LVL_9,
200 MCA_BASE_VAR_SCOPE_READONLY,
201 &mca_io_ompio_num_aggregators);
202
203
204 mca_io_ompio_grouping_option = 5;
205 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
206 "grouping_option",
207 "Option for grouping of processes in the aggregator selection "
208 "1: Data volume based grouping 2: maximizing group size uniformity 3: maximimze "
209 "data contiguity 4: hybrid optimization 5: simple (default) "
210 "6: skip refinement step 7: simple+: grouping based on default file view",
211 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
212 OPAL_INFO_LVL_9,
213 MCA_BASE_VAR_SCOPE_READONLY,
214 &mca_io_ompio_grouping_option);
215
216 mca_io_ompio_max_aggregators_ratio = 8;
217 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
218 "max_aggregators_ratio",
219 "Maximum number of processes that can be an aggregator expressed as "
220 "the ratio to the number of process used to open the file"
221 " i.e 1 out of n processes can be an aggregator, with n being specified"
222 " by this mca parameter.",
223 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
224 OPAL_INFO_LVL_9,
225 MCA_BASE_VAR_SCOPE_READONLY,
226 &mca_io_ompio_max_aggregators_ratio);
227
228
229 mca_io_ompio_aggregators_cutoff_threshold=3;
230 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
231 "aggregators_cutoff_threshold",
232 "Relativ cutoff threshold for incrementing the number of aggregators "
233 "in the simple aggregator selection algorithm (5). Lower value "
234 "for this parameter will lead to higher no. of aggregators.",
235 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
236 OPAL_INFO_LVL_9,
237 MCA_BASE_VAR_SCOPE_READONLY,
238 &mca_io_ompio_aggregators_cutoff_threshold);
239
240 mca_io_ompio_overwrite_amode = 1;
241 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
242 "overwrite_amode",
243 "Overwrite WRONLY amode to RDWR to enable data sieving "
244 "1: allow overwrite (default) "
245 "0: do not overwrite amode provided by application ",
246 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
247 OPAL_INFO_LVL_9,
248 MCA_BASE_VAR_SCOPE_READONLY,
249 &mca_io_ompio_overwrite_amode);
250
251 mca_io_ompio_verbose_info_parsing = 0;
252 (void) mca_base_component_var_register(&mca_io_ompio_component.io_version,
253 "verbose_info_parsing",
254 "Provide visual output when parsing info objects "
255 "0: no verbose output (default) "
256 "1: verbose output by rank 0 "
257 "2: verbose output by all ranks ",
258 MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
259 OPAL_INFO_LVL_9,
260 MCA_BASE_VAR_SCOPE_READONLY,
261 &mca_io_ompio_verbose_info_parsing);
262
263 return OMPI_SUCCESS;
264 }
265
266 static int open_component(void)
267 {
268
269 OBJ_CONSTRUCT(&mca_io_ompio_mutex, opal_mutex_t);
270
271 mca_common_ompio_request_init ();
272
273 return mca_common_ompio_set_callbacks(ompi_io_ompio_generate_current_file_view,
274 mca_io_ompio_get_mca_parameter_value);
275 }
276
277
278 static int close_component(void)
279 {
280 mca_common_ompio_request_fini ();
281 mca_common_ompio_buffer_alloc_fini();
282 OBJ_DESTRUCT(&mca_io_ompio_mutex);
283
284 #ifdef HAVE_IME_NATIVE_H
285 mca_fs_ime_native_fini();
286 #endif
287
288 return OMPI_SUCCESS;
289 }
290
291
292 static int init_query(bool enable_progress_threads,
293 bool enable_mpi_threads)
294 {
295 return OMPI_SUCCESS;
296 }
297
298
299 static const struct mca_io_base_module_2_0_0_t *
300 file_query(struct ompi_file_t *file,
301 struct mca_io_base_file_t **private_data,
302 int *priority)
303 {
304 mca_common_ompio_data_t *data;
305 char *tmp;
306 int rank;
307 int is_lustre=0;
308
309 tmp = strchr (file->f_filename, ':');
310 rank = ompi_comm_rank ( file->f_comm);
311 if (!tmp) {
312 if ( 0 == rank) {
313 if (LUSTRE == mca_fs_base_get_fstype(file->f_filename)) {
314 is_lustre = 1;
315 }
316 }
317
318 file->f_comm->c_coll->coll_bcast (&is_lustre,
319 1,
320 MPI_INT,
321 0,
322 file->f_comm,
323 file->f_comm->c_coll->coll_bcast_module);
324 }
325 else {
326 if (!strncasecmp(file->f_filename, "lustre:", 7) ) {
327 is_lustre = 1;
328 }
329 }
330
331 if (is_lustre) {
332 *priority = 1;
333 }
334 else {
335 *priority = priority_param;
336 }
337
338
339
340
341 data = calloc(1, sizeof(mca_common_ompio_data_t));
342 if (NULL == data) {
343 return NULL;
344 }
345
346 *private_data = (struct mca_io_base_file_t*) data;
347
348
349
350 return &mca_io_ompio_module;
351 }
352
353
354 static int file_unquery(struct ompi_file_t *file,
355 struct mca_io_base_file_t *private_data)
356 {
357
358
359
360 if (NULL != private_data) {
361 free(private_data);
362 }
363
364 return OMPI_SUCCESS;
365 }
366
367
368 static int delete_query(const char *filename, struct opal_info_t *info,
369 struct mca_io_base_delete_t **private_data,
370 bool *usable, int *priority)
371 {
372 *priority = delete_priority_param;
373 *usable = true;
374 *private_data = NULL;
375
376 return OMPI_SUCCESS;
377 }
378
379 static int delete_select(const char *filename, struct opal_info_t *info,
380 struct mca_io_base_delete_t *private_data)
381 {
382 int ret;
383
384 OPAL_THREAD_LOCK (&mca_io_ompio_mutex);
385 ret = mca_common_ompio_file_delete (filename, info);
386 OPAL_THREAD_UNLOCK (&mca_io_ompio_mutex);
387
388 return ret;
389 }
390
391 static int register_datarep(const char * datarep,
392 MPI_Datarep_conversion_function* read_fn,
393 MPI_Datarep_conversion_function* write_fn,
394 MPI_Datarep_extent_function* extent_fn,
395 void* state)
396 {
397 return OMPI_ERROR;
398 }
399
400
401
402
403
404
405