This source file includes following definitions.
- mca_io_romio321_file_open
- mca_io_romio321_file_close
- mca_io_romio321_file_set_size
- mca_io_romio321_file_preallocate
- mca_io_romio321_file_get_size
- mca_io_romio321_file_get_amode
- mca_io_romio321_file_set_info
- mca_io_romio321_file_get_info
- mca_io_romio321_file_set_view
- mca_io_romio321_file_get_view
- mca_io_romio321_file_get_type_extent
- mca_io_romio321_file_set_atomicity
- mca_io_romio321_file_get_atomicity
- mca_io_romio321_file_sync
- mca_io_romio321_file_seek_shared
- mca_io_romio321_file_get_position_shared
- mca_io_romio321_file_seek
- mca_io_romio321_file_get_position
- mca_io_romio321_file_get_byte_offset
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 "ompi/communicator/communicator.h"
25 #include "ompi/info/info.h"
26 #include "ompi/file/file.h"
27
28 #include "io_romio321.h"
29
30
31 int
32 mca_io_romio321_file_open (ompi_communicator_t *comm,
33 const char *filename,
34 int amode,
35 opal_info_t *info,
36 ompi_file_t *fh)
37 {
38 int ret;
39 mca_io_romio321_data_t *data;
40
41
42
43
44 ompi_info_t *ompi_info;
45 ompi_info = OBJ_NEW(ompi_info_t);
46 if (!ompi_info) { return(MPI_ERR_NO_MEM); }
47 opal_info_t *opal_info = &(ompi_info->super);
48 opal_info_dup (info, &opal_info);
49
50 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
51
52 ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info,
53 &data->romio_fh);
54
55
56 ompi_info_free(&ompi_info);
57 return ret;
58 }
59
60
61 int
62 mca_io_romio321_file_close (ompi_file_t *fh)
63 {
64 int ret;
65 mca_io_romio321_data_t *data;
66 int finalized;
67
68
69
70
71
72
73 PMPI_Finalized(&finalized);
74 if (finalized) {
75 return OMPI_SUCCESS;
76 }
77
78
79
80
81
82
83
84 if (fh->error_handler != &ompi_mpi_errors_return.eh) {
85 OBJ_RELEASE(fh->error_handler);
86 fh->error_handler = &ompi_mpi_errors_return.eh;
87 OBJ_RETAIN(fh->error_handler);
88 }
89
90 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
91
92 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
93 ret = ROMIO_PREFIX(MPI_File_close) (&data->romio_fh);
94 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
95
96 return ret;
97 }
98
99
100 int
101 mca_io_romio321_file_set_size (ompi_file_t *fh,
102 MPI_Offset size)
103 {
104 int ret;
105 mca_io_romio321_data_t *data;
106
107 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
108 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
109 ret = ROMIO_PREFIX(MPI_File_set_size) (data->romio_fh, size);
110 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
111
112 return ret;
113 }
114
115 int
116 mca_io_romio321_file_preallocate (ompi_file_t *fh,
117 MPI_Offset size)
118 {
119 int ret;
120 mca_io_romio321_data_t *data;
121
122 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
123 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
124 ret = ROMIO_PREFIX(MPI_File_preallocate) (data->romio_fh, size);
125 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
126
127 return ret;
128 }
129
130
131 int
132 mca_io_romio321_file_get_size (ompi_file_t *fh,
133 MPI_Offset * size)
134 {
135 int ret;
136 mca_io_romio321_data_t *data;
137
138 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
139 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
140 ret = ROMIO_PREFIX(MPI_File_get_size) (data->romio_fh, size);
141 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
142
143 return ret;
144 }
145
146
147 int
148 mca_io_romio321_file_get_amode (ompi_file_t *fh,
149 int *amode)
150 {
151 int ret;
152 mca_io_romio321_data_t *data;
153
154 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
155 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
156 ret = ROMIO_PREFIX(MPI_File_get_amode) (data->romio_fh, amode);
157 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
158
159 return ret;
160 }
161
162
163 int
164 mca_io_romio321_file_set_info (ompi_file_t *fh,
165 opal_info_t *info)
166 {
167 int ret;
168 mca_io_romio321_data_t *data;
169
170
171
172
173 ompi_info_t *ompi_info;
174 ompi_info = OBJ_NEW(ompi_info_t);
175 if (!ompi_info) { return(MPI_ERR_NO_MEM); }
176 opal_info_t *opal_info = &(ompi_info->super);
177 opal_info_dup (info, &opal_info);
178
179 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
180 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
181 ret = ROMIO_PREFIX(MPI_File_set_info) (data->romio_fh, ompi_info);
182 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
183
184 ompi_info_free(&ompi_info);
185 return ret;
186 }
187
188
189 int
190 mca_io_romio321_file_get_info (ompi_file_t *fh,
191 opal_info_t ** info_used)
192 {
193 int ret;
194 mca_io_romio321_data_t *data;
195
196
197
198
199 ompi_info_t *ompi_info;
200 ompi_info = OBJ_NEW(ompi_info_t);
201 if (!ompi_info) { return(MPI_ERR_NO_MEM); }
202
203 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
204 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
205 ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, &ompi_info);
206 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
207
208 opal_info_dup (&(ompi_info->super), info_used);
209 ompi_info_free(&ompi_info);
210 return ret;
211 }
212
213
214 int
215 mca_io_romio321_file_set_view (ompi_file_t *fh,
216 MPI_Offset disp,
217 struct ompi_datatype_t *etype,
218 struct ompi_datatype_t *filetype,
219 const char *datarep,
220 opal_info_t *info)
221 {
222 int ret;
223 mca_io_romio321_data_t *data;
224
225
226
227
228 ompi_info_t *ompi_info;
229 ompi_info = OBJ_NEW(ompi_info_t);
230 if (!ompi_info) { return(MPI_ERR_NO_MEM); }
231 opal_info_t *opal_info = &(ompi_info->super);
232 opal_info_dup (info, &opal_info);
233
234 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
235 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
236 ret =
237 ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype,
238 datarep, ompi_info);
239 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
240
241 ompi_info_free(&ompi_info);
242 return ret;
243 }
244
245
246 int
247 mca_io_romio321_file_get_view (ompi_file_t *fh,
248 MPI_Offset * disp,
249 struct ompi_datatype_t ** etype,
250 struct ompi_datatype_t ** filetype,
251 char *datarep)
252 {
253 int ret;
254 mca_io_romio321_data_t *data;
255
256 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
257 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
258 ret =
259 ROMIO_PREFIX(MPI_File_get_view) (data->romio_fh, disp, etype, filetype,
260 datarep);
261 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
262
263 return ret;
264
265 }
266
267
268 int
269 mca_io_romio321_file_get_type_extent (ompi_file_t *fh,
270 struct ompi_datatype_t *datatype,
271 MPI_Aint * extent)
272 {
273 int ret;
274 mca_io_romio321_data_t *data;
275
276 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
277 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
278 ret =
279 ROMIO_PREFIX(MPI_File_get_type_extent) (data->romio_fh, datatype, extent);
280 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
281
282 return ret;
283 }
284
285
286 int
287 mca_io_romio321_file_set_atomicity (ompi_file_t *fh,
288 int flag)
289 {
290 int ret;
291 mca_io_romio321_data_t *data;
292
293 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
294 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
295 ret = ROMIO_PREFIX(MPI_File_set_atomicity) (data->romio_fh, flag);
296 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
297
298 return ret;
299 }
300
301 int
302 mca_io_romio321_file_get_atomicity (ompi_file_t *fh,
303 int *flag)
304 {
305 int ret;
306 mca_io_romio321_data_t *data;
307
308 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
309 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
310 ret = ROMIO_PREFIX(MPI_File_get_atomicity) (data->romio_fh, flag);
311 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
312
313 return ret;
314 }
315
316 int
317 mca_io_romio321_file_sync (ompi_file_t *fh)
318 {
319 int ret;
320 mca_io_romio321_data_t *data;
321
322 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
323 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
324 ret = ROMIO_PREFIX(MPI_File_sync) (data->romio_fh);
325 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
326
327 return ret;
328 }
329
330
331 int
332 mca_io_romio321_file_seek_shared (ompi_file_t *fh,
333 MPI_Offset offset,
334 int whence)
335 {
336 int ret;
337 mca_io_romio321_data_t *data;
338
339 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
340 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
341 ret = ROMIO_PREFIX(MPI_File_seek_shared) (data->romio_fh, offset, whence);
342 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
343
344 return ret;
345 }
346
347
348 int
349 mca_io_romio321_file_get_position_shared (ompi_file_t *fh,
350 MPI_Offset * offset)
351 {
352 int ret;
353 mca_io_romio321_data_t *data;
354
355 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
356 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
357 ret = ROMIO_PREFIX(MPI_File_get_position_shared) (data->romio_fh, offset);
358 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
359
360 return ret;
361 }
362
363
364 int
365 mca_io_romio321_file_seek (ompi_file_t *fh,
366 MPI_Offset offset,
367 int whence)
368 {
369 int ret;
370 mca_io_romio321_data_t *data;
371
372 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
373 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
374 ret = ROMIO_PREFIX(MPI_File_seek) (data->romio_fh, offset, whence);
375 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
376
377 return ret;
378 }
379
380
381 int
382 mca_io_romio321_file_get_position (ompi_file_t *fh,
383 MPI_Offset * offset)
384 {
385 int ret;
386 mca_io_romio321_data_t *data;
387
388 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
389 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
390 ret = ROMIO_PREFIX(MPI_File_get_position) (data->romio_fh, offset);
391 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
392
393 return ret;
394 }
395
396
397 int
398 mca_io_romio321_file_get_byte_offset (ompi_file_t *fh,
399 MPI_Offset offset,
400 MPI_Offset * disp)
401 {
402 int ret;
403 mca_io_romio321_data_t *data;
404
405 data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
406 OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
407 ret = ROMIO_PREFIX(MPI_File_get_byte_offset) (data->romio_fh, offset, disp);
408 OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);
409
410 return ret;
411 }