SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
sion_filedesc.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 
14 #ifndef SION_SION_FILEDESC_H
15 #define SION_SION_FILEDESC_H
16 
17 #include "sion_const.h"
18 #include "sion_datatypes.h"
19 #include "sion_file.h"
20 
21 #define _SION_FLAG1_NONE 0
22 #define _SION_FLAG2_NONE 0
24 #define _SION_FLAG1_USECACHE 2
27 #define SION_FILESTATE_UNKNOWN -1
28 #define SION_FILESTATE_PAROPEN 0
29 #define SION_FILESTATE_SEROPEN 1
30 #define SION_FILESTATE_SEROPENRANK 2
31 #define SION_FILESTATE_SEROPENMASTER 3
32 #define SION_FILESTATE_PAROPENMAPPEDMASTER 4
33 #define SION_FILESTATE_PAROPENMAPPEDMANAGED 5
34 #define SION_FILESTATE_PAROPENMAPPED 6
35 #define SION_FILESTATE_CLOSE 10
36 #define SION_FILEMODE_UNKNOWN -20
37 #define SION_FILEMODE_READ 20
38 #define SION_FILEMODE_WRITE 30
40 #define SION_CACHE_TODISK 40
41 #define SION_CACHE_TOMEM 41
42 #define SION_CACHE_UNKNOWN 42
43 #define SION_CACHE_FNLEN 16
45 #define SION_DESCSTATE_ORIG 200
46 #define SION_DESCSTATE_DUP 201
47 #define SION_DESCSTATE_DUP_SEL_RANK 202
48 #define SION_DESCSTATE_DUP_SEL_RANK_KEY 203
50 #define SION_HINTS_TYPE_UNKNOWN 160
51 #define SION_HINTS_TYPE_LINUX 161
52 #define SION_HINTS_TYPE_GPFS 162
54 #define SION_CAPABILITY_FULL 50
55 #define SION_CAPABILITY_ONLY_SENDER 51
56 #define SION_CAPABILITY_NONE 52
58 #define _SION_DEBUG_PRINT_ALL 1
59 #define _SION_DEBUG_PRINT_RECURSIVE 2
60 
65 
80 
81  /* file pointer and temporary data */
83  void* dataptr;
84  void* keyvalptr;
85  sion_int32 debug;
86  sion_int32 sid;
87  char* fpbuffer;
88  sion_int32 fpbuffer_size;
89  sion_int32 usebuffer;
90  char* buffer;
91  sion_int32 buffer_size;
92  sion_int32 buffer_ptr;
94  /* current position in file */
95  sion_int32 rank;
96  sion_int64 currentpos;
97  sion_int32 currentblocknr;
99  /* data for one task */
100  sion_int64 *blocksizes;
101  sion_int32 lastchunknr;
102  sion_int64 startpos;
104  /* meta header data in file */
105  char *fname;
106  sion_int32 globalrank;
107  sion_int32 ntasks;
108  sion_int32 state;
109  sion_int32 mode;
110  sion_int32 endianness;
114  sion_int32 swapbytes;
115  sion_int32 filesionversion;
116  sion_int32 filesionpatchlevel;
117  sion_int32 fileversion;
118  sion_int32 fsblksize;
119  sion_int32 maxchunks;
120  sion_int64 flag1;
121  sion_int64 flag2;
122  sion_int64 chunksize;
123  sion_int64 chunksize_req;
124  sion_int64 globalskip;
125  sion_int64 end_of_header;
126  sion_int64 start_of_varheader;
127  sion_int64 start_of_data;
128  sion_int32 nfiles;
129  sion_int32 filenumber;
130  sion_int32 maxusedchunks;
132  /* dupped filedesc */
133  sion_int32 dup_mode;
134  sion_int32 dup_sel_rank;
135  sion_uint64 dup_sel_key;
137  /* mapped files */
138  sion_int32 lrank;
139  sion_int32 ntotaltasksinfile;
140  sion_int32 nlocaltasksinfile;
141  sion_int32 filemanagedbytask;
143  /* all tasks */
144  sion_int64 *all_chunksizes;
145  sion_int64 *all_globalranks;
146  sion_int64 *all_localranks;
147  sion_int64 *all_startpointers;
148  sion_int64 *all_currentpos;
149  sion_int64 *all_currentblocknr;
150  sion_int32 *all_coll_collector;
151  sion_int32 *all_coll_collsize;
152  sion_int32 *all_coll_capability;
154  void **all_keyvalptr;
156  /* all tasks, all chunks */
157  sion_int64 *all_blockcount;
158  sion_int64 *all_blocksizes;
160  /* multi-file */
161  sion_int32 mapping_size;
162  sion_int32 *mapping;
163  char *prefix;
166  /* compression */
167  sion_int32 compress;
169  /* Key-value */
170  sion_int32 keyvalmode;
172  /* persistent cache */
173  sion_int32 usecache;
174  sion_int32 cachesize;
175  sion_int32 cacheid;
177  sion_int32 cachemode;
178  char* cacheptr;
180  /* collective I/O */
181  sion_int32 usecoll;
182  sion_int32 collsize;
183  sion_int32 collector;
184  sion_int32 coll_capability;
185  sion_int32 colldebug;
186  sion_int32 collcmdused;
187  sion_int32 fileptr_exported;
188  sion_int32 collmergemode;
189  sion_int32 collmsa;
191  /* buddy */
192  sion_int32 usebuddy;
193  sion_int32 buddylevel;
194  sion_int32 buddynr;
195  void *buddies;
197  /* hints */
198  sion_int32 usehints;
199  sion_int32 hinttype;
201 };
202 
204 int _sion_init_filedesc( _sion_filedesc *sion_filedesc );
205 int _sion_print_filedesc( _sion_filedesc *sion_filedesc, int level, char *desc, int all );
206 int _sion_free_filedesc( _sion_filedesc *sion_filedesc );
207 int _sion_realloc_filedesc_blocklist( _sion_filedesc *sion_filedesc, sion_int32 maxchunks );
208 
209 int _sion_alloc_filedesc_all_chunksizes(_sion_filedesc *sion_filedesc);
210 int _sion_alloc_filedesc_all_startpointers(_sion_filedesc *sion_filedesc);
211 int _sion_alloc_filedesc_all_globalranks(_sion_filedesc *sion_filedesc);
212 int _sion_alloc_filedesc_all_localranks(_sion_filedesc *sion_filedesc);
213 int _sion_alloc_filedesc_arrays( _sion_filedesc *sion_filedesc );
214 int _sion_alloc_filedesc_all_keyvalptr(_sion_filedesc *sion_filedesc);
215 
216 int _sion_free_filedesc_arrays( _sion_filedesc *sion_filedesc );
217 int _sion_free_filedesc_all_chunksizes(_sion_filedesc *sion_filedesc);
218 int _sion_free_filedesc_all_globalranks(_sion_filedesc *sion_filedesc);
219 int _sion_free_filedesc_all_startpointers(_sion_filedesc *sion_filedesc);
220 int _sion_free_filedesc_all_localranks(_sion_filedesc *sion_filedesc);
221 int _sion_free_filedesc_all_keyvalptr(_sion_filedesc *sion_filedesc);
222 
223 
224 
227 
230 
231 int _sion_alloc_filedesc_arrays_mapped(_sion_filedesc *sion_filedesc);
232 int _sion_alloc_filedesc_block_arrays_mapped(_sion_filedesc *sion_filedesc);
233 
234 char* _sion_fileptrflags_to_str (unsigned int flag);
235 int _sion_get_size_of_filedesc(_sion_filedesc *sion_filedesc, int *numbytes, int *numfds);
236 
238 
239 
240 #endif
int _sion_alloc_filedesc_block_arrays_only(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion structure, fields for all chunksizes of all tasks.
int _sion_print_filedesc(_sion_filedesc *sion_filedesc, int level, char *desc, int all)
Print the initialized sion file description.
int _sion_init_filedesc(_sion_filedesc *sion_filedesc)
Initialize the sion file description.
Definition: sion_filedesc.c:37
int _sion_realloc_filedesc_blocklist(_sion_filedesc *sion_filedesc, sion_int32 maxchunks)
Increase the memory used by the internal sion structure for the blocklist.
int _sion_alloc_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
int _sion_get_size_of_filedesc(_sion_filedesc *sion_filedesc, int *numbytes, int *numfds)
get size of internal data structure sion_filedesc
int _sion_alloc_filedesc_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion arrays.
char * _sion_fileptrflags_to_str(unsigned int flag)
Definition: sion_file.c:1550
_sion_filedesc * _sion_dup_filedesc(_sion_filedesc *sion_filedesc)
duplicates a filedesc data structure, not copying/reopen active file pointers
int _sion_free_filedesc_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
_sion_filedesc * _sion_alloc_filedesc(void)
Allocates memory for internal sion structure.
int _sion_free_filedesc_coll_arrays(_sion_filedesc *sion_filedesc)
free memory for the internal sion arrays
int _sion_alloc_filedesc_block_arrays(_sion_filedesc *sion_filedesc)
Allocate memory for the internal sion structure, fields for all chunksizes of all tasks.
#define SION_CACHE_FNLEN
Definition: sion_filedesc.h:43
Sion File Descriptor Structure.
Definition: sion_filedesc.h:79
sion_int64 * all_localranks
sion_int64 * all_blocksizes
char cachefn[SION_CACHE_FNLEN]
sion_int32 * all_coll_collsize
sion_int32 * all_coll_collector
sion_int32 filesionversion
sion_int32 nlocaltasksinfile
sion_int64 start_of_varheader
sion_int32 filesionpatchlevel
sion_int64 * all_chunksizes
sion_int64 * all_currentpos
sion_int64 * blocksizes
sion_int32 filemanagedbytask
sion_int64 * all_currentblocknr
sion_int32 fileptr_exported
_sion_filedesc ** multifiles
sion_int64 * all_globalranks
sion_int32 ntotaltasksinfile
sion_int32 currentblocknr
Definition: sion_filedesc.h:97
sion_int32 fpbuffer_size
Definition: sion_filedesc.h:88
sion_int32 * all_coll_capability
_sion_fileptr * fileptr
Definition: sion_filedesc.h:82
sion_int32 coll_capability
sion_int64 * all_startpointers
sion_int64 * all_blockcount