[mpich-discuss] question on correct use of mpi_isend/mpi_irecv

Grindeanu, Iulian R. iulian at mcs.anl.gov
Tue May 27 11:15:58 CDT 2014

We are trying to track down a memory leak, and we are not sure if we are using correctly MPI_ISend and MPI_Irecv

We would like to use non-blocking communication, between pairs of processes.

(it happens during a computation, at every time step; every processor has a list of processors it needs to communicate with; what we do not know, is the size of the messages, in advance)

Let's assume A needs to send to B
Because we do not know the size in advance, we send first a fixed size message from A to B; this first message has info about how big the total message needs to be; A knows it has to send more. When B receives the first part, it sends an ack (small size, int 4) to A, acknowledging, and also resizing the local buffer, to fill more data; then A sends the rest.

All these sends / receives use Isend and Irecv, and we try to match the messages, using proper tags. We use different tags for fixed size, ack, and rest of the message.

Before sending the code, I would like to know is what we try is feasible and doable?

We notice that the memory use on processor A keeps increasing, when we do this in a loop, on the order of about 1000-2000 bytes per iteration.

I think we are matching correctly isends and ireceives, and that our buffers are not leaking (we may be wrong)

So again, an iteration is like this:
A sends a fixed size message to B; B sends back an ack, and when A receives it, sends the rest, because B has now the proper buffer to receive.

Next iteration, the size of the message is again unknown, so we do again the dance.

Do you have an example like that we can use? Should we use other types of sends/receives?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20140527/b5839dde/attachment.html>

More information about the discuss mailing list