Newsgroups: comp.parallel.mpi
From: James Cownie <jcownie@dolphinics.com>
Subject: Re: On specifying message length as MPI_Irecv() argument
Organization: Dolphin Toolworks
Date: Fri, 11 Jul 1997 15:31:14 +0100
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <33C643B2.3920@dolphinics.com>

Srinivasan Srivilliputhur wrote:
> My Pseudo-Code:
> --------------
>   /* Post non-blocking receive and return before completion */
>   MPI_Irecv( (void *) RecvBuffer, MaxMsgLen, MPI_CHAR, MPI_ANY_SOURCE,
>              msgtype, MPI_COMM_WORLD, &IrecvRequest );
> 
>   /* Send the message using blocking send */
>   MPI_Isend( (void *) SendBuffer, MaxMsgLen, MPI_CHAR,
>              destnode, msgtype, MPI_COMM_WORLD, &IsendRequest);
> 
>   /* wait for MPI_Irecv() to complete */
>   MPI_Wait( &IrecvRequest, &IrecvStatus );
> 
> My Problem:
> ----------
> As you see, we have to specify the message length when we post MPI_Irecv()
> Since I do not know this apriori, I am forced to use "MaxMsgLen" (the size
> of the "SendBuffer[]".  This means that for a 8byte message I am forced to
> send about 2MB.
Not true, the lengths do not have to match provided that
1) the length specified in the receive is >= the length specified in the
send.
2) the type signatures of the send and receive match.

So you don't have to send 2MB, but you do have to have a buffer large
enough to receive 
that much.

You can find out from the status how much was actually received.

-- Jim 

James Cownie 
Dolphin Interconnect Solutions
Phone : +44 117 9071438
E-Mail: jcownie@dolphinics.com

