[petsc-dev] printing the matrix name via -mat_view_info

Barry Smith bsmith at mcs.anl.gov
Wed Sep 29 19:56:53 CDT 2010


  I have added PetscObjectPrintClassNamePrefixType() which is now (in theory) used uniformly in all the XXXView ASCII info formats to display this information appropriately. A nice improvement, eliminated lots of duplicate code and makes it easier to have uniform output.

  PetscObjects are NOT given names by default, you should call PetscObjectSetName() to give it a name.  In a small number of places when an object NEEDS a name, for example when it is saved to Matlab with that variable name then PetscObjectName() is called to generate a "unique" name.

   Thanks for the suggestion,

   Barry

>  What does PetscObjectName() do??Generate a random name??

Currently it generates a name that looks like

classname_commid_number

where number is incremented sequentially.

I would lean towards always naming everything so that a unique
identifier is available.  Unfortunately, doing so would make all the
test output non-reproducible because the identifier (for generated
names) includes some run-dependent information (commid above).  Maybe
name everything, but have an option to turn it off?


On Sep 29, 2010, at 2:28 PM, Shri wrote:

> Is there a way to print the matrix name so that -mat_view_info prints it out.
> 
> Instead of
> 
> Matrix Object:
>  type=mpiaij, rows=200, cols=200
>  total: nonzeros=40000, allocated nonzeros=40000
>  total number of mallocs used during MatSetVal
> 
> it should print
> 
> Matrix Object: <MATRIX_NAME>
>  type=mpiaij, rows=200, cols=200
>  total: nonzeros=40000, allocated nonzeros=40000
>  total number of mallocs used during MatSetVal
> 
> It'll be nice to have the matrix name printed out cause sometimes it gets confusing when there are a lot of matrices you are working with. 
> Either the user can set a name and it could be printed out in mat_view_info or even better if in some way the variable name can be used directly.
> 
> What do you think?
> 
> Shri




More information about the petsc-dev mailing list