On Fri, Feb 10, 2012 at 8:17 AM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
On Feb 10, 2012, at 6:24 AM, Konstantinos Kontzialis wrote:<br>
<br>
> Dear all,<br>
><br>
> I am trying to print data from all the processes in a single file and I use the following command<br>
><br>
> ierr = PetscViewerASCIIOpen(sys.comm, "cp.dat", &viewer1);<br>
> CHKERRQ(ierr);<br>
><br>
> ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE);<br>
> CHKERRQ(ierr);<br>
><br>
> .<br>
> .<br>
><br>
> /* Some user operations */<br>
> .<br>
> .<br>
> .<br>
> ierr = PetscViewerASCIISynchronizedPrintf(viewer1,<br>
> "%le\t%le\t%le\n", cp, x[0], x[1]);<br>
> CHKERRQ(ierr);<br>
><br>
> ierr = PetscViewerFlush(viewer1);<br>
> CHKERRQ(ierr);<br>
><br>
> but at run time the code hangs. What should I do?<br>
><br>
> Kostas<br>
<br>
</div></div> 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.</blockquote>
<div><br></div><div>Also, those operations are collective, so you need every process to call that.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
Barry</font></span></blockquote></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>