Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] Missmatch between sent and recieved data
From: Alexey Sokolov (gabbear_at_[hidden])
Date: 2009-07-27 03:57:53


Hi

Thank you for advising, but my problem disappeared after rebooting as it
has never been. I really don't know why it was in this way, but I didn't
change anything and now it works correctly. May be it was connected with
system update without rebooting after it (I use Fedora 10), don't truly
know.

Anyway thank you for your help and paying me attention.

PS: I typed you a little bit wrong code. In the original code i get the
string length with strlen(chdata[i]), so the null-terminator should be
counted.

Sincerely yours, Alexey.

On Fri, 2009-07-24 at 16:47 +0200, Dorian Krause wrote:
> Hi,
>
> you do not send the trailing '0' which is used to determine the
> stringlength. I assume that chdata[i] has at least length 5 (otherwise
> you overrun your memory). Replace the "4" by "5" in MPI_Isend and
> MPI_Recv and everything should work (If I get the problem right).
>
> Dorian.
>
>
> Alexey Sokolov wrote:
> > Hi
> >
> > I'm sorry if the answer to my question is very simple, but I'm really
> > confused with this situation.
> >
> > I got a program that now contains 1 master and 1 slave processes. Master
> > process sends few similar chars to the slave process with this:
> >
> > for (unsigned i = 0; i < SomeVariable; i++) {
> > strcpy(chdata[i], "asdf");
> > MPI_Isend(chdata[i], 4, MPI_CHAR, SLAVE, 1, MPI_COMM_WORLD,
> > &req[i]);
> > }
> >
> > And the slave process receives them with this:
> >
> > for (unsigned i = 0; i < SomeVariable; i++) {
> > char * buf = new char[10];
> > MPI_Recv(buf, 4, MPI_CHAR, MASTER, 1, MPI_COMM_WORLD, &stat);
> > printf("Received data [%s] of length %d\n", buf, strlen(buf));
> > }
> >
> > As I understand output should be "Received data [asdf] of length 4", but
> > instead of this I got my 'asdf' with additional 3 random ANSI characters
> > in string of length 7.
> >
> > I've already spent few hours to find the mistake out but unsuccessfully.
> > I do successfully transfer int data in the similar way, but this case
> > make me crazy. Could you help me to find out where did I fail in this?
> >
> > Sincerely yours, Alexey.
> >
> > _______________________________________________
> > users mailing list
> > users_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
> >
> >
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users