[petsc-users] PetscViewerASCIISynchronizedPrintf

Matthew Knepley knepley at gmail.com
Fri Feb 10 08:53:19 CST 2012


On Fri, Feb 10, 2012 at 8:17 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
> On Feb 10, 2012, at 6:24 AM, Konstantinos Kontzialis wrote:
>
> > Dear all,
> >
> > I am trying to print data from all the processes in a single file and I
> use the following command
> >
> > ierr = PetscViewerASCIIOpen(sys.comm, "cp.dat", &viewer1);
> >    CHKERRQ(ierr);
> >
> > ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE);
> > CHKERRQ(ierr);
> >
> > .
> > .
> >
> > /* Some user operations */
> > .
> > .
> > .
> > ierr = PetscViewerASCIISynchronizedPrintf(viewer1,
> >                            "%le\t%le\t%le\n", cp, x[0], x[1]);
> >                    CHKERRQ(ierr);
> >
> > ierr = PetscViewerFlush(viewer1);
> >                    CHKERRQ(ierr);
> >
> > but at run time the code hangs. What should I do?
> >
> > Kostas
>
>     ASCII IO should only be used very sparingly. If you have lots of print
> statements and many processes it may appear to hang because it is taking
> forever to process the IO.   You need to use binary IO for large amounts of
> data and or many processes.


Also, those operations are collective, so you need every process to call
that.

   Matt


>
>   Barry

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120210/557fff6a/attachment.htm>


More information about the petsc-users mailing list