SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sion_fortran.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** SIONLIB http://www.fz-juelich.de/jsc/sionlib **
3 *****************************************************************************
4 ** Copyright (c) 2008-2019 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
9 #ifndef SION_FORTRAN_H_
10 #define SION_FORTRAN_H_
11 
12 #include "sion.h"
13 
22 /* sion_open() */
23 #if defined(_FORTRANCAPS)
24 #define fsion_open_c FSION_OPEN_C
25 
26 #elif defined(_FORTRANNOCAPS)
27 #define fsion_open_c fsion_open_c
28 
29 #elif defined(_FORTRANUNDERSCORE)
30 #define fsion_open_c fsion_open_c_
31 
32 #elif defined(_FORTRANDOUBLEUNDERSCORE)
33 #define fsion_open_c fsion_open_c__
34 
35 #elif defined(_FORTRANNOUNDERSCORE)
36 #else
37 #error nothing defined for fortran externals
38 #endif
39 void fsion_open_c(char *fname,
40  char *file_mode,
41  int *ntasks,
42  int *nfiles,
43  sion_int64 *chunksizes,
44  sion_int32 *fsblksize,
45  int *globalranks,
46  int *sid,
47  int fname_len,
48  int file_mode_len);
49 
50 /* sion_open_rank() */
51 #if defined(_FORTRANCAPS)
52 #define fsion_open_rank_c FSION_OPEN_RANK_C
53 
54 #elif defined(_FORTRANNOCAPS)
55 #define fsion_open_rank_c fsion_open_rank_c
56 
57 #elif defined(_FORTRANUNDERSCORE)
58 #define fsion_open_rank_c fsion_open_rank_c_
59 
60 #elif defined(_FORTRANDOUBLEUNDERSCORE)
61 #define fsion_open_rank_c fsion_open_rank_c__
62 
63 #elif defined(_FORTRANNOUNDERSCORE)
64 #else
65 #error nothing defined for fortran externals
66 #endif
67 void fsion_open_rank_c(char *fname,
68  char *file_mode,
69  sion_int64 *chunksize,
70  sion_int32 *fsblksize,
71  int *rank,
72  int *sid,
73  int fname_len,
74  int file_mode_len);
75 
76 /* sion_close() */
77 #if defined(_FORTRANCAPS)
78 #define fsion_close_c FSION_CLOSE_C
79 
80 #elif defined(_FORTRANNOCAPS)
81 #define fsion_close_c fsion_close_c
82 
83 #elif defined(_FORTRANUNDERSCORE)
84 #define fsion_close_c fsion_close_c_
85 
86 #elif defined(_FORTRANDOUBLEUNDERSCORE)
87 #define fsion_close_c fsion_close_c__
88 
89 #elif defined(_FORTRANNOUNDERSCORE)
90 #else
91 #error nothing defined for fortran externals
92 #endif
93 void fsion_close_c(int *sid,
94  int *ierr);
95 
96 /* sion_feof() */
97 #if defined(_FORTRANCAPS)
98 #define fsion_feof_c FSION_FEOF_C
99 
100 #elif defined(_FORTRANNOCAPS)
101 #define fsion_feof_c fsion_feof_c
102 
103 #elif defined(_FORTRANUNDERSCORE)
104 #define fsion_feof_c fsion_feof_c_
105 
106 #elif defined(_FORTRANDOUBLEUNDERSCORE)
107 #define fsion_feof_c fsion_feof_c__
108 
109 #elif defined(_FORTRANNOUNDERSCORE)
110 #else
111 #error nothing defined for fortran externals
112 #endif
113 void fsion_feof_c(int *sid,
114  int *eof);
115 
116 /* sion_seek() */
117 #if defined(_FORTRANCAPS)
118 #define fsion_seek_c FSION_SEEK_C
119 
120 #elif defined(_FORTRANNOCAPS)
121 #define fsion_seek_c fsion_seek_c
122 
123 #elif defined(_FORTRANUNDERSCORE)
124 #define fsion_seek_c fsion_seek_c_
125 
126 #elif defined(_FORTRANDOUBLEUNDERSCORE)
127 #define fsion_seek_c fsion_seek_C__
128 
129 #elif defined(_FORTRANNOUNDERSCORE)
130 #else
131 #error nothing defined for fortran externals
132 #endif
133 void fsion_seek_c(int *sid,
134  int *rank,
135  int *currentblocknr,
136  sion_int64 *posinblk,
137  int *ierr);
138 
139 /* sion_ensure_free_space() */
140 #if defined(_FORTRANCAPS)
141 #define fsion_ensure_free_space_c FSION_ENSURE_FREE_SPACE_C
142 
143 #elif defined(_FORTRANNOCAPS)
144 #define fsion_ensure_free_space_c fsion_ensure_free_space_c
145 
146 #elif defined(_FORTRANUNDERSCORE)
147 #define fsion_ensure_free_space_c fsion_ensure_free_space_c_
148 
149 #elif defined(_FORTRANDOUBLEUNDERSCORE)
150 #define fsion_ensure_free_space_c fsion_ensure_free_space_c__
151 
152 #elif defined(_FORTRANNOUNDERSCORE)
153 #else
154 #error nothing defined for fortran externals
155 #endif
156 void fsion_ensure_free_space_c(int *sid,
157  sion_int64 *bytes,
158  int *ierr);
159 
160 /* sion_flush() */
161 #if defined(_FORTRANCAPS)
162 #define fsion_flush_c FSION_FLUSH_C
163 
164 #elif defined(_FORTRANNOCAPS)
165 #define fsion_flush_c fsion_flush_c
166 
167 #elif defined(_FORTRANUNDERSCORE)
168 #define fsion_flush_c fsion_flush_c_
169 
170 #elif defined(_FORTRANDOUBLEUNDERSCORE)
171 #define fsion_flush_c fsion_flush_c__
172 
173 #elif defined(_FORTRANNOUNDERSCORE)
174 #else
175 #error nothing defined for fortran externals
176 #endif
177 void fsion_flush_c(int *sid,
178  int *ierr);
179 
180 /* sion_bytes_avail_in_block() */
181 #if defined(_FORTRANCAPS)
182 #define fsion_bytes_avail_in_block_c FSION_BYTES_AVAIL_IN_BLOCK_C
183 
184 #elif defined(_FORTRANNOCAPS)
185 #define fsion_bytes_avail_in_block_c fsion_bytes_avail_in_block_c
186 
187 #elif defined(_FORTRANUNDERSCORE)
188 #define fsion_bytes_avail_in_block_c fsion_bytes_avail_in_block_c_
189 
190 #elif defined(_FORTRANDOUBLEUNDERSCORE)
191 #define fsion_bytes_avail_in_block_c fsion_bytes_avail_in_block_c__
192 
193 #elif defined(_FORTRANNOUNDERSCORE)
194 #else
195 #error nothing defined for fortran externals
196 #endif
197 sion_int64 fsion_bytes_avail_in_block_c(int *sid);
198 
199 /* sion_get_locations() */
200 #if defined(_FORTRANCAPS)
201 #define fsion_get_locations_c FSION_GET_LOCATIONS_C
202 
203 #elif defined(_FORTRANNOCAPS)
204 #define fsion_get_locations_c fsion_get_locations_c
205 
206 #elif defined(_FORTRANUNDERSCORE)
207 #define fsion_get_locations_c fsion_get_locations_c_
208 
209 #elif defined(_FORTRANDOUBLEUNDERSCORE)
210 #define fsion_get_locations_c fsion_get_locations_c__
211 
212 #elif defined(_FORTRANNOUNDERSCORE)
213 #else
214 #error nothing defined for fortran externals
215 #endif
216 void fsion_get_locations_c(int *sid,
217  int *ntasks,
218  int *maxblocks,
219  sion_int64 *globalskip,
220  sion_int64 *start_of_varheader,
221  sion_int64 **sion_chunksizes,
222  sion_int64 **sion_globalranks,
223  sion_int64 **sion_blockcount,
224  sion_int64 **sion_fsblksizes,
225  int *ierr);
226 
227 /* sion_get_current_locations() */
228 #if defined(_FORTRANCAPS)
229 #define fsion_get_current_locations_c FSION_GET_CURRENT_LOCATIONS_C
230 
231 #elif defined(_FORTRANNOCAPS)
232 #define fsion_get_current_locations_c fsion_get_current_locations_c
233 
234 #elif defined(_FORTRANUNDERSCORE)
235 #define fsion_get_current_locations_c fsion_get_current_locations_c_
236 
237 #elif defined(_FORTRANDOUBLEUNDERSCORE)
238 #define fsion_get_current_locations_c fsion_get_current_locations_c__
239 
240 #elif defined(_FORTRANNOUNDERSCORE)
241 #else
242 #error nothing defined for fortran externals
243 #endif
244 void fsion_get_current_locations_c(int *sid,
245  int *ntasks,
246  sion_int64 **sion_currentpos,
247  sion_int64 **sion_currentblocknr,
248  int *ierr);
249 
250 /* sion_get_chunksizes() */
251 #if defined(_FORTRANCAPS)
252 #define fsion_get_chunksizes_c FSION_GET_CHUNKSIZES_C
253 
254 #elif defined(_FORTRANNOCAPS)
255 #define fsion_get_chunksizes_c fsion_get_chunksizes_c
256 
257 #elif defined(_FORTRANUNDERSCORE)
258 #define fsion_get_chunksizes_c fsion_get_chunksizes_c_
259 
260 #elif defined(_FORTRANDOUBLEUNDERSCORE)
261 #define fsion_get_chunksizes_c fsion_get_chunksizes_c__
262 
263 #elif defined(_FORTRANNOUNDERSCORE)
264 #else
265 #error nothing defined for fortran externals
266 #endif
267 void fsion_get_chunksizes_c(int *sid,
268  sion_int64 *chunksizes,
269  int *ierr);
270 
271 /* sion_get_globalranks() */
272 #if defined(_FORTRANCAPS)
273 #define fsion_get_globalranks_c FSION_GET_GLOBALRANKS_C
274 
275 #elif defined(_FORTRANNOCAPS)
276 #define fsion_get_globalranks_c fsion_get_globalranks_c
277 
278 #elif defined(_FORTRANUNDERSCORE)
279 #define fsion_get_globalranks_c fsion_get_globalranks_c_
280 
281 #elif defined(_FORTRANDOUBLEUNDERSCORE)
282 #define fsion_get_globalranks_c fsion_get_globalranks_c__
283 
284 #elif defined(_FORTRANNOUNDERSCORE)
285 #else
286 #error nothing defined for fortran externals
287 #endif
288 void fsion_get_globalranks_c(int *sid,
289  int *globalranks,
290  int *ierr);
291 
292 /* sion_get_mapping_spec() */
293 #if defined(_FORTRANCAPS)
294 #define fsion_get_mapping_spec_c FSION_GET_MAPPING_SPEC_C
295 
296 #elif defined(_FORTRANNOCAPS)
297 #define fsion_get_mapping_spec_c fsion_get_mapping_spec_c
298 
299 #elif defined(_FORTRANUNDERSCORE)
300 #define fsion_get_mapping_spec_c fsion_get_mapping_spec_c_
301 
302 #elif defined(_FORTRANDOUBLEUNDERSCORE)
303 #define fsion_get_mapping_spec_c fsion_get_mapping_spec_c__
304 
305 #elif defined(_FORTRANNOUNDERSCORE)
306 #else
307 #error nothing defined for fortran externals
308 #endif
309 void fsion_get_mapping_spec_c(int *sid,
310  int *mapping_size,
311  int *numfiles,
312  int *ierr);
313 
314 /* sion_get_mapping() */
315 #if defined(_FORTRANCAPS)
316 #define fsion_get_mapping_c FSION_GET_MAPPING_C
317 
318 #elif defined(_FORTRANNOCAPS)
319 #define fsion_get_mapping_c fsion_get_mapping_c
320 
321 #elif defined(_FORTRANUNDERSCORE)
322 #define fsion_get_mapping_c fsion_get_mapping_c_
323 
324 #elif defined(_FORTRANDOUBLEUNDERSCORE)
325 #define fsion_get_mapping_c fsion_get_mapping_c__
326 
327 #elif defined(_FORTRANNOUNDERSCORE)
328 #else
329 #error nothing defined for fortran externals
330 #endif
331 void fsion_get_mapping_c(int *sid,
332  sion_int32 *mapping,
333  int *ierr);
334 
335 /* sion_get_position() */
336 #if defined(_FORTRANCAPS)
337 #define fsion_get_position_c FSION_GET_POSITION_C
338 
339 #elif defined(_FORTRANNOCAPS)
340 #define fsion_get_position_c fsion_get_position_c
341 
342 #elif defined(_FORTRANUNDERSCORE)
343 #define fsion_get_position_c fsion_get_position_c_
344 
345 #elif defined(_FORTRANDOUBLEUNDERSCORE)
346 #define fsion_get_position_c fsion_get_position_c__
347 
348 #elif defined(_FORTRANNOUNDERSCORE)
349 #else
350 #error nothing defined for fortran externals
351 #endif
352 sion_int64 fsion_get_position_c(int *sid);
353 
354 /* sion_get_fileno() */
355 #if defined(_FORTRANCAPS)
356 #define fsion_get_fileno_c FSION_GET_FILENO_C
357 
358 #elif defined(_FORTRANNOCAPS)
359 #define fsion_get_fileno_c fsion_get_fileno_c
360 
361 #elif defined(_FORTRANUNDERSCORE)
362 #define fsion_get_fileno_c fsion_get_fileno_c_
363 
364 #elif defined(_FORTRANDOUBLEUNDERSCORE)
365 #define fsion_get_fileno_c fsion_get_fileno_c__
366 
367 #elif defined(_FORTRANNOUNDERSCORE)
368 #else
369 #error nothing defined for fortran externals
370 #endif
371 void fsion_get_fileno_c(int *sid,
372  int *filenumber);
373 
374 /* sion_set_fp_closed() */
375 #if defined(_FORTRANCAPS)
376 #define fsion_set_fp_closed_c FSION_SET_FP_CLOSED_C
377 
378 #elif defined(_FORTRANNOCAPS)
379 #define fsion_set_fp_closed_c fsion_set_fp_closed_c
380 
381 #elif defined(_FORTRANUNDERSCORE)
382 #define fsion_set_fp_closed_c fsion_set_fp_closed_c_
383 
384 #elif defined(_FORTRANDOUBLEUNDERSCORE)
385 #define fsion_set_fp_closed_c fsion_set_fp_closed_c__
386 
387 #elif defined(_FORTRANNOUNDERSCORE)
388 #else
389 #error nothing defined for fortran externals
390 #endif
391 void fsion_set_fp_closed_c(int *sid,
392  int *ierr);
393 
394 /* sion_get_file_endianness() */
395 #if defined(_FORTRANCAPS)
396 #define fsion_get_file_endianness_c FSION_GET_FILE_ENDIANNESS_C
397 
398 #elif defined(_FORTRANNOCAPS)
399 #define fsion_get_file_endianness_c fsion_get_file_endianness_c
400 
401 #elif defined(_FORTRANUNDERSCORE)
402 #define fsion_get_file_endianness_c fsion_get_file_endianness_c_
403 
404 #elif defined(_FORTRANDOUBLEUNDERSCORE)
405 #define fsion_get_file_endianness_c fsion_get_file_endianness_c__
406 
407 #elif defined(_FORTRANNOUNDERSCORE)
408 #else
409 #error nothing defined for fortran externals
410 #endif
411 void fsion_get_file_endianness_c(int *sid,
412  int *endianness);
413 
414 /* sion_get_endianness() */
415 #if defined(_FORTRANCAPS)
416 #define fsion_get_endianness_c FSION_GET_ENDIANNESS_C
417 
418 #elif defined(_FORTRANNOCAPS)
419 #define fsion_get_endianness_c fsion_get_endianness_c
420 
421 #elif defined(_FORTRANUNDERSCORE)
422 #define fsion_get_endianness_c fsion_get_endianness_c_
423 
424 #elif defined(_FORTRANDOUBLEUNDERSCORE)
425 #define fsion_get_endianness_c fsion_get_endianness_c__
426 
427 #elif defined(_FORTRANNOUNDERSCORE)
428 #else
429 #error nothing defined for fortran externals
430 #endif
431 void fsion_get_endianness_c(int *filenumber);
432 
433 /* sion_endianness_swap_needed() */
434 #if defined(_FORTRANCAPS)
435 #define fsion_endianness_swap_needed_c FSION_ENDIANNESS_SWAP_NEEDED_C
436 
437 #elif defined(_FORTRANNOCAPS)
438 #define fsion_endianness_swap_needed_c fsion_endianness_swap_needed_c
439 
440 #elif defined(_FORTRANUNDERSCORE)
441 #define fsion_endianness_swap_needed_c fsion_endianness_swap_needed_c_
442 
443 #elif defined(_FORTRANDOUBLEUNDERSCORE)
444 #define fsion_endianness_swap_needed_c fsion_endianness_swap_needed_c__
445 
446 #elif defined(_FORTRANNOUNDERSCORE)
447 #else
448 #error nothing defined for fortran externals
449 #endif
450 void fsion_endianness_swap_needed_c(int *sid,
451  int *needed);
452 
453 /* sion_swap() */
454 #if defined(_FORTRANCAPS)
455 #define fsion_swap_c FSION_SWAP_C
456 
457 #elif defined(_FORTRANNOCAPS)
458 #define fsion_swap_c fsion_swap_c
459 
460 #elif defined(_FORTRANUNDERSCORE)
461 #define fsion_swap_c fsion_swap_c_
462 
463 #elif defined(_FORTRANDOUBLEUNDERSCORE)
464 #define fsion_swap_c fsion_swap_c__
465 
466 #elif defined(_FORTRANNOUNDERSCORE)
467 #else
468 #error nothing defined for fortran externals
469 #endif
470 void fsion_swap_c(void *target,
471  void *source,
472  int *size,
473  int *n,
474  int *do_swap,
475  int *rc);
476 
477 /* endianness FIX */
478 #define SWAP_2(x) ( (((x) & 0xff) << 8) | ((unsigned short)(x) >> 8) )
479 #define SWAP_4(x) ( ((x) << 24) | (((x) << 8) & 0x00ff0000) | \
480  (((x) >> 8) & 0x0000ff00) | ((x) >> 24) )
481 #define FIX_SHORT(x) (*(unsigned short *)&(x) = SWAP_2(*(unsigned short *)&(x)))
482 #define FIX_LONG(x) (*(unsigned *)&(x) = SWAP_4(*(unsigned *)&(x)))
483 #define FIX_FLOAT(x) FIX_LONG(x)
484 
485 #endif /* SION_FORTRAN_H_ */
void fsion_feof_c(int *sid, int *eof)
Fortran function that indicates the end of file for this task.
Definition: sion_fortran.c:205
sion_int64 fsion_bytes_avail_in_block_c(int *sid)
Fortran function that returns the number of bytes available in the current chunk.
Definition: sion_fortran.c:296
void fsion_get_fileno_c(int *sid, int *filenumber)
Fortran function that returns the current file number.
Definition: sion_fortran.c:465
void fsion_seek_c(int *sid, int *rank, int *currentblocknr, sion_int64 *posinblk, int *ierr)
Fortran procedure to set the file pointer to a new position.
Definition: sion_fortran.c:229
void fsion_endianness_swap_needed_c(int *sid, int *needed)
Fortran function that returns whether or not byte swapping is needed (1 -> needed,...
Definition: sion_fortran.c:512
void fsion_get_locations_c(int *sid, int *ntasks, int *maxblocks, sion_int64 *globalskip, sion_int64 *start_of_varheader, sion_int64 **sion_chunksizes, sion_int64 **sion_globalranks, sion_int64 **sion_blockcount, sion_int64 **sion_fsblksizes, int *ierr)
Fortran procedure that returns pointers to internal fields.
Definition: sion_fortran.c:323
void fsion_open_c(char *fname, char *file_mode, int *ntasks, int *nfiles, sion_int64 *chunksizes, sion_int32 *fsblksize, int *globalranks, int *sid, int fname_len, int file_mode_len)
Fortran procedure to open a sion file in serial mode.
Definition: sion_fortran.c:56
void fsion_get_file_endianness_c(int *sid, int *endianness)
Fortran function that returns endianness of a sion file (1-> big endian, 0 ->little endian)
Definition: sion_fortran.c:486
void fsion_flush_c(int *sid, int *ierr)
Fortran procedure to flush a sion file.
Definition: sion_fortran.c:277
void fsion_get_endianness_c(int *filenumber)
Fortran function that returns current endianness (1-> big endian, 0 ->little endian)
Definition: sion_fortran.c:499
sion_int64 fsion_get_position_c(int *sid)
Fortran function that returns the current file position.
Definition: sion_fortran.c:347
void fsion_open_rank_c(char *fname, char *file_mode, sion_int64 *chunksize, sion_int32 *fsblksize, int *rank, int *sid, int fname_len, int file_mode_len)
Fortran procedure to open a sion file for a specific rank.
Definition: sion_fortran.c:143
void fsion_swap_c(void *target, void *source, int *size, int *n, int *do_swap, int *rc)
Fortran procedure to swap endianness of data.
Definition: sion_fortran.c:536
void fsion_close_c(int *sid, int *ierr)
Fortran procedure to close a sion file.
Definition: sion_fortran.c:183
void fsion_ensure_free_space_c(int *sid, sion_int64 *bytes, int *ierr)
Fortran procedure to ensure that enough space is available.
Definition: sion_fortran.c:258