libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sc_scda.h
Go to the documentation of this file.
1 /*
2  This file is part of the SC Library.
3  The SC Library provides support for parallel scientific applications.
4 
5  Copyright (C) 2010 The University of Texas System
6  Additional copyright (C) 2011 individual authors
7 
8  The SC Library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation; either
11  version 2.1 of the License, or (at your option) any later version.
12 
13  The SC Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with the SC Library; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  02110-1301, USA.
22 */
23 
202 #ifndef SC_SCDA_H
203 #define SC_SCDA_H
204 
205 #include <sc_containers.h>
206 #include <sc_random.h>
207 
208 SC_EXTERN_C_BEGIN;
209 
210 #define SC_SCDA_HEADER_BYTES 128
211 #define SC_SCDA_USER_STRING_BYTES 58
212 #define SC_SCDA_INLINE_FIELD 32
215 typedef struct sc_scda_fcontext sc_scda_fcontext_t;
216 
218 typedef uint64_t sc_scda_ulong;
219 
225 typedef enum sc_scda_ret
226 {
228  SC_SCDA_FERR_FORMAT = 15000,
259 }
261 
279 typedef struct sc_scda_ferror
280 {
281  /* *INDENT-OFF* */
282  int mpiret;
287  /* *INDENT-ON* */
288 }
290 
298 typedef struct sc_scda_params
299 {
301  unsigned fuzzy_everyn;
317  int log_level;
320 }
329 
384  const char *filename,
385  const char *user_string, size_t *len,
386  sc_scda_params_t * params,
387  sc_scda_ferror_t * errcode);
388 
432  const char *user_string,
433  size_t *len,
434  sc_array_t * inline_data, int root,
435  sc_scda_ferror_t * errcode);
436 
498  const char *user_string,
499  size_t *len,
500  sc_array_t * block_data,
501  size_t block_size, int root,
502  int encode,
503  sc_scda_ferror_t * errcode);
504 
583  const char *user_string,
584  size_t *len,
585  sc_array_t * array_data,
586  sc_array_t * elem_counts,
587  size_t elem_size, int indirect,
588  int encode,
589  sc_scda_ferror_t * errcode);
590 
620 int sc_scda_proc_sizes (sc_array_t * elem_sizes,
621  sc_array_t * elem_counts,
622  sc_array_t * proc_sizes,
623  sc_scda_ferror_t * errcode);
624 
715  const char *user_string,
716  size_t *len,
717  sc_array_t * array_data,
718  sc_array_t * elem_counts,
719  sc_array_t * elem_sizes,
720  sc_array_t * proc_sizes,
721  int indirect, int encode,
722  sc_scda_ferror_t * errcode);
723 
769  const char *filename,
770  char *user_string, size_t *len,
771  sc_scda_params_t * params,
772  sc_scda_ferror_t * errcode);
773 
840  char *user_string,
841  size_t *len, char *type,
842  size_t *elem_count,
843  size_t *elem_size,
844  int *decode,
845  sc_scda_ferror_t * errcode);
846 
881  sc_array_t * data, int root,
882  sc_scda_ferror_t * errcode);
883 
923  sc_array_t * block_data,
924  size_t block_size, int root,
925  sc_scda_ferror_t * errcode);
926 
987  sc_array_t * array_data,
988  sc_array_t * elem_counts,
989  size_t elem_size,
990  int indirect,
991  sc_scda_ferror_t * errcode);
992 
1041  sc_array_t * elem_sizes,
1042  sc_array_t * elem_counts,
1043  sc_scda_ferror_t * errcode);
1044 
1120  sc_array_t * array_data,
1121  sc_array_t * elem_counts,
1122  sc_array_t * elem_sizes,
1123  sc_array_t * proc_sizes,
1124  int indirect,
1125  sc_scda_ferror_t * errcode);
1126 
1148  sc_scda_ferror_t * errclass);
1149 
1157 
1169  char *str, int *len);
1170 
1196  sc_scda_ferror_t * errcode);
1197 
1198 SC_EXTERN_C_END;
1199 
1200 #endif /* SC_SCDA_H */
Dynamic containers such as lists, arrays, and hash tables.
sc3_MPI_Comm_t sc_MPI_Comm
Emulate an MPI communicator.
Definition: sc_mpi.h:450
sc3_MPI_Info_t sc_MPI_Info
Emulate an MPI Info object.
Definition: sc_mpi.h:451
Provide pseudo-random generator and Poisson sampling.
uint64_t sc_rand_state_t
The internal state of sc_rand and derived functions.
Definition: sc_random.h:36
int sc_scda_ferror_class(sc_scda_ferror_t errcode, sc_scda_ferror_t *errclass)
Translate a sc_scda error code to an error class.
sc_scda_fcontext_t * sc_scda_fread_inline_data(sc_scda_fcontext_t *fc, sc_array_t *data, int root, sc_scda_ferror_t *errcode)
Read the data of an inline data section.
int sc_scda_ferror_string(sc_scda_ferror_t errcode, char *str, int *len)
Translate a sc_scda error code/class to an error string.
sc_scda_fcontext_t * sc_scda_fopen_write(sc_MPI_Comm mpicomm, const char *filename, const char *user_string, size_t *len, sc_scda_params_t *params, sc_scda_ferror_t *errcode)
Open a file for writing and write the file header to the file.
sc_scda_fcontext_t * sc_scda_fread_varray_data(sc_scda_fcontext_t *fc, sc_array_t *array_data, sc_array_t *elem_counts, sc_array_t *elem_sizes, sc_array_t *proc_sizes, int indirect, sc_scda_ferror_t *errcode)
Read the data of a variable-size array.
sc_scda_fcontext_t * sc_scda_fread_block_data(sc_scda_fcontext_t *fc, sc_array_t *block_data, size_t block_size, int root, sc_scda_ferror_t *errcode)
Read the data of a block of given size.
sc_scda_fcontext_t * sc_scda_fwrite_block(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *block_data, size_t block_size, int root, int encode, sc_scda_ferror_t *errcode)
Write a fixed-size block file section.
sc_scda_fcontext_t * sc_scda_fread_varray_sizes(sc_scda_fcontext_t *fc, sc_array_t *elem_sizes, sc_array_t *elem_counts, sc_scda_ferror_t *errcode)
Read the element sizes of a variable-size array.
struct sc_scda_ferror sc_scda_ferror_t
Error values for the scda functions.
uint64_t sc_scda_ulong
Type for element counts and sizes.
Definition: sc_scda.h:218
sc_scda_fcontext_t * sc_scda_fread_array_data(sc_scda_fcontext_t *fc, sc_array_t *array_data, sc_array_t *elem_counts, size_t elem_size, int indirect, sc_scda_ferror_t *errcode)
Read the data of a fixed-size array.
struct sc_scda_params sc_scda_params_t
A parameter struct for the functions sc_scda_fopen_write and sc_scda_fopen_read.
int sc_scda_proc_sizes(sc_array_t *elem_sizes, sc_array_t *elem_counts, sc_array_t *proc_sizes, sc_scda_ferror_t *errcode)
This is a collective function to determine the processor sizes.
void sc_scda_params_init(sc_scda_params_t *params)
Initialize a scda parameter structure to the defaults.
enum sc_scda_ret sc_scda_ret_t
Error values for scda-related errors.
sc_scda_fcontext_t * sc_scda_fwrite_varray(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *array_data, sc_array_t *elem_counts, sc_array_t *elem_sizes, sc_array_t *proc_sizes, int indirect, int encode, sc_scda_ferror_t *errcode)
Write a variable-size array file section.
sc_scda_fcontext_t * sc_scda_fwrite_inline(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *inline_data, int root, sc_scda_ferror_t *errcode)
Write an inline data section.
sc_scda_ret
Error values for scda-related errors.
Definition: sc_scda.h:226
@ SC_SCDA_FERR_LASTCODE
to define own error codes for a higher level application that is using sc_scda functions
Definition: sc_scda.h:255
@ SC_SCDA_FERR_COUNT
A byte count error that may occur transiently on writing or the file is short on reading.
Definition: sc_scda.h:250
@ SC_SCDA_FERR_FORMAT
File not conforming to the scda format.
Definition: sc_scda.h:228
@ SC_SCDA_FERR_USAGE
Incorrect workflow of an scda reading function.
Definition: sc_scda.h:230
@ SC_SCDA_FERR_SUCCESS
successful function call
Definition: sc_scda.h:227
@ SC_SCDA_FERR_ARG
An argument to a scda file function is invalid.
Definition: sc_scda.h:246
@ SC_SCDA_FERR_DECODE
The decode parameter to sc_scda_fread_section_header is true but the file section header(s) encounter...
Definition: sc_scda.h:241
@ SC_SCDA_FERR_MPI
An MPI error occurred; see mpiret in the corresponding sc_scda_ferror_t.
Definition: sc_scda.h:253
sc_scda_fcontext_t * sc_scda_fread_section_header(sc_scda_fcontext_t *fc, char *user_string, size_t *len, char *type, size_t *elem_count, size_t *elem_size, int *decode, sc_scda_ferror_t *errcode)
Read the next file section header.
sc_scda_fcontext_t * sc_scda_fopen_read(sc_MPI_Comm mpicomm, const char *filename, char *user_string, size_t *len, sc_scda_params_t *params, sc_scda_ferror_t *errcode)
Open a file for reading and read the file header from the file.
int sc_scda_ferror_is_success(sc_scda_ferror_t errorcode)
Check if a scda_errorcode_t encodes success.
struct sc_scda_fcontext sc_scda_fcontext_t
Opaque context for writing and reading a libsc data file, i.e.
Definition: sc_scda.h:215
int sc_scda_fclose(sc_scda_fcontext_t *fc, sc_scda_ferror_t *errcode)
Close a file opened for parallel write/read and the free the file context.
sc_scda_fcontext_t * sc_scda_fwrite_array(sc_scda_fcontext_t *fc, const char *user_string, size_t *len, sc_array_t *array_data, sc_array_t *elem_counts, size_t elem_size, int indirect, int encode, sc_scda_ferror_t *errcode)
Write a fixed-size array file section.
The sc_array object provides a dynamic array of equal-size elements.
Definition: sc_containers.h:117
Error values for the scda functions.
Definition: sc_scda.h:280
sc_scda_ret_t scdaret
scda file format related return value
Definition: sc_scda.h:286
int mpiret
MPI function return value; without MPI this variable can get filled by other I/O operation error code...
Definition: sc_scda.h:282
A parameter struct for the functions sc_scda_fopen_write and sc_scda_fopen_read.
Definition: sc_scda.h:299
unsigned fuzzy_everyn
In average every n-th possible error origin returns a fuzzy error.
Definition: sc_scda.h:301
int log_level
The log level for the scda functions.
Definition: sc_scda.h:317
sc_rand_state_t fuzzy_seed
The seed for the fuzzy error return.
Definition: sc_scda.h:313
sc_MPI_Info info
info that is passed to MPI_File_open
Definition: sc_scda.h:300