Thanks a lot. It indeed turned out to be a memory problem; the buffer wasn't
initialised properly.
> -----Original Message-----
> From: lam-bounces_at_[hidden] [mailto:lam-bounces_at_[hidden]]On Behalf
> Of Jeff Squyres
> Sent: Thursday, May 26, 2005 5:42 PM
> To: General LAM/MPI mailing list
> Subject: Re: LAM: unpacking stl::vector
>
>
> (sidenote: please check the date on your mail client -- your mail
> apparently came on May 26, 9999, and our web mail archive software
> therefore refused to archive it)
>
> I don't see anything wrong with what you're doing. However, it's only
> a portion of your code, so here's a few suggestions:
>
> 1. Check to see that vector::resize() isn't lazy and isn't delaying the
> allocation of memory until you actually use an STL accessor to get at
> the data.
>
> 2. Check that you're resetting "position" to 0 before unpacking.
>
> 3. Check to ensure that you don't have any other memory errors, and
> this is just a side effect of the real problem. You might want to use
> a memory-checking debugger such as valgrind.
>
> Sorry I can't give anything more definite. :-\
>
>
> On Feb 7, 2106, at 1:28 AM, Dim Coumou wrote:
>
> > Hello,
> > I have a question about sending-receiving stl::vector's. I can send a
> > single
> > vector using syntax:
> > MPI::COMM_WORLD.Send(&vec[0],vec_size,MPI::INT,proc,tag);
> > and corresponding receive:
> > MPI::COMM_WORLD.Recv(&vec[0],vec_size,MPI::INT,proc,tag,status);
> > However if I want to send a bunch of vectors using MPI::Pack I get into
> > problems. Packing and sending stl::vector's is still possible. It is
> > also
> > possible to unpack such a message into an normal C-array.
> > Unfortunately, if
> > I directly unpack into a stl::vector I do not retrieve the right
> > elements.
> > Below the syntax I use for the case of packing-and-sending one
> > vector.Most
> > probably I do something really stupid, but I don't see what's going
> > wrong
> > here. Any suggestions? Many thanks in advance.
> > MPI::COMM_WORLD.Send(&bufsize,1, MPI::INT, dest, 0);
> > MPI::INT.Pack(&vec_size,1,buffer,bufsize,position,MPI::COMM_WORLD);
> > MPI::INT.Pack(&vec[0],vec_size,buffer,bufsize,position,MPI::
> > COMM_WORLD);
> > MPI::COMM_WORLD.Send(buffer,position, MPI::PACKED, dest, 1);
> > and corresponding receive:
> > MPI::COMM_WORLD.Recv(&bufsize,1,MPI::INT, 0, 0, status);
> > MPI::COMM_WORLD.Recv(buffer, bufsize, MPI::PACKED, 0, 1, status);
> > MPI::INT.Unpack(buffer, bufsize, &vec_size, 1, position,
> > MPI::COMM_WORLD);
> > vec2.resize(vec_size);
> > MPI::INT.Unpack(buffer, bufsize, &vec2[0], vec_size, position,
> > MPI::COMM_WORLD);
> >
> > <winmail.dat>_______________________________________________
> > This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
> --
> {+} Jeff Squyres
> {+} jsquyres_at_[hidden]
> {+} http://www.lam-mpi.org/
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
|