[MPICH] Variable length size of message
William Gropp
gropp at mcs.anl.gov
Mon Feb 4 16:14:32 CST 2008
Yes, as long as dln remains in scope and you don't access it until it
is completed by a Wait or Test. The "count" in the MPI receives is
the maximum message length. You can also determine the actual length
from the status value (returned by wait or test, or by MPI_Recv).
You don't need to send the length explicitly. You can also use
MPI_Probe or MPI_Iprobe to determine the length of the message before
you receive it.
Bill
On Feb 4, 2008, at 3:02 PM, Jarosław Bułat wrote:
> Hello!
>
> I would like to send variable length size message between two
> processes.
> Suppose maximal length of the message is known as MAXLEN. Can I do
> that
> in the following way?:
>
> receiver:
> char dIn[ msgSIZE ];
> MPI_Irecv( dIn, MAXLEN, MPI_CHAR, rankSend, tagPING, MPI_COMM_WORLD,
> req );
>
> sender:
> char dOut[ msgSIZE ];
> int vsize = 1024;
> MPI_Send( dOut, vsize, MPI_CHAR, rankRec, tagPING, MPI_COMM_WORLD );
>
> Suppose first 4 bytes of dOut consists of length of the message. In
> that
> way one can determine real length of message in receiver.
>
> I've tested such a configuration and it's working. My question is:
> Is it
> legal/supported? or is it working accidentally?
>
>
> Jarek!
>
>
William Gropp
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20080204/396e1705/attachment.htm>
More information about the mpich-discuss
mailing list