LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2004-08-26 08:59:13


On Aug 26, 2004, at 9:44 AM, Jack C wrote:

>> You might want to investigate using a bit more of a client/server
>> approach -- change your logic so that the server sends out an initial
>> round of work to each client process, and then waits for anyone to
>> reply with their results. When it gets a set of results from someone,
>> it gives them the next round of work. In this way, naturally faster
>> machines will request work faster, etc.
>
> But in MPI_Recv, I need to indicate which node to recieve from. Is
> there a way
> I can receive from any, and it will let me know which one, so I can
> later
> tell which to send to?

Yes, you can use MPI_ANY_SOURCE as the peer argument. I'm not a huge
fan of MPI_ANY_SOURCE, but it seems suitable for this situation. You
can find out who sent to you by examining the MPI_Status argument -- it
will be in the field named MPI_SOURCE.

If you're an MPI newbie, you might want to get a good book on MPI, or
take one of the available on-line tutorials available. There's some
excellent ones out there, such as the one at NCSA:

        http://foxtrot.ncsa.uiuc.edu:8900/public/MPI/

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/