Newsgroups: comp.parallel.mpi
From: Kamran Kazemi <kamran@cs.uwa.edu.au>
Subject: Problem with MPI_Pack and MPI_Unpack in LAM 6.1
Organization: The University Of Western Australia
Date: Tue, 31 Mar 1998 15:32:07 +0800
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <35209BF6.72E36802@cs.uwa.edu.au>

Hi
I am using LAM 6.1 with Linux on a Pent-200 and
have a problem in packing and unpacking routines.
First, I allocate enough memory and then start packing
my variables which are all integers as follows (I know
I could send them as integer type but I cannot see why
MPI_PACKED data type should cause this problem):

  4 integers are packed before these variables
>rc = MPI_Pack(&ttp->MinUniqueId, 1, MPI_INT,
                             Buf, PackSize, &Pos, Comm);
>rc = MPI_Pack(&ttp->MaxUniqueId, 1, MPI_INT,
                             Buf, PackSize, &Pos, Comm);
 ....... and the rest of them

on the receiving side I allocate the same amount of
memory and start unpacking them as follows:

  4 integers are unpacked before these variables
>rc = MPI_Unpack(Buf, BufSize, &Pos,
                  &ttp->MinUniqueId, 1, MPI_INT, Comm);
>rc = MPI_Unpack(Buf, BufSize, &Pos,
                  &ttp->MaxUniqueId, 1, MPI_INT, Comm);
  ........ and the rest of them

Only these two variables which are somewhere in the
middle are corrupted and do not get the proper values.
They both are defined as integers filed in a structure.

I have tried swapping the order for packing/unpacking
and no matter what the variables packed in position 5
and 6 does not get across correctly.  I managed to get
them across by packing two extra values in these
positions.  I am using MPI_PACKED with MPI_Send
and MPI_Recv functions.  I have traced the "Pos" and
it gets updated correctly as I unpack.  I do not get any
error returned on the packing or unpacking process.

Can anybody tell me what is happening here?  Is this
an alignment problem?

Thanks in advance
Kamran
email : kamran@cs.uwa.edu.au


