SIONlib  2.0.0-rc.2
Scalable I/O library for parallel access to task-local files
Typedefs | Functions
Serial API

Open (and close) SIONlib files from a single task. More...

Typedefs

typedef struct sion_options sion_options
 Holds non-essential arguments for sion_open(). More...
 
typedef struct sion_rank_options sion_rank_options
 Holds non-essential arguments for sion_open_rank(). More...
 

Functions

int sion_open (const char *fname, sion_open_mode mode, int n, const sion_options *options)
 Open a SIONlib container in serial mode. More...
 
int sion_open_rank (const char *fname, sion_open_mode mode, int rank, const sion_rank_options *options)
 Open a single logical file in a SIONlib container. More...
 
int sion_close (int sid)
 Close a SIONlib file. More...
 
sion_optionssion_options_new (void)
 Allocates and initializes an instance of sion_options More...
 
void sion_options_delete (sion_options *options)
 Delete an instance of sion_options More...
 
void sion_options_set_chunksizes (sion_options *options, int n, const int64_t chunksizes[])
 Set the chunk sizes of all logical files in the container. More...
 
void sion_options_set_fsblksize (sion_options *options, int32_t fsblksize)
 Set the file system block size to assume. More...
 
void sion_options_set_keyval_mode (sion_options *options, sion_keyval_mode keyval_mode)
 Set the key-value mode to use for a container. More...
 
void sion_options_set_lowlevel_api (sion_options *options, sion_lowlevel_api lowlevel_api)
 Set the low-level API to use for opening a container. More...
 
void sion_options_set_endianness (sion_options *options, sion_endianness endianness)
 Set the endianness for the contents of a container. More...
 
sion_rank_optionssion_rank_options_new (void)
 Allocates and initializes an instance of sion_rank_options More...
 
void sion_rank_options_delete (sion_rank_options *options)
 Delete an instance of sion_rank_options More...
 
void sion_rank_options_set_lowlevel_api (sion_rank_options *options, sion_lowlevel_api lowlevel_api)
 Set the low-level API to use for opening a container. More...
 

Detailed Description

Open (and close) SIONlib files from a single task.

Typedef Documentation

◆ sion_options

typedef struct sion_options sion_options

Holds non-essential arguments for sion_open().

These are:

  • the sizes of chunks for each logical file,
  • the size of a file system block to assume,
  • whether and in what mode to use SIONlib's key-value mechanism,
  • what low-level API to use for file system access,
  • the endianness of user data in the file.

Definition at line 33 of file sion_serial.h.

◆ sion_rank_options

Holds non-essential arguments for sion_open_rank().

Currently, only the low-level API to use for file system access can be selected.

Definition at line 38 of file sion_serial.h.

Function Documentation

◆ sion_close()

int sion_close ( int  sid)

Close a SIONlib file.

This function closes a SIONlib file which was opened in serial mode with sion_open() or sion_open_rank(). In write mode this function will also save all meta data to the meta data block of the SIONlib file.

The function is a task local function, which can be called independently from other MPI tasks.

Parameters
[in]sidSIONlib file handle
Returns
SION_SUCCESS if close is ok

Definition at line 102 of file sion_serial.c.

◆ sion_open()

int sion_open ( const char *  fname,
sion_open_mode  mode,
int  n,
const sion_options options 
)

Open a SIONlib container in serial mode.

This function opens all logical files of a SIONlib container in serial mode. The meta-data of all logical files will be loaded into memory, which allows accessing different logical files by using sion_switch_logical_file(). Default position of the file pointer is in front of the first byte of the first logical file

In the case of multi-file containers sion_open() internally opens each physical file with sion_open() recursively. For each physical file SIONlib manages an individual file descriptor and data structure.

Parameters
[in]fnamename of the container to open
[in]modemode in which to open the container
[in]nnumber of logical files in the container (only significant upon container creation)
[in]optionsprovide additional options, or NULL
Returns
a handle to the open file or -1 in case an error occurred

