atarpley wrote:
> I have a question about the dynamic nature of MPI-2.
>
> My (potential) MPI applications starts up with 1 process and then spawns a
> random number of "slave" tasks. As I understand it, each spawn returns an
> intercommunicator. So if I spawn 10 seperate slaves, I have 10
> intercommunicators.
Only if you do 10 separate spawn calls. If you spawn all 10 slaves with
a single call to MPI_Comm_spawn, the master will have a single
intercommunicator.
>
> My question is this. If the "master" process (the one that spawned the
> slaves) needed to listen for incoming messages from ANY of the slaves, what
> would be the best way to do this? Currently, I iterate through EACH
> communicator and do a probe. If a message is there, I receive it. But I have
> read that probes are bad and it seems CPU intensive anyways to continuously
> walk through every communciator (what if I have 1000 slaves??)
If you do, in fact, end up with multiple intercomms, there are a couple
things you could do. You could merge them all into a single intracomm
or an intercomm with just a single master and a bunch of slaves. This
will take a long time, but if it is a long enough running application it
may be worth it. Another possibility is to use non-blocking receives.
Call an Irecv for each slave, storing the returned request handle in an
array. Then you can do an MPI_Wait_any on the array of requests to
randomly receive messages from slaves.
Still, if it is a simple master/slave model, you may be able to spawn
all the slaves with a single call, making the above 2 solutions unnecessary.
I hope this helps.
Dave.
>
> I remember than in PVM, I could just do a single recv and use ANY_SOURCE. I
> think there is something similar in MPI, but this is complicated by the fact
> that I have potentially *many* intercomms, not a bunch of processes within a
> single intercomm.
>
> Any thoughts?
>
> Thanks,
> Andy
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
--
Dr. David Cronk, Ph.D. phone: (865) 974-3735
Research Leader fax: (865) 974-8296
Innovative Computing Lab http://www.cs.utk.edu/~cronk
University of Tennessee, Knoxville
|