File numerics/src/tools/hdf5_logger.h

Go to the source code of this file

Logger using an HDF5 output.

Defines

hid_t

Functions

bool SN_logh5_check_gzip(void)
SN_logh5 *SN_logh5_init(const char *filename, const unsigned iter_max)

Initialize the hdf5 logging.

Parameters
  • filename – name of the hdf5 file

  • iter_max – maximum number of iteration (or an upper bound)

Returns

a struct containing all the info related to the hdf5 logging

bool SN_logh5_end(SN_logh5 *logger)

Close the hdf5 file.

Parameters

logger – the struct related to logging

Returns

true if success, false otherwise

bool SN_logh5_new_iter(unsigned iter, SN_logh5 *logger)

Start a new iteration in the hdf5 file (create a folder /i-iteration_number.

Parameters
  • iter – iteration number

  • logger – the struct related to logging

Returns

true if success, false otherwise

bool SN_logh5_end_iter(SN_logh5 *logger)

End an iteration.

Parameters

logger – the struct related to logging

Returns

true if success, false otherwise

bool SN_logh5_NM(NumericsMatrix *mat, const char *name, SN_logh5 *logger)

Save a Numerics matrix in a hdf5 file.

If logger->group is not null (like during an interation), the matrix is saved in the group. Otherwise it is saved at the toplevel.

Parameters
  • mat – the matrix to save

  • name – name of the file in the hdf5

  • logger – the log struct

Returns

true if success, false otherwise

bool SN_logh5_scalar_double(double val, const char *name, hid_t loc_id)
bool SN_logh5_scalar_integer(ptrdiff_t val, const char *name, hid_t loc_id)
bool SN_logh5_scalar_uinteger(size_t val, const char *name, hid_t loc_id)
bool SN_logh5_attr_uinteger(size_t val, const char *name, hid_t loc_id)
bool SN_logh5_vec_double(size_t size, double *vec, const char *name, hid_t loc_id)
bool SN_logh5_mat_dense(size_t size0, size_t size1, double *mat, const char *name, hid_t loc_id)
bool SN_logh5_csparse(CSparseMatrix *cs, const char *name, hid_t loc_id)
bool SN_logh5_vec_int32(size_t size, int32_t *vec, const char *name, hid_t loc_id)
bool SN_logh5_vec_int64(size_t size, int64_t *vec, const char *name, hid_t loc_id)
bool SN_logh5_vec_uint64(size_t size, uint64_t *vec, const char *name, hid_t loc_id)
static inline SN_loglevels SN_logh5_loglevel(SN_loglevels l)

filter loglevel for the hdf5 logger.

Useful to disable logging if the hdf5 support that been disable.

Parameters

l – desired loglevel

Returns

l if the hdf5 logger is enabled, SN_LOGLEVEL_NO otherwise

struct SN_logh5
#include <>

HDF5 logger (for full debug purposes)

Public Members

char *itername

name of the group for the current iteration

unsigned itername_len

maximum length of itername

hid_t file

handle to the HDF5 file

hid_t group

Handle to the current (top-level) group (e.g.

“/foo”)