strange behaviour with PetscViewerBinary on MATIS

Jed Brown jed at 59A2.org
Thu Jul 23 08:43:51 CDT 2009


Andreas Grassl wrote:
> Hello,
> 
> I want to save my Matrix A to disk and process it then with ksp/ksp/ex10. Doing
> it for type AIJ is working fine.
> 
> Using type IS, it seems to save only the local matrix from one processor to the
> disk and dump the others to stdout.
> 
> PetscViewerBinaryOpen(commw,"matrix.bin",FILE_MODE_WRITE,&viewer1);
> MatView(A,viewer1);

The viewer for MATIS is really simplistic, it doesn't ascribe any
parallel structure at all.

The technical explanation for the behavior you are seeing (which is bad)
is the following.  MatView_IS gets a "singleton" viewer which for a
Binary viewer is just a binary viewer on PETSC_COMM_SELF for rank 0,
with the NULL (0) viewer for all other ranks.  It then calls MatView
with this viewer which is a proper binary viewer for rank 0, but MatView
creates a new viewer when called with viewer 0.

> Is the only workaround to save the LocalToGlobalMapping and the local matrices
> separately and to read in all this information or do you see an easier way?

You can put this in MatView_IS if you really need it, but I doubt it
will actually be useful.  Unfortunately, you cannot change the domain
decomposition with Neumann preconditioners, hence they will have limited
use for solving a system with a saved matrix.  Why do you want to save
the matrix, it's vastly slower and less useful than a function which
assembles that matrix?

Jed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090723/3a576cee/attachment.pgp>


More information about the petsc-users mailing list