SIONlib: Scalable I/O library for parallel access to task-local files

SIONlib File data format

General structure of a sion file:

[file_layou]

All starting positions of the blocks are aligned to the filesystem blocksize
(e.g. 2 MB GPFS). The first meta data block META1 contains all static meta data
which is independent from the number of chunks. The second meta data block is
located at the end of the sion file and contains the data which depends on the
number of chunks written by each task. The first meta block will mainly be
written while opening the sion file, the second meta data block will be written
while closing the file. Each BLOCK contains one chunk of space for each task
according to the chunksize specified in sion_open(). All chunks are aligned to
the filesystem blocksize. There could be gaps between chunks if the requested
chunksize is not divisible by the fs blocksize. The size of such a BLOCK
including the space for additional alignment space is internally stored in the
variable globalskip (see also sion_get_locations).
If a task has reached the end of a chunk while writing data,
sion_ensure_free_space will move the filepointer for this task to the next
BLOCK. The new position is globalskip bytes from the starting position of the
current block and can be computed locally without communication to other tasks.
The information how many chunks are used and how many bytes are written in each
chunk will be stored in memory until sion_close() is called. This function
collects these information from all tasks to task 0 and task 0 writes the data
to META2.


Structure of the first meta data block META1:


                                                identification
       4 bytes:           'sion' char*          of sion file
                                                format
                                 for
4      0001               int    identification
bytes:                           of little/big
                                 endianess
4                                version number
bytes: version            int    of used sion
                                 library
4                                patch level of
bytes: version_patchlevel int    used sion
                                 library
4                                version of
bytes: fileformat_version int    sion file
                                 format
                                 fs blocksize
4      blocksize          int    used for
bytes:                           access to this
                                 file
4                                number of
bytes: ntasks             int    tasks wrote to
                                 this file
4      nfiles             int    number of
bytes:                           physical files
4                                number of
bytes: filenumber         int    current
                                 physical files
8      flag1              int    not used
bytes:                           currently
8      flag2              int    not used
bytes:                           currently
                                 prefix of
1024   filenameprefix     char*  filename (for
bytes:                           multi-file
                                 support)

8                                global unique
bytes: globalrank(1)      long   id for this
                                 task 1
...
8                                global unique
bytes: globalrank(numpe)  long   id for this
                                 task numpe
8                                chunksize
bytes: size(1)            long   requested by
                                 processor 1
...
                                 chunksize
8      size(numpe)        long   requested by
bytes:                           processor
                                 numpe
4      maxchunks          int    maximum number
bytes:                           of chunks used
8      start_of_varheader long   start position
bytes:                           of META2


Structure of the second meta data block META2:


                                  number
                                  of
       8 bytes:  chunks long      chunks
                 (1)              written
                                  from
                                  task 1
...
                        number of
8      chunks           chunks
bytes: (numpe)   long   written
                        from task
                        numpe
                        number of
                        bytes
8      chunksize long   written
bytes: (1)              in chunk
                        1 from
                        task 1
...
                        number of
                        bytes
8      chunksize        written
bytes: (numpe)   long   in chunk
                        1 from
                        task
                        numpe
                        number of
                        bytes
8      chunksize long   written
bytes: (1)              in chunk
                        2 from
                        task 1
...
                        number of
                        bytes
8      chunksize        written
bytes: (numpe)   long   in chunk
                        2 from
                        task
                        numpe
...
                        number of
                        bytes
8      chunksize long   written
bytes: (1)              in chunk
                        n from
                        task 1
...
                        number of
                        bytes
8      chunksize        written
bytes: (numpe)   long   in chunk
                        n from
                        task
                        numpe
                        If a
                        chunk was
                        not used
                        by a
                        specific
                        task the
                        chunksize
                        value is
                        set to
                        -1.


mapping: if multi-file used (only in first physical file)


                                         number
       4 bytes:      mapping_size int    of
                                         global
                                         ranks
                                  file
                                  number
8      fnr(1),lrank               and
bytes: (1)           2*int        local
                                  for
                                  global
                                  rank 1
...
                                  file
                                  number
       fnr                        and
8      (numpe),lrank 2*int        local
bytes: (numpe)                    for
                                  global
                                  rank
                                  numpe

