[MPICH] non-blocking sending/receiving an array

Blankenship, David David.Blankenship at kla-tencor.com
Wed May 16 09:59:59 CDT 2007


 I am doing the same type of thing with the blocking calls. Here is how
I am doing it. This code uses the C++ MPI interface.

// Probe for a message from any source
MPI::COMM_WORLD.Probe( MPI_ANY_SOURCE, MPI_ANY_TAG, cMPIStatus );
int iMessageLength = cMPIStatus.Get_count( MPI_CHAR );
// Here I resize my receive buffer if necessary

// Receive the message that was just probed
int iSource = cMPIStatus.Get_source();
MPI::COMM_WORLD.Recv( &(cBuffer[0], cBuffer.size(), MPI_CHAR, iSource,
MPI_ANY_TAG, cMPIStatus );


You could also use the tag to differentiate messages from a single
source. This does eliminate the need to send 2 messages, one with the
size and then one with the array. That is what I liked most about this
solution.

I hope this helps.

David Blankenship



-----Original Message-----
From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of Manal Helal
Sent: Wednesday, May 16, 2007 2:44 AM
To: mpich-discuss-digest at mcs.anl.gov
Subject: [MPICH] non-blocking sending/receiving an array

Hi

I am trying to send an array, I send its size first, and then send the
array itself, however, I am sending in a loop and receiving in a loop,
so I end up receiving in different order, like I receive the array
size, and then receive from the same sender the array of different
size sent at another iteration, and I am using non-blocking
communication,  and testing now for 3 processes, but could be more
later, so, I can only specify the sender in the receive of the array,
as the one I received the array size from, but I can't specify the
size, it is giving me:

rank 2 in job 4  localhost.localdomain_54476   caused collective abort
of all ranks
  exit status of rank 2: killed by signal 9
2:  MPI_Wait(140)..........................:
MPI_Wait(request=0xb6b55198, status0xb6b5519c) failed
2:  MPIDI_CH3U_Post_data_receive_found(163): Message from rank 0 and
tag 92 truncated; 224 bytes received but buffer size is 56


is there a way to probe for a specific size, and receive only if this
is the size, in the MPI_Iprobe, there is no specification for the
count,

any ideas will greatly help,

Thank you very much, Kind Regards,

Manal




More information about the mpich-discuss mailing list