On Oct 19, 2004, at 3:11 PM, atarpley wrote:
> I start my MPI application with a single process. This single MPI
> process
> spawns various other MPI applications (having one process each) using
> separate
> calls of MPI_Comm_spawn (I can't do a single call to spawn or use
> spawn_multiple). So I have to keep track of many INTERcommunicators,
> which I
> do so in a list.
>
> My question:
> Since I have this (possibly long) list of INTERcommunicators, what is
> the best
> way to do a blocking recv over this list? Currently I have a loop
> that walks
> through each node in the list, and does an MPI_Iprobe.
Probes are evil, IMHO. Search this mailing list for some of my prior
posts on this topic. :-)
> If the probe indicates
> a message, I go ahead and call MPI_Recv on that INTERcommunicator and
> return
> the msg. If the probe indicates no message, I continue on to the next
> INTERcommunicator in the list. Once the end of the list is reached,
> its
> starts over at the beginning. The apparent problem with this method is
> that it
> is CPU intensive.
>
> I have looked into MPI_Irecv but it doesnt seem to fit what I want.
Actually, I think it does -- you may even want to look into persistent
receives.
You can post a whole bunch of non-blocking receives (getting an
MPI_Request handle back from each one) and then block waiting for any
one of them to complete by passing the array of pending requests by
calling MPI_WAITANY.
--
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/
|