Definition at line 61 of file sion_serial.c.

◆ sion_open_rank()

int sion_open_rank ( const char *  fname,
sion_open_mode  mode,
int  rank,
const sion_rank_options options 
)

Open a single logical file in a SIONlib container.

This function opens single logical file in a container. It can be used to open the container independently from each task (e.g. if no MPI is available or only a subset of tasks need access).

Using this function the meta data at the beginning of the container is read by each task instead of just once and distributed (sion_paropen_XYZ). sion_open_rank() only reads the meta data that pertains to the selected logical file.

Warning
Only read operations are currently supported.
Parameters
[in]fnamename of the container to open
[in]modemode in which to open the container
[in]ranknumber of logical file to open in the container
[in]optionsprovide additional options, or NULL
Returns
a handle to the open file or -1 in case an error occurred

Definition at line 97 of file sion_serial.c.

◆ sion_options_delete()

void sion_options_delete ( sion_options options)

Delete an instance of sion_options

Parameters
[in]optionsa pointer to the instance to delete

Definition at line 30 of file sion_serial.c.

◆ sion_options_new()

sion_options* sion_options_new ( void  )

Allocates and initializes an instance of sion_options

Returns
a pointer to the new instance or NULL if allocation failed

Definition at line 21 of file sion_serial.c.

◆ sion_options_set_chunksizes()

void sion_options_set_chunksizes ( sion_options options,
int  n,
const int64_t  chunksizes[] 
)

Set the chunk sizes of all logical files in the container.

Parameters
[in,out]optionsan options object
[in]nnumber of logical files in the container
[in]chunksizeschunk sizes for all logical files in the container

Definition at line 35 of file sion_serial.c.

◆ sion_options_set_endianness()

void sion_options_set_endianness ( sion_options options,
sion_endianness  endianness 
)

Set the endianness for the contents of a container.

Parameters
[in,out]optionsan options object
[in]endiannessthe endianness of the contents

Definition at line 56 of file sion_serial.c.

◆ sion_options_set_fsblksize()

void sion_options_set_fsblksize ( sion_options options,
int32_t  fsblksize 
)

Set the file system block size to assume.

Parameters
[in,out]optionsan options object
[in]fsblksizethe file system block size

Definition at line 41 of file sion_serial.c.

◆ sion_options_set_keyval_mode()

void sion_options_set_keyval_mode ( sion_options options,
sion_keyval_mode  keyval_mode 
)

Set the key-value mode to use for a container.

Parameters
[in,out]optionsan options object
[in]keyval_modethe key-value mode to use

Definition at line 46 of file sion_serial.c.

◆ sion_options_set_lowlevel_api()

void sion_options_set_lowlevel_api ( sion_options options,
sion_lowlevel_api  lowlevel_api 
)

Set the low-level API to use for opening a container.

Parameters
[in,out]optionsan options object
[in]lowlevel_apithe low-level API to use

Definition at line 51 of file sion_serial.c.

◆ sion_rank_options_delete()

void sion_rank_options_delete ( sion_rank_options options)

Delete an instance of sion_rank_options

Parameters
[in]optionsa pointer to the instance to delete

Definition at line 87 of file sion_serial.c.

◆ sion_rank_options_new()

sion_rank_options* sion_rank_options_new ( void  )

Allocates and initializes an instance of sion_rank_options

Returns
a pointer to the new instance or NULL if allocation failed

Definition at line 78 of file sion_serial.c.

◆ sion_rank_options_set_lowlevel_api()

void sion_rank_options_set_lowlevel_api ( sion_rank_options options,
sion_lowlevel_api  lowlevel_api 
)

Set the low-level API to use for opening a container.

Parameters
[in,out]optionsan options object
[in]lowlevel_apithe low-level API to use

Definition at line 92 of file sion_serial.c.