SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
Macros | Functions
sion_buffer.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "sion.h"
#include "sion_debug.h"
#include "sion_error_handler.h"
#include "sion_internal.h"
#include "sion_buffer.h"
Include dependency graph for sion_buffer.c:

Go to the source code of this file.

Macros

#define _XOPEN_SOURCE   700
 
#define DFUNCTION   "_sion_buffer_check_env"
 
#define DFUNCTION   "_sion_buffer_init"
 
#define DFUNCTION   "_sion_buffer_push"
 
#define DFUNCTION   "_sion_buffer_get_data_ptr"
 
#define DFUNCTION   "_sion_buffer_flush"
 

Functions

int _sion_buffer_check_env (_sion_filedesc *sion_filedesc)
 Checks if environment variables are set to use buffer. More...
 
int _sion_buffer_init (_sion_filedesc *sion_filedesc)
 Allocate and initalize the buffer. More...
 
sion_int64 _sion_buffer_push (_sion_filedesc *sion_filedesc, const void *data, sion_int64 bytes)
 Push data to buffer. More...
 
int _sion_buffer_get_data_ptr (_sion_filedesc *sion_filedesc, void **data, sion_int64 *bytes)
 Pop all data from buffer. More...
 
int _sion_buffer_flush (_sion_filedesc *sion_filedesc)
 Flush buffer. More...
 

Detailed Description

This functions control and manage a memory based buffer for sion files. Depending on a set of environment variables the buffer will work as write-through or as write-back buffer. On Unix systems a POSIX shared memory segment will be used, on Blue Gene/P it is persistent memory.

A buffer of n MB will store the last n MB of data per task in the buffer. If the buffer memory is filled, the full buffer will be written to disk and the buffer will be exhausted.

Definition in file sion_buffer.c.

Function Documentation

◆ _sion_buffer_check_env()

int _sion_buffer_check_env ( _sion_filedesc sion_filedesc)

Checks if environment variables are set to use buffer.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Returns
SION_SUCCESS if env could be checked

Definition at line 60 of file sion_buffer.c.

◆ _sion_buffer_flush()

int _sion_buffer_flush ( _sion_filedesc sion_filedesc)

Flush buffer.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Returns
SION_SUCCESS if ok

Definition at line 177 of file sion_buffer.c.

◆ _sion_buffer_get_data_ptr()

int _sion_buffer_get_data_ptr ( _sion_filedesc sion_filedesc,
void **  data,
sion_int64 *  bytes 
)

Pop all data from buffer.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
*datapointer to data
*bytesnumber of bytes in buffer
Returns
1 if there is data to process 0 not data in buffer

Definition at line 152 of file sion_buffer.c.

References _sion_filedesc_struct::buffer, and _sion_filedesc_struct::buffer_ptr.

◆ _sion_buffer_init()

int _sion_buffer_init ( _sion_filedesc sion_filedesc)

Allocate and initalize the buffer.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
Returns
SION_SUCCESS if ok

Definition at line 81 of file sion_buffer.c.

◆ _sion_buffer_push()

sion_int64 _sion_buffer_push ( _sion_filedesc sion_filedesc,
const void *  data,
sion_int64  bytes 
)

Push data to buffer.

Parameters
*sion_filedescsion file description struct (_sion_filedesc)
*datapointer to data
*bytesnumber of bytes to push
Returns
number of bytes stored

Definition at line 106 of file sion_buffer.c.