[petsc-users] HDF5 viewer + groups

Daniel R. Shapero shapero at uw.edu
Sun May 10 15:47:15 CDT 2020


I'm trying to improve the checkpointing functionality in the Firedrake
library, which currently uses the HDF5 viewer to store PetscVec objects.
The problem with this approach is that a lot of context about the stored
vector (e.g. the mesh and finite element space that it came from) is lost
and we'd like to save that too.

In order to make a sensible hierarchy inside the file, I'd like to be able
to write a DMPlex to a group, say `/meshes/<mesh_name>`, within the file
rather than at the root `/`. I tried using the `PETScViewerHDF5PushGroup`
function; I thought that this will change the current group of the file to
whatever name you give and all subsequent dataset writes will go under that
group until you call the matching pop. This doesn't seem to be the case and
all of the mesh data gets written under `/`. From reading the source code,
it looks like the HDF5 writer pushes the group `/topology` to write out the
DMPlex cells (and likewise for coordinates etc) which then clobbers
whatever I pushed before it instead of concatenating.

I've attached a minimal example using petsc4py to demonstrate. I get the
same results when I use some extra functionality in Firedrake to ensure
that the `/meshes` group is created in the first place, which I can then
verify with h5ls.

Is there a way to do what I want and if so how? If there isn't, is that
because no one has needed this before or is there a fundamental reason why
you shouldn't be doing this in the first place?

Thanks!
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200510/b406fb5e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plex_to_hdf_test.py
Type: text/x-python
Size: 387 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200510/b406fb5e/attachment.py>


More information about the petsc-users mailing list