On Fri, Feb 10, 2012 at 8:17 AM, Barry Smith <span dir="ltr">&lt;<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>&gt;</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>
&gt; Dear all,<br>
&gt;<br>
&gt; I am trying to print data from all the processes in a single file and I use the following command<br>
&gt;<br>
&gt; ierr = PetscViewerASCIIOpen(sys.comm, &quot;cp.dat&quot;, &amp;viewer1);<br>
&gt;    CHKERRQ(ierr);<br>
&gt;<br>
&gt; ierr = PetscViewerASCIISynchronizedAllow(viewer1, PETSC_TRUE);<br>
&gt; CHKERRQ(ierr);<br>
&gt;<br>
&gt; .<br>
&gt; .<br>
&gt;<br>
&gt; /* Some user operations */<br>
&gt; .<br>
&gt; .<br>
&gt; .<br>
&gt; ierr = PetscViewerASCIISynchronizedPrintf(viewer1,<br>
&gt;                            &quot;%le\t%le\t%le\n&quot;, cp, x[0], x[1]);<br>
&gt;                    CHKERRQ(ierr);<br>
&gt;<br>
&gt; ierr = PetscViewerFlush(viewer1);<br>
&gt;                    CHKERRQ(ierr);<br>
&gt;<br>
&gt; but at run time the code hangs. What should I do?<br>
&gt;<br>
&gt; 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>