[petsc-dev] Reorganization of PetscViewerGetSubcomm() and PetscViewerGetSingleton()

Barry Smith bsmith at mcs.anl.gov
Tue Aug 11 18:18:57 CDT 2015


   Matt, Dmitry, Stefano,

   In reference to pull request 356

   Since PetscViewerGetSubcomm() and PetscViewerGetSingleton() were totally broken for recursive use and for writing to a file I had to do a major reorganization. In particular 

    PetscViewerGetSubcomm() and PetscViewerGetSingleton()  ----> PetscViewerGetSubViewer()

    PetscViewerASCIISynchronizedAllow() ---->   PetscViewerASCIIPush/PopSynchronized()

  Because you guys make a large amount of use of this sub viewer functionality in code you've contributed but have very little good testing of it in the regular test suite (Dmitry has some) I am asking you to look at your code that uses this stuff and which I have updated as best I can and run tests to make sure I didn't break anything. In particular you may need to add some PetscViewerFlush() to get things in the right order in some of your usage. 
Both Stefano and Matt likely should add more test cases in the regular test suite that test your usage of the SubViewer.

   I think I have a consistent correct model for handling this recursively but could be wrong. Please report all problems ASAP so I don't introduce code that breaks your stuff into next.

  Thanks

  Barry


> On Jul 22, 2015, at 2:21 AM, Dave May <dave.mayhem23 at gmail.com> wrote:
> 
> Hi,
> 
> I've encountered erroneous output when calling PetscViewerGetSubcomm() with a parent viewer defined as type ascii.
> 
> To illustrate the problem, I've attached a slightly modified version of ksp/ex2.c and I use 
> this together with PCREDUNDANT and KSPView().
> My modifications in ex2.c create an ascii viewer (filename=ksp_view.txt) and then calls KSPView().
> 
> The erroneous output manifests it itself in several ways:
> * truncated text
> * incorrect / inter-leaved text
> * what looks like binary crap in the ascii file
> 
> Here are the results from my simple tests which I hope can be used to track down this issue
> 
> (1)  Executing
> ${PETSC_DIR}/${PETSC_ARCH}/bin/mpiexec -n 2 ./ex2 -pc_type redundant
> and examining the file ksp_view.txt reveals the text reported from KSPView() 
> has been truncated (see my example ksp_view_p2.txt). 
> 
> The first text appearing is
> KSP Object:  (redundant_)   1 MPI processes
> which is incorrect. There also appears to be some write order problems as the 
> formatting looks a little screwed.
> 
> (2) Executing
> ${PETSC_DIR}/${PETSC_ARCH}/bin/mpiexec -n 8 ./ex2 -pc_type redundant
> generates what looks like binary garbage in ksp_view.txt (see my example ksp_view_p8.txt)
> 
> (3) Commenting line 223 and using line 224, e.g. calling 
> KSPView(ksp,PETSC_VIEWER_STDOUT_WORLD);
> works perfectly. Hence, the output reported from -ksp_view in stdout is correct
> and is not truncated or containing garbage.
> 
> I'm a bit puzzled why using PETSC_VIEWER_STDOUT_WORLD works flawlessly but using a self created ascii viewer fails.
> 
> Could anyone advise me what the problem is?
> 
> Cheers
>   Dave
> <ksp_view_p8.txt><ksp_view_p2.txt><ex2.c>




More information about the petsc-dev mailing list