SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
Macros | Functions
sion_internal.h File Reference
#include <stdio.h>
#include "sion_const.h"
#include "sion_common.h"
#include "sion_datatypes.h"
#include "sion_filedesc.h"
Include dependency graph for sion_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _SION_READ_MASTER_ONLY_OF_MULTI_FILES   0
 
#define _SION_READ_ALL_OF_MULTI_FILES   1
 
#define _SION_SAFE_FREE(ptr, null)   {if (ptr) {free(ptr); ptr = null;}}
 
#define _SION_FMODE_WRITE   1024
 
#define _SION_FMODE_READ   2048
 
#define _SION_FMODE_ANSI   1
 
#define _SION_FMODE_POSIX   2
 
#define _SION_FMODE_BUFFERED   4
 
#define _SION_FMODE_COMPRESS   8
 
#define _SION_FMODE_COLLECTIVE   16
 
#define _SION_FMODE_COLLECTIVE_MERGE   32
 
#define _SION_FMODE_KEYVAL   64
 
#define _SION_FMODE_KEYVAL_INLINE   4096
 
#define _SION_FMODE_KEYVAL_META   8192
 
#define _SION_FMODE_KEYVAL_HASH   16384
 
#define _SION_FMODE_KEYVAL_NONE   32768
 
#define _SION_FMODE_KEYVAL_UNKNOWN   65536
 
#define _SION_FMODE_ENDIANNESS_SET   131072
 
#define _SION_FMODE_ENDIANNESS_BIG   262144
 
#define _SION_FMODE_BUDDY   524288
 

Functions

int _sion_open (const char *fname, const char *file_mode, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr)
 
int _sion_open_rank (const char *fname, const char *file_mode, sion_int64 *chunksize, sion_int32 *fsblksize, int *rank, FILE **fileptr)
 
int _sion_open_write (const char *fname, sion_int64 file_mode_flags, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr)
 internal sion serial open function for writing on one file More...
 
int _sion_open_read (const char *fname, sion_int64 file_mode_flags, int read_all, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr)
 internal sion serial open function for reading on one or more files More...
 
int _sion_open_read_single (const char *fname, sion_int64 file_mode_flags, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr, _sion_filedesc *sion_filedesc)
 
int _sion_open_read_master (const char *fname, sion_int64 file_mode_flags, int *ntasks, int *nfiles, sion_int64 **chunksizes, sion_int32 *fsblksize, int **globalranks, FILE **fileptr, _sion_filedesc *sion_filedesc)
 
int _sion_close (_sion_filedesc *sion_filedesc)
 
int _sion_create_new_block (_sion_filedesc *sion_filedesc)
 Create a new block for the internal data structure. More...
 
int _sion_flush_block (_sion_filedesc *sion_filedesc)
 Update the internal data structure. More...
 
int _sion_update_fileposition (_sion_filedesc *sion_filedesc)
 Update the internal data structure (check fileposition) More...
 
int _sion_check_on_collective_mode (_sion_filedesc *sion_filedesc)
 check if a collective operation are already called,
More...
 
char * _sion_get_multi_filename (const char *fname, int filenumber)
 generates the multi filename More...
 
sion_int32 _sion_get_endianness_with_flags (sion_int64 flags)
 Return endianness including possible choice via flags. More...
 
char * _sion_getenv (const char *name)
 
sion_io_stat_t_sion_alloc_io_info (int nfiles)
 allocates an io_info data structure for nfiles files More...
 
int _sion_free_io_info (sion_io_stat_t *p)
 frees an io_info data structure More...
 

Function Documentation

◆ _sion_alloc_io_info()

sion_io_stat_t* _sion_alloc_io_info ( int  p_nf)

allocates an io_info data structure for nfiles files

return flags

p: pointer to data structure

Definition at line 1211 of file sion_internal.c.

◆ _sion_check_on_collective_mode()

int _sion_check_on_collective_mode ( _sion_filedesc sion_filedesc)

check if a collective operation are already called,

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Return values
SION_SUCCESSif OK

Definition at line 1017 of file sion_internal.c.

◆ _sion_create_new_block()

int _sion_create_new_block ( _sion_filedesc sion_filedesc)

Create a new block for the internal data structure.

Parameters
sion_filedescsion file handle
Return values
SION_SUCCESSif OK

Definition at line 1089 of file sion_internal.c.

◆ _sion_flush_block()

int _sion_flush_block ( _sion_filedesc sion_filedesc)

Update the internal data structure.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Return values
1if OK

Definition at line 1050 of file sion_internal.c.

◆ _sion_free_io_info()

int _sion_free_io_info ( sion_io_stat_t p)

frees an io_info data structure

return flags: rc

Definition at line 1267 of file sion_internal.c.

◆ _sion_get_endianness_with_flags()

sion_int32 _sion_get_endianness_with_flags ( sion_int64  flags)

Return endianness including possible choice via flags.

return endianness

Definition at line 1158 of file sion_internal.c.

◆ _sion_get_multi_filename()

char* _sion_get_multi_filename ( const char *  fname,
int  filenumber 
)

generates the multi filename

Parameters
fnamefile name
filenumberfile number
Return values
pointerto new filename

Definition at line 929 of file sion_internal.c.

◆ _sion_getenv()

char* _sion_getenv ( const char *  name)

encapsulate getenv

Definition at line 1187 of file sion_internal.c.

◆ _sion_open_read()

int _sion_open_read ( const char *  fname,
sion_int64  file_mode_flags,
int  read_all,
int *  ntasks,
int *  nfiles,
sion_int64 **  chunksizes,
sion_int32 *  fsblksize,
int **  globalranks,
FILE **  fileptr 
)

internal sion serial open function for reading on one or more files

Parameters
[in]fnamename of file, should equal on all tasks
[in,out]file_mode_flagslike the type parameter of fopen (currently recognized options: "rb", "wb")
[in,out]read_all1 all files of a multi-file will be read, 0 only the master will read, incl. mapping
[in,out]ntasksnumber of tasks used to write this file
[in,out]nfilesnumber of physical files
[in,out]chunksizeschunksize for each task
[in,out]fsblksizeblocksize of filesystem, must be equal on all processors
[in]globalranksrank numbers for which the file should be open; will be stored in sion file, useful if comm is not MPI_COMM_WORLD typical: globalrank= rank in MPI_COMM_WORLD
[out]fileptrfilepointer for this task
Returns
sion file handle or -1 if error occured

Definition at line 266 of file sion_internal.c.

References _sion_alloc_filedesc().

◆ _sion_open_write()

int _sion_open_write ( const char *  fname,
sion_int64  file_mode_flags,
int *  ntasks,
int *  nfiles,
sion_int64 **  chunksizes,
sion_int32 *  fsblksize,
int **  globalranks,
FILE **  fileptr 
)

internal sion serial open function for writing on one file

Parameters
[in]fnamename of file, should equal on all tasks
[in,out]file_mode_flagslike the type parameter of fopen (currently recognized options: "rb", "wb")
[in,out]ntasksnumber of tasks used to write this file
[in,out]nfilesnumber of physical files
[in,out]chunksizeschunksize for each task
[in,out]fsblksizeblocksize of filesystem, must be equal on all processors
[in]globalranksrank numbers for which the file should be open; will be stored in sion file, useful if comm is not MPI_COMM_WORLD typical: globalrank= rank in MPI_COMM_WORLD
[out]fileptrfilepointer for this task
Return values
sidsion file handle or -1 if error occured

Definition at line 106 of file sion_internal.c.

◆ _sion_update_fileposition()

int _sion_update_fileposition ( _sion_filedesc sion_filedesc)

Update the internal data structure (check fileposition)

Update is only performed if file pointer is exported. The body of the function is skipped otherwise.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Return values
SION_SUCCESSif OK

Definition at line 984 of file sion_internal.c.