On 10/15/06, <b class="gmail_sendername">Julian</b> <<a href="mailto:julvar@tamu.edu">julvar@tamu.edu</a>> 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&m univ. I configured petsc to build the libraries with mpi.<br>So, I ran '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 << "line1"<br>//insert code to initialize mpi<br>Cout << "line2"<br>MyfunctionusingMPI()<br>Cout << "line3"
<br>//insert code to finalizeMPI<br>}<br><br>Say I run this program with 2 processors, will "line2" 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 "Using MPI" by Gropp, et. al. for a better understading<br>of parallel code.<br><br> 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>"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness