[petsc-dev] MatLoad/VecLoad for a file with multiple objects

Smith, Barry F. bsmith at mcs.anl.gov
Fri Mar 23 12:37:27 CDT 2018


   The intention is that if one wants to do something "fancy" with storing objects to files they use a tool for this (is HDF5 such a tool?) while PETSc binary files only provide simple straightforward way to store objects (this is similar to the graphics tools in PETSc that also not intended to be sophisticated but just provide "quick and dirty" graphics). If you wish to contribute clearer documentation on the limitations of the PETSc binary format that is great.

   I find "Not a vector next in file" to be an accurate statement. 

   Barry


> On Mar 23, 2018, at 11:39 AM, Vaclav Hapla <vaclav.hapla at erdw.ethz.ch> wrote:
> 
> Hello
> 
> I'm quite surprised that there can be multiple objects in a single binary file, and they must be loaded in the exact order they are in the file. This behavior is not documented in MatLoad or VecLoad.
> 
> For instance, there can be a matrix A, RHS b and initial guess x0 stored in one file in this order, but you have to call
>  MatLoad(A,viewer); VecLoad(b,viewer); VecLoad(x0,viewer);
> in the same order.
> 
> When you e.g. call VecLoad first, it fails with "Not a vector next in file". This I think is not exactly informative (it says there's no vector but doesn't say that there's something different, actually a matrix).
> 
> I can make a PR documenting this, maybe also improving the error message, if you otherwise find this behavior OK.
> 
> Vaclav



More information about the petsc-dev mailing list