[petsc-users] PETSc VecLoad not obeying HDF5 group?

Håkon Strandenes haakon at hakostra.net
Fri Nov 14 02:09:05 CST 2014


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
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VecLoadTest.tar.gz
Type: application/gzip
Size: 2749 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141114/06b8615b/attachment.bin>


More information about the petsc-users mailing list