[petsc-dev] -mat_view ::ascii_matlab ?

Barry Smith bsmith at mcs.anl.gov
Fri Mar 1 12:18:35 CST 2013


On Mar 1, 2013, at 10:40 AM, "Mark F. Adams" <mark.adams at columbia.edu> wrote:

> I have a SNES solver and use -mat_view ::ascii_matlab.
> 

  -prefix_mat_view ascii:myfilename.m:ascii_matlab




> I do two SNES iterations and get three matrices output.  My formJAcobean explicitly forms AIJ matrices.  After the 2nd two matrix printouts I see:
> 
>  Matrix-free approximation:
>    err=1.49012e-08 (relative error in function evaluation)
>    Using wp compute h routine
>        Does not compute normU
 
  Presumably the solver for some reason is also doing a matrix free matrix vector product. Run with -snes_view or -ts_view to see the solver being used.

   If you want ONLY YOUR matrix to be viewed you need to give it a unique prefix otherwise with -mat_view the code cannot know that you only want to view some matrices and not others; how will it know which matrices you want to see. 


> 
> Are these matrices not my explicit matrices?  That is, is PETSc using my formFunction to create an FD matrix?
> 
> Also, all three of my matrices use the same name:
> 
> Mat_0x84000000_0 = spconvert(zzz);

   If you are printing the same matrix in the C code three times it will always have the same name. It doesn't change the name every time you print it. If you are printing three different matrices in the C program they will have different names.

> 
> In the past I've seen that PETSc will increment these names to keep them unique.  Did we regress?
> 
> I would like to just have the output from these runs (with all other printing turned off) go directly into a .m file that I can read in to matlab directly.  This seems like the only reasonable way to use this, or at least a use case that should be supported, but these excess print statements and non unique names break this workflow.
> 
    You might consider the feature -mat_view binary:filename:binary_matlab this creates a binary file (suitable for both large and small problems and works in parallel unlike ASCII) containing the matrices AND a filename.info which contains MATLAB code that opens the binary file and reads in the objects giving them unique MATLAB names. Try it out, play with it and suggest how it can be improved. 

   Barry



> 




More information about the petsc-dev mailing list