[petsc-dev] printing the matrix name via -mat_view_info
Shri
abhyshr at mcs.anl.gov
Thu Sep 30 16:29:02 CDT 2010
PETSC_VIEWER_STDOUT_XXX uses the format PETSC_VIEWER_DEFAULT. Is the same format used for storing matrices in ascii to a file too?
Shri
----- Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> Currently each individual matrix type (seqaij, mpiaij, ....) provides its own code to print out in ASCII (some provide several codes depending on viewer format flag).
>
> You could add to (some,all?) of these specific codes a call to PetscObjectPrintClassNamePrefixType() to print that. For example, in MatView_SeqAIJ_ASCII()
>
> } else if (format == PETSC_VIEWER_ASCII_COMMON) {
> ierr = PetscViewerASCIIUseTabs(viewer,PETSC_NO);CHKERRQ(ierr);
> for (i=0; i<m; i++) {
>
> change to
>
> } else if (format == PETSC_VIEWER_ASCII_COMMON) {
> ierr = PetscViewerASCIIUseTabs(viewer,PETSC_NO);CHKERRQ(ierr);
> PetscObjectPrintClassNamePrefixType(....);
> for (i=0; i<m; i++) {
>
>
> I think it is fine if you add this.
>
> Barry
>
>
> On Sep 30, 2010, at 1:25 PM, Shri wrote:
>
> > Can the object name be also displayed when the option -<object>_view is provided or <object>View() is called? Maybe only for matrices,vectors and DAs??
> >
> > Instead of
> >
> > row 0: (0, 4)
> > row 1: (1, 4)
> > row 2: (2, 4)
> > row 3: (3, 4)
> > row 4: (4, 4)
> >
> > It should display
> >
> > Matrix Object : <matrix_name>
> > row 0: (0, 4)
> > row 1: (1, 4)
> > row 2: (2, 4)
> > row 3: (3, 4)
> > row 4: (4, 4)
> >
> > Shri
> > ----- Barry Smith <bsmith at mcs.anl.gov> wrote:
> >>
> >> 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