SIONlib
1.7.7
Scalable I/O library for parallel access to task-local files
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <sys/time.h>
#include "sion.h"
#include "sion_debug.h"
#include "sion_error_handler.h"
#include "sion_filedesc.h"
#include "sion_tools.h"
#include "sion_fd.h"
#include "sion_file.h"
#include "sion_metadata.h"
#include "sion_internal.h"
#include "sion_internal_seek.h"
#include "sion_hints.h"
#include "sion_printts.h"
#include "sion_buffer.h"
#include "sion_dup.h"
#include "sion_lock.h"
#include "sion_buddy_common.h"
Go to the source code of this file.
Macros | |
#define | _XOPEN_SOURCE 700 |
#define | DFUNCTION "sion_dup" |
#define | DFUNCTION "sion_dedup" |
#define | DFUNCTION "sion_lock_register_lock_callbacks" |
#define | DFUNCTION "sion_lock_user_callbacks_defined" |
Functions | |
sion_io_stat_t * | sion_get_io_info_buddy (int sid, int roles, int flag) |
int | sion_get_locations (int sid, int *ntasks, int *maxchunks, sion_int64 *globalskip, sion_int64 *start_of_varheader, sion_int64 **sion_chunksizes, sion_int64 **sion_globalranks, sion_int64 **sion_blockcount, sion_int64 **sion_blocksizes) |
Returns pointers to internal fields. More... | |
int | _sion_close_sid (int sid) |
int | sion_get_current_location (int sid, int *currentchunknr, sion_int64 *currentpos, int *maxchunks, sion_int64 **chunksizes) |
Returns current position in file and pointer fiels containing chunk sizes. More... | |
int | sion_get_mapping (int sid, int *mapping_size, sion_int32 **mapping, int *numfiles) |
Returns pointers to the internal field mapping. More... | |
int | sion_get_file_endianness (int sid) |
Returns edianness of data in file sid. More... | |
int | sion_endianness_swap_needed (int sid) |
Returns whether or not byte swapping is needed for sid. More... | |
int | sion_get_current_locations (int sid, int *ntasks, sion_int64 **sion_currentpos, sion_int64 **sion_currentblocknr) |
Returns current position in file and pointer fiels containing chunk sizes. More... | |
int | sion_get_number_of_files (int sid) |
int | sion_get_filenumber (int sid) |
int | sion_is_serial_opened (int sid) |
int | sion_using_hints (int sid) |
sion_int64 | sion_get_bytes_written (int sid) |
sion_int64 | sion_get_bytes_read (int sid) |
sion_io_stat_t * | sion_get_io_info (int sid) |
sion_io_stat_t * | sion_get_io_info_by_spec (int sid, int roles, int flag) |
int | sion_free_io_info (sion_io_stat_t *p) |
size_t | sion_fwrite (const void *data, size_t size, size_t nitems, int sid) |
Write data to sion file. More... | |
size_t | sion_fread (void *data, size_t size, size_t nitems, int sid) |
Read data from sion file. More... | |
int | sion_seek (int sid, int rank, int currentblocknr, sion_int64 posinblk) |
Function to set the file pointer to a new position. More... | |
int | sion_seek_fp (int sid, int rank, int currentblocknr, sion_int64 posinblk, FILE **fileptr) |
Deprecated. Use sion_seek() instead. More... | |
int | sion_feof (int sid) |
Function that indicates whether the end of file is reached for this task. More... | |
sion_int64 | sion_bytes_avail_in_block (int sid) |
Return the number of bytes available in the current chunk. More... | |
sion_int64 | sion_bytes_avail_in_chunk (int sid) |
Function that returns the number of bytes available in the current chunk. More... | |
sion_int64 | sion_get_position (int sid) |
Function that returns the current file position. More... | |
int | sion_set_fp_closed (int sid) |
int | sion_set_second_fp (int sid, FILE *secondfd) |
int | sion_unset_second_fp (int sid) |
int | sion_optimize_fp_buffer (int sid) |
int | sion_flush (int sid) |
Flushed sion file. More... | |
int | sion_ensure_free_space (int sid, sion_int64 bytes) |
Funtion to ensure that enough space is available for writing. More... | |
int | sion_is_thread_safe () |
int | sion_get_sizeof (int sid, int *numbytes, int *numfds) |
Function returns size of internal data structure for sid. More... | |
int | sion_dup (int sid, int mode, int rank, uint64_t key) |
Function which duplicates a sion file descriptor. More... | |
int | sion_dedup (int sid) |
Function which destroy a duplicated sion file descriptor. More... | |
int | sion_lock_register_lock_callbacks (int lock(void *), int unlock(void *), void *lock_data) |
Function which registers callback funtions for lock and unlock internal access to shared data structures. More... | |
int | sion_lock_user_callbacks_defined () |
Function which return flag, if user callback for locking are registered. More... | |
Common SIONlib functions
Definition in file sion_common.c.
sion_int64 sion_bytes_avail_in_block | ( | int | sid | ) |
Return the number of bytes available in the current chunk.
See sion_bytes_avail_in_block_description.
[in] | sid | sion file handle |
Definition at line 879 of file sion_common.c.
References sion_bytes_avail_in_chunk().
Referenced by fsion_bytes_avail_in_block_c().
sion_int64 sion_bytes_avail_in_chunk | ( | int | sid | ) |
Function that returns the number of bytes available in the current chunk.
This function returns the number of bytes remaining in the current chunk (bytes not read). It is a local function, which can be called independently from other MPI tasks.
[in] | sid | sion file handle |
Definition at line 894 of file sion_common.c.
Referenced by sion_bytes_avail_in_block().
int sion_dedup | ( | int | sid | ) |
Function which destroy a duplicated sion file descriptor.
[in] | sid | sion file handle |
Definition at line 1195 of file sion_common.c.
int sion_dup | ( | int | sid, |
int | mode, | ||
int | rank, | ||
uint64_t | key | ||
) |
Function which duplicates a sion file descriptor.
Restrictions:
[in] | sid | sion file handle |
[in] | mode | one of SION_DUP_ALL, SION_DUP_RANK, SION_DUP_RANK_KEY |
[in] | rank | dup only those part of the internal data struture which are needed to read rank rank from file |
[in] | key | dup only those part of the internal data struture which are needed to read on the rank rank data for key key from file |
Definition at line 1161 of file sion_common.c.
int sion_ensure_free_space | ( | int | sid, |
sion_int64 | bytes | ||
) |
Funtion to ensure that enough space is available for writing.
See sion_ensure_free_space_description
[in] | sid | sion file handle |
[in] | bytes | number of bytes requested for the next write operation |
Definition at line 1053 of file sion_common.c.
Referenced by fsion_ensure_free_space_c().
int sion_feof | ( | int | sid | ) |
Function that indicates whether the end of file is reached for this task.
[in] | sid | sion file handle (in) |
Definition at line 809 of file sion_common.c.
Referenced by fsion_feof_c().
int sion_flush | ( | int | sid | ) |
Flushed sion file.
[in] | sid | sion file handle |
Definition at line 1030 of file sion_common.c.
Referenced by fsion_flush_c().
sion_int64 sion_get_position | ( | int | sid | ) |
Function that returns the current file position.
This function returns an sion_int64 containing the current file possition.
[in] | sid | sion file handle (in) |
Definition at line 930 of file sion_common.c.
References _sion_vcdtovcon(), _sion_vcdtype(), and SION_FILEDESCRIPTOR.
Referenced by fsion_get_position_c().
int sion_get_sizeof | ( | int | sid, |
int * | numbytes, | ||
int * | numfds | ||
) |
Function returns size of internal data structure for sid.
[in] | sid | sion file handle |
[out] | numbytes | number of bytes used |
[out] | numfds | number of file descriptors used |
Definition at line 1123 of file sion_common.c.
int sion_lock_register_lock_callbacks | ( | int | lockvoid *, |
int | unlockvoid *, | ||
void * | lock_data | ||
) |
Function which registers callback funtions for lock and unlock internal access to shared data structures.
[in] | lock() | lock function |
[in] | unlock() | unlock function |
[in] | lock_data() | unlock function |
Definition at line 1220 of file sion_common.c.
int sion_lock_user_callbacks_defined | ( | void | ) |
Function which return flag, if user callback for locking are registered.
Definition at line 1239 of file sion_common.c.
int sion_seek | ( | int | sid, |
int | rank, | ||
int | currentblocknr, | ||
sion_int64 | posinblk | ||
) |
Function to set the file pointer to a new position.
See sion_seek_description .
[in] | sid | sion file handle |
[in] | rank | rank number of the process (SION_CURRENT_RANK to select the current rank) |
[in] | currentblocknr | block number (SION_CURRENT_BLK to select the current block) (SION_ABSOLUTE_POS gives an absolute position; SION_END_POS seeks relative to the end of the file) |
[in] | posinblk | position in the block (SION_CURRENT_POS to select the current position) |
SION_SUCCESS | if file pointer can be moved to new position |
Definition at line 698 of file sion_common.c.
References sion_seek_fp().
int sion_seek_fp | ( | int | sid, |
int | rank, | ||
int | currentblocknr, | ||
sion_int64 | posinblk, | ||
FILE ** | fileptr | ||
) |
Deprecated. Use sion_seek() instead.
See sion_seek_fp_description .
[in] | sid | sion file handle |
[in] | rank | rank number of the process (SION_CURRENT_RANK to select the current rank) |
[in] | currentblocknr | block number (SION_CURRENT_BLK to select the current block) |
[in] | posinblk | position in the block (SION_CURRENT_POS to select the current position) |
[out] | **fileptr | file pointer to corresponding file of a multi-file set |
SION_SUCCESS | if file pointer can be moved to new position |
Definition at line 721 of file sion_common.c.
Referenced by sion_seek().