[petsc-users] PetscViewerASCIISynchronizedPrintf

Barry Smith bsmith at mcs.anl.gov
Fri Feb 10 08:17:05 CST 2012


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.

   Barry




More information about the petsc-users mailing list