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

### Installing SIONlib

The source code of sionlib is in the directory `./src` of the sion tar package. There are also serveral Makefiles for the different platform supported by sionlib.
The installation of sionlib builds (at least) two libraries:

`libsion.a`
  the parallel libraries currently supporting MPI
`libsionser.a`
  serial version of sionlib containing all function for the serial API of sionlib

It install also the parallel test program partest and the tree utilities siondump, sionsplit and siondefrag.

On platforms where the frontend node and computer has a different architecture a more complex build process is nedded due to limitation that the serial library and the (serial) utilities has to be compiled for the frontend node and the parallel library and the parallel test tool for the compute node. One example for such a platform is Blue Gene/P.

The Makefiles includes a definition section from Makefile_$(TYPE).defs . Usually it is only needed to adjust specifications in this files: e.g. INSTDIR=../install/sionlib (Installation dir) CC, F90, ... Compiler specifications
($TYPE -> see platform dependent description)

#### Platform Linux:

Files: Makefile_LINUX, Makefile_LINUX.defs

       > cd ./src;
       > edit Makefile_LINUX.defs and adapt parameters
       > gmake -f Makefile_LINUX
       > gmake -f Makefile_LINUX install

The default installation directory is `../install/sionlib_linux`

#### Platform Blue Gene/P:

Makefiles: Makefile_BE, Makefile_FE, Makefile_FEgcc
Configfiles: Makefile_BGP.defs, Makefile_BGP_FE.defs, Makefile_BGP_FEgcc.defs

       > cd ./src;
       > edit Makefile_*.defs and adapt parameters

##### Backend

       > gmake -f Makefile_BE
       > gmake -f Makefile_BE install
       > gmake -f Makefile_BE clean

default installation directory is `../install/sionlib_bgp`
files: `libsion.a, libsionser.a`

##### Frontend

       > gmake -f Makefile_FE
       > gmake -f Makefile_FE install
       > gmake -f Makefile_FE clean

default installation directory is `../install/sionlib_bgp`
files: `libsionfe.a, libsionserfe.a`

##### Frontend (gcc compiler)

       > gmake -f Makefile_FEgcc
       > gmake -f Makefile_FEgcc install
       > gmake -f Makefile_FEgcc clean

default installation directory: `../install/sionlib_bgp`
files: `libsionfegcc.a, libsionserfegcc.a`

#### Platform XT4:

Makefiles: Makefile_XT, Makefile_XT_FE
Configfiles: Makefile_XT.defs, Makefile_XT_FE.defs

       > cd ./src;
       > edit Makefile_*.defs and adapt parameters

##### Backend

       > gmake -f Makefile_BE
       > gmake -f Makefile_XT install
       > gmake -f Makefile_XT clean

default installation directory is `../install/sionlib_bgp`
files: `libsion.a, libsionser.a`

##### Frontend

       > gmake -f Makefile_XT_FE
       > gmake -f Makefile_XT_FE install
       > gmake -f Makefile_XT_FE clean

default installation directory is `../install/sionlib_bgp`
files: `libsionfe.a, libsionserfe.a`

### Debugging SIONlib I/O

if SIONlib is compiled with `-DSION_DEBUG` the library supports debugging of SIONlib related I/O events. There are four environment variables steering SIONlib debugging:

`SION_DEBUG=file`
  enables debugging, debug messages will be written to file. `stdout` or `stderr` ae also possible.
`SION_DEBUG_MASK=mask`
  sets binary mask for selecting debug messages. The mask works bitwise, following debugging messages levels could be selected, by adding level to mask:
  1
    sion user function entries and exits
  2
    sion internal function entries and exits
  8
    high frequently called sion user function entries and exits
    (sion_feof, sion_ensure_free_space, ...)
  16
    high frequently called sion user function entries and exits (internal steps)
  32
    high frequently called sion internal function (internal steps)
  128
    timings (top level)
  256
    timings (low level)
  512
    Scalasca elg-lib
  1024
    Compression gz-lib
  2048
    higher frequently called sion internal function (internal steps)
`SION_DEBUG_RANK1=rank`
  selects first rank of parallel program for printing debug messages. Rank number will be appended to filename specified in SION_DEBUG.
`SION_DEBUG_RANK2=rank`
  selects second rank of parallel program for printing debug messages. Rank number will be appended to filename specified in SION_DEBUG.

### Error messages of SIONlib

There are different level of error message levels (SION_ERROR_RETURN, SION_ERROR_WARN, SION_ERROR_ABORT, SION_ERROR_UNKNOWN). Depending on the level a warning message will be printed, the corresponding call will be returned with 0 or negative return code, or the program will be aborted. To limit the messages to one rank of a parallel program following environment variable could be set:

`SION_ERROR_MSG_RANK=rank`
  selects one rank of parallel program for printing warning/error messages.