hi,
I reported this bug back in 2021 and it was meant to be fixed, but I
have just been testing this HDF5 file reading stuff with more recent
versions of PETSc and it doesn't look like it has actually been fixed.
The issue was with reading HDF5 files that had been written with PETSc
before the HDF5 timestepping stuff (e.g.
PetscViewerHDF5PushTimestepping()) was introduced in PETSc 3.16. The
default timestepping (if not present in the HDF5 file) was assumed
false. The function PetscViewerHDF5SetDefaultTimestepping() was
introduced so you could set the default true if needed.
The offending line in src/vec/is/utils/hdfio.c was supposed to read the
timestepping attribute, applying the default if it wasn't present.
However there was a bug which I found in it (see below).
Now (even in latest main branch), the line hdf5io.c:21 reads essentially:
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,×tepping,×tepping)
which also looks wrong to me, though in a slightly new way (and still
doesn't seem to work). I'd have thought (as in 2021) that it should read:
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,&hdf5->defTimestepping,×tepping)
Is that not right?
Regards, Adrian
On 4/11/21 00:39, Matthew Knepley wrote:
On Tue, Nov 2, 2021 at 9:41 PM Adrian Croucher
<a.crouc...@auckland.ac.nz> wrote:
hi again,
I found the bug. At hdf5io.c:24, the arguments in the call to
PetscViewerHDF5ReadAttribute() are in the wrong order. It should be:
ierr =
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,&hdf5->defTimestepping,×tepping);CHKERRQ(ierr);
Adrian, you are the best. Thanks for fixing it. I pushed your fix into
the branch and am now starting CI testing.
Thanks again,
Matt
With this change both the test code and my actual Waiwera code
work properly.
- Adrian
On 11/3/21 11:55 AM, Adrian Croucher wrote:
hi Matt
On 11/2/21 10:18 PM, Matthew Knepley wrote:
Okay, so there is something funny with the viewer we are
getting. Is there any way for me to run this? I can just step
through
with the debugger and find out why that var is not set.
I have written a little minimal example program which you can
debug- attached testh5.c, and HDF5 file fluid.h5 which it reads.
It crashes in VecLoad() with the same kind of error I get in my
actual code (and the same as if you leave out the call to
PetscViewerHDF5SetDefaultTimestepping()).
I've debugged through it myself and the default timestepping in
the viewer is true until somewhere in the call to
PetscViewerHDF5ReadAttribute() at hdf5io.c:24 (in
PetscViewerHDF5CheckTimestepping_Internal()), where it turns
false for some reason.
- Adrian
--
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email:a.crouc...@auckland.ac.nz
tel: +64 (0)9 923 4611