Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Difficulty with MPI_Unpack
From: Jed Brown (jed_at_[hidden])
Date: 2010-02-08 06:21:57

On Sun, 07 Feb 2010 22:40:55 -0500, Prentice Bisbal <prentice_at_[hidden]> wrote:
> Hello, everyone. I'm having trouble packing/unpacking this structure:
> typedef struct{
> int index;
> int* coords;
> }point;
> The size of the coords array is not known a priori, so it needs to be a
> dynamic array. I'm trying to send it from one node to another using
> MPI_Pack/MPI_Unpack as shown below. When I unpack it, I get this error
> when unpacking the coords array:
> [fatboy:07360] *** Process received signal ***
> [fatboy:07360] Signal: Segmentation fault (11)
> [fatboy:07360] Signal code: Address not mapped (1)
> [fatboy:07360] Failing at address: (nil)

Looks like b_point.coords = NULL. Has this been allocated on rank=1?

You might need to use MPI_Get_count to decide how much to allocate.
Also, if you don't have a convenient upper bound on the size of the
receive buffer, you can use MPI_Probe followed by MPI_Get_count to
determine this before calling MPI_Recv.