File numerics/src/tools/hdf5_logger.h

Go to the source code of this file

Logger using an HDF5 output.

Functions

bool SN_logh5_attr_uinteger(size_t val, const char *name, hid_t loc_id)
bool SN_logh5_check_gzip(void)
bool SN_logh5_csparse(CSparseMatrix *cs, const char *name, hid_t loc_id)
bool SN_logh5_end(SN_logh5 *logger)

Close the hdf5 file.

Return
true if success, false otherwise
Parameters
  • logger: the struct related to logging

bool SN_logh5_end_iter(SN_logh5 *logger)

End an iteration.

Return
true if success, false otherwise
Parameters
  • logger: the struct related to logging

SN_logh5 *SN_logh5_init(const char *filename, const unsigned iter_max)

Initialize the hdf5 logging.

Return
a struct containing all the info related to the hdf5 logging
Parameters
  • filename: name of the hdf5 file
  • iter_max: maximum number of iteration (or an upper bound)

static 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.

Return
l if the hdf5 logger is enabled, SN_LOGLEVEL_NO otherwise
Parameters
  • l: desired loglevel

bool SN_logh5_mat_dense(size_t size0, size_t size1, double *mat, const char *name, hid_t loc_id)
bool SN_logh5_new_iter(unsigned iter, SN_logh5 *logger)

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

Return
true if success, false otherwise
Parameters
  • iter: iteration number
  • logger: the struct related to logging

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.

Return
true if success, false otherwise
Parameters
  • mat: the matrix to save
  • name: name of the file in the hdf5
  • logger: the log struct

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_vec_double(size_t size, double *vec, 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)
struct SN_logh5
#include <hdf5_logger.h>

HDF5 logger (for full debug purposes)

Public Members

hid_t file

handle to the HDF5 file

hid_t group

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

“/foo”)

char *itername

name of the group for the current iteration

unsigned itername_len

maximum length of itername