[petsc-users] PETSc VecLoad not obeying HDF5 group?
Barry Smith
bsmith at mcs.anl.gov
Fri Nov 14 16:41:25 CST 2014
Thanks. I found the bug. The routine VecLoad_HDF5_DA() did not use the group properly (though the regular VecLoad_HDF5() did). Please find attached a patch to apply to the petsc root directory to fix the problem. The fix is also in the branch barry/fix-vecload-group-handling This will also be fixed in our next patch release.
Thanks for reporting the problem.
Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-vecload-group-handling.patch
Type: application/octet-stream
Size: 1793 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141114/0d52593f/attachment.obj>
-------------- next part --------------
> On Nov 14, 2014, at 2:09 AM, H?kon Strandenes <haakon at hakostra.net> wrote:
>
> See attached file.
>
> The test is really simple. The HDF5 file contains two (equal) datasets/vectors:
>
> - One dataset u in the root of the file "/"
> - One dataset v in the group "/FIELDS"
>
> The example program tries to load two vectors, u and v, from the file. The PetscViewerHDF5PushGroup is set to "/FIELDS" for both. It will first try to load u, then v.
>
> If everything works, it SHOULD FAIL on loading u, since this vector is not stored in the correct location in the HDF5 file. PETSc should search in "/FIELDS" for this vector, not "/". It should however SUCCEED in loading "v", since this is located correctly.
>
> In my latest version of PETSc from Git, this is inverted. The program SUCCEED in loading u, and FAIL in loading v. Something is wrong...
>
> BTW: Is there an error in DM ex4? Is the vector u destroyed properly?
>
> H?kon
>
>
> On 14. nov. 2014 05:19, Barry Smith wrote:
>>
>> Sorry no one answered this before, I had assumed someone who knew something about HDF5 would answer but instead looks like I have to.
>>
>> Could you please send a simple example code (and data file) that reproduces the problem. I looked at the code and (in theory) it should handle the group ok.
>>
>> Again sorry for the long delay in anyone answering.
>>
>> Barry
>>
>>
>>> On Nov 6, 2014, at 2:24 AM, H?kon Strandenes <haakon at hakostra.net> wrote:
>>>
>>> Hi,
>>>
>>> I am trying to load a dataset from a HDF5 file and into a vector in PETSc. For that purpose I use VecView etc in the following way:
>>>
>>> PetscViewerHDF5Open(PETSC_COMM_WORLD, "input.h5", FILE_MODE_READ, &H5viewer);
>>>
>>> PetscViewerHDF5PushGroup(H5viewer, "/FIELDS");
>>>
>>> VecLoad(gSol, H5viewer);
>>>
>>> PetscViewerDestroy(&H5viewer);
>>>
>>> And yes, I also check the return variables for errors, I have just omitted them from this example to make it easier to read.
>>>
>>> My problem is:
>>> If I place a dataset, with the correct name and dimensions, in the group "/FIELDS" in my input.h5, PETSc can't find it and won't load it. If I place the same dataset in the root of my HDF5 file, the dataset is loaded and everything works, even with PetscViewerHDF5PushGroup set to "/FIELDS"...
>>>
>>> Does actually VecLoad obey the group set by PetscViewerHDF5PushGroup?
>>>
>>> Best regards,
>>> H?kon Strandenes
>>
>>
> <VecLoadTest.tar.gz>
More information about the petsc-users
mailing list