Subject: Re: PACK/UNPACK

From: <[email-masked]>
Date: Wed, 18 May 94 13:14:52 EDT

: -) :-) :-) *** (-: (-: (-:
Date: Wed, 18 May 1994 13:13:17 -0400
From: Marc Snir <[email-masked]>

I think I partially agree with you, except the issue you have about
concatenations of packing units.

This is easier to argue from the view-point of a hypothetical
implementation.

Assume that a normal message, created by a regular send, contains
some header identifying the type
of machine that sends the message, so that the the recipient can do
the required conversions, followed by data.  More generally, the
message could contain some formatting information (e.g., type
signature)

Recall that a packing unit is created by a sequence of "related"
PACK calls, starting with position=0, and each incrementing the
value of position returned by the previous call.  A packing unit is
consumed by a sequence of similarly "related" UNPACK calls.

Normal send: header is prepended to data and message is sent.

Send with type MPI_PACKED: no header is prepended; the header was
already created by the call to PACK, and occurs in (each of the)
packing units, created by a sequence of related PACK calls.

Normal receive: the header is consumed by the receive operation.

Receive with type MPI_PACKED: the header is passed, as is, and stored
in the receive buffer; it will be consumed by the call(s) to
MPI_UNPACK.  Each sequence of related calls to MPI_UNPACK that
consumes one packing unit, will consume one header.

This means that

1.  A packing unit, created by a sequence of related PACK calls, and
sent with type MPI_PACKED, can be received by a normal receive.

2. A packing unit sent with type MPI_PACKED can be received with
type MPI_PACKED and be unpacked by a sequence of related UNPACK
calls.

3.  A message sent by a normal sent can be received with type
MPI_PACKED and unpakced by a sequence of related UNPACK calls.

4. Of course, a message sent by a normal send can be received with a
normal send.

Now, how about a sequence of bytes which is the concatenation of
several packing units?

Such can be

Sent with type MPI_PACKED (no header added).

Received with type MPI_PACKED (sequence of bytes in message body is
stored, as is, in receive buffer).

Each packing unit can be separately unpacked by a sequence of
related UNPACK calls.

Conclusion:

a) A message that was created by one or several sequences of
related PACK calls is sent with type MPI_PACKED.
b) A message that is going to be unpacked by one or several
sequences of related UNPACK calls is received with type MPI_PACKED.
c) A Message created by one sequence of related PACK calls, and
sent with type MPI_PACKED is identical to a message sent with a
regular send.

I don't understand why you came to the conclusion it is wrong to
send the concatenation of several packing units with type MPI_PACKED.