[petsc-users] VecLoad into a SubVector ?

Sajid Ali sajidsyed2021 at u.northwestern.edu
Mon Jul 27 22:52:37 CDT 2020


Hi Barry/Matt,

I now have a simpler test (attached with this email) for this bug which
does the following :

   - Create a vector of size 50, set it to 2 and save to disk.
   - Create a vector of size 100, set it to 1 and extract the last 50
   elements as a subvector.
   - Load the saved vector from disk into the subvector and restore the
   subvector.
   - Test for VecSum, it should be 150.

With one mpi rank (implying no scatters were used in the creation of the
subvector), the above works as expected when using binary IO but if one
uses HDF5 for IO, VecSum outputs 100 showing that the subvector didn’t
restore correctly. Running the executable in gdb I see that for both cases
the VecRestoreSubVector reads the variable VecGetSubVectorSavedStateId as 4
with the boolean variable valid being false.

My guess regarding the origin of the error with HDF5-IO is the fact that
VecLoad_HDF5 uses a VecReplaceArray to load the data and this somehow
messes up the assumptions regarding SubVector data pointers upon creation
by using VecPlaceArray.

As Barry mentioned the check for validity of subvector data is faulty and
would need to be fixed and that should be able to transfer the subvector
data back to the parent vector regardless of how the subvector is modified.

Thank You,
Sajid Ali | PhD Candidate
Applied Physics
Northwestern University
s-sajid-ali.github.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200727/af7faa26/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex_subvecio.c
Type: application/octet-stream
Size: 3392 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200727/af7faa26/attachment.obj>


More information about the petsc-users mailing list