<p>Hi,</p>
<p>&nbsp;&nbsp; I dont know if i understood your question right, but if you want to use mpi in your subroutines, pass all the relevant information (the communicator,numprocs,etc) and also include mpi in the subroutine.&nbsp; Your mpi is already initialized in the main prog and so you just have to pass the relevant variables.</p>
<p>Sreenivas</p>
<p>&nbsp;</p>
<p>On Tue, 26 Jul 2011 13:09:27 -0700 (PDT), Zhangping Wei &lt;zhangping_wei@yahoo.com&gt; wrote:</p>
<blockquote style="padding-left: 5px; border-left: 2px solid #1010ff; margin-left: 5px; width: 100%;">
<div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">Dear all,</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt"><!--?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /-->&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">I have a question about MPI programming skills; right now I am working on a FORTRAN program which has many subroutines, and I have not yet figure out a good way to use MPI functions inside those subroutines.</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">Usually, we set up the processes number (say, numprocs) and the corresponding process indices (myid) at the beginning of the main program, however, if we call some subroutines, and we want to use some function, for example, MPI_GATER, under that subroutine, we have to use their indices and MPI_COMM_WORLD or other statements, then I found lots of errors were incurred in my Visual Studio.</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">&nbsp;</div>
<div class="MsoNormal" style="margin: 0in 0in 0pt; right: auto;">Does someone have some programming experience like this? any advice and information will be greatly appreciated.</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">Regards,</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">&nbsp;</div>
<div class="MsoNormal" style="MARGIN: 0in 0in 0pt">Zhangping Wei</div>
<div style="right: auto;"><var id="yui-ie-cursor"></var></div>
</div>
</blockquote>
<p>&nbsp;</p>