C API - Best strategy to copy meta-data to multiple files


#1

Hi all,

I am looking for some advice on the best strategy to apply here. This uses the C interface.

I have some hdf5 file used as initial conditions of my simulation. This file contains a bunch of meta-data in the form of a group with mulitple attributes in it and no dataset.
The code then runs and writes hdf5 outputs at multiple points in time. I would like to duplicate the meta-data I read earlier into these files for safe-keeping.

Ideally, I’d like to not re-open the initial conditions at the time of writing the outputs to copy the meta-data. I’d rather read it once, store it somewhere in memory and just write it to the files at a later stage.

Is there a preferred strategy to do this? This means storing somewhere in memory my hdf5 group “object” and writing it to some different files at a later point?

Any suggestion welcome.


#2

You could create an in-core HDF5 file w/ the metadata (see H5Pset_fapl_core https://portal.hdfgroup.org/display/HDF5/H5P_SET_FAPL_CORE) and periodically use H5Ocopy (https://portal.hdfgroup.org/display/HDF5/H5O_COPY) to copy the metadata to the new files.


#3

Ah, excellent suggestion, thanks! I wasn’t aware of the option to create in-core files. Seems like exactly the feature I would need.