[mpich-discuss] How to use MPI functions under subroutines?
vvvnew at umich.edu
vvvnew at umich.edu
Tue Jul 26 16:00:08 CDT 2011
Hi,
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. Your mpi
is already initialized in the main prog and so you just have to pass the
relevant variables.
Sreenivas
On Tue, 26 Jul 2011 13:09:27 -0700 (PDT), Zhangping Wei wrote: Dear all,
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. 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. Does someone have some programming experience like this? any
advice and information will be greatly appreciated. Regards, Zhangping
Wei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110726/34ad35da/attachment.htm>
More information about the mpich-discuss
mailing list