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

Lu, Huiwei huiweilu at mcs.anl.gov
Sat May 31 01:07:19 CDT 2014

Hi, Iulian,

The communication protocol seems fine to me. It looks A has allocated some buffer for sending but forgets to free it. You may want to check if all malloc’ed memory in your program have been properly freed.

You may also use valgrind to detect memory leak. See details in http://wiki.mpich.org/mpich/index.php/Support_for_Debugging_Memory_Allocation
Huiwei Lu
Postdoc Appointee
Mathematics and Computer Science Division, Argonne National Laboratory

On May 27, 2014, at 11:15 AM, Grindeanu, Iulian R. <iulian at mcs.anl.gov> wrote:

> Hello,
> 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?
> Thanks,
> Iulian
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss

More information about the discuss mailing list