Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: [OMPI users] Trouble with MPI_Recv not filling buffer
From: Patrick Brückner (patrick.brueckner_at_[hidden])
Date: 2013-07-06 14:33:59


I am currently learning MPI and there's this problem that I have been
dealing with very long now. I am trying to receive a struct, and in some
very specific cases (when I run with 2/3/4 instances and only
calculating exactly the same number of data). For some weird reason it
seems to work as soon as I have a lot of data to calculate (starting
with N=5, I cannot reproduce the problem).

--- snip ---
data p;
p.collection = malloc(sizeof(int)*N);

printf("[%d] before receiving, data id %d at %d with direction

MPI_Status data_status;
if(data_status.MPI_ERROR != MPI_SUCCESS) {
     printf("[%d] ERROR %d",me,data_status.MPI_ERROR);
     return -1;
printf("[%d] received status %d\n",data_status.MPI_ERROR);
printf("[%0d] received data %d (%d/%d) at position %d with direction
--- snip ---

I get this output:

[1] before receiving, data id -1665002272 at 0 with direction 0
[0] received status 0
[1] received data -1665002272 (1/2) at position 0 with direction 0

I am wondering if you had any hint for me, why data is still not having
the correct data but just the old, uninitialized values, and why I don't
get any error. Also I really have no idea, why instance 0 is printing
this status information, as it does not enter this section at all. Is
this some kind of optimazation that I have to turn off?

Thanks for all hints,