SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
Macros | Functions
sion_internal.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include "sion.h"
#include "sion_debug.h"
#include "sion_error_handler.h"
#include "sion_internal.h"
#include "sion_metadata.h"
#include "sion_filedesc.h"
#include "sion_tools.h"
#include "sion_fd.h"
#include "sion_file.h"
#include "sion_hints.h"
#include "sion_printts.h"
#include "sion_keyvalue.h"
#include "sion_buffer.h"
#include "sion_flags.h"
#include "sion_internal_startptr.h"
Include dependency graph for sion_internal.c:

Go to the source code of this file.

Macros

#define _XOPEN_SOURCE   700
 
#define DFUNCTION   "_sion_getenv"
 

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_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_open_rank (const char *fname, const char *file_mode, sion_int64 *chunksize, sion_int32 *fsblksize, int *rank, FILE **fileptr)
 
int _sion_close (_sion_filedesc *sion_filedesc)
 
char * _sion_get_multi_filename (const char *fname, int filenumber)
 generates the multi filename More...
 
int _sion_flush_file (int sid)
 Flush the data to the disk for the current task. 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...
 
int _sion_flush_block (_sion_filedesc *sion_filedesc)
 Update the internal data structure. More...
 
int _sion_create_new_block (_sion_filedesc *sion_filedesc)
 Create a new block for the internal data structure. 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 p_nf)
 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_flush_file()

int _sion_flush_file ( int  sid)

Flush the data to the disk for the current task.

Parameters
sidsion file handle
Return values
SION_SUCCESSif OK

Definition at line 960 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.