On 10/15/06, <b class="gmail_sendername">Julian</b> &lt;<a href="mailto:julvar@tamu.edu">julvar@tamu.edu</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am using petsc in my fem program on the supercomputer we have here at<br>texas a&amp;m univ. I configured petsc to build the libraries with mpi.<br>So, I ran&nbsp;&nbsp;'mpirun -np 2 /home/j0v1008/bin/alphampi a.alpha' in order to use
<br>2 processors.<br>Till the point where petsc is initialized, everything looks normal. From the<br>point petsc in initialized, I get duplicates of everything that is written<br>to cout (at the very least, maybe it's doing duplicates of other things as
<br>well).<br>I understand that all the petsc functions might be called twice or so<br>depending on how it parallelizes, but I don't understand why it executes<br>lines that are outside of the petsc world, that have nothing to do with mpi.
<br><br>Maybe this would clear things up:<br><br>void main()<br>{<br>Cout &lt;&lt; &quot;line1&quot;<br>//insert code to initialize mpi<br>Cout &lt;&lt; &quot;line2&quot;<br>MyfunctionusingMPI()<br>Cout &lt;&lt; &quot;line3&quot;
<br>//insert code to finalizeMPI<br>}<br><br>Say I run this program with 2 processors, will &quot;line2&quot; be printed twice ? If<br>yes, can you explain why it does that when I didn't ask for that line to be<br>parallelized?
</blockquote><div><br>Yes. MPI is an SPMD model. There are multiple running copies of the same<br>program. I suggest &quot;Using MPI&quot; by Gropp, et. al. for a better understading<br>of parallel code.<br><br>&nbsp;&nbsp; Matt<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">If no, then why is my fea program behaving so?<br><br>Thanks,<br>Julian.<br><br></blockquote>
</div><br><br clear="all"><br>-- <br>&quot;Failure has a thousand explanations. Success doesn't need one&quot; -- Sir Alec Guiness