LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2004-06-28 21:52:55


Andriy is mostly correct. If you do not somehow tell MPI that you're done
with a request, internal lists get longer and longer.

MPI defines non-blocking communication in two distinct phases: starting
the communication and ending the communication. You cannot know that the
communication has completed unless you use one of the MPI_TEST* or
MPI_WAIT* functions to check the MPI_Request. If any of the MPI_TEST* or
MPI_WAIT* functions indicate that the request has finished, it has been
freed by MPI (which prevents internal lists from growing).

MPI_REQUEST_FREE is another method to use, and the standard says that this
is fine to do, but when you do this, you have no indication of when the
communication has completed.

You might want to read the non-blocking communication section of MPI-1 for
more details (or the corresponding non-blocking communication section of
any decent MPI book).

On Mon, 28 Jun 2004 b.platz_at_[hidden] wrote:

>
> Hello,
>
> I'm using MPI_Isend and MPI_Recv in a loop like in the code I attached
> to this mail. In each iteration the code becomes slower and slower.
> What is the reason of this behaviour? How can I
> prevent this?
> Using MPI_Send instead of MPI_ISend I have no problem.
> But when I have data with a size greater than 8192 Bytes in this case
> MPI_Send hangs.
>
> Thanks for help,
>
> Bernward
>
>
> #include <mpi.h>
> #include <unistd.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
>
> int
> main (int argc, char *argv[])
> {
> int rank;
> int i;
>
> MPI_Request request;
> MPI_Status status;
>
> double send[22000];
> double recv[22000];
>
> int size = 6000;
> time_t *t;
> time_t oldtime;
>
> MPI_Init (&argc, &argv);
> MPI_Comm_rank (MPI_COMM_WORLD, &rank);
> oldtime = time(t);
> for (i = 0; ; i++)
> {
> if (rank == 0)
> {
> MPI_Isend (send, size, MPI_DOUBLE, 1, 1, MPI_COMM_WORLD, &request);
> MPI_Recv (recv, size, MPI_DOUBLE, 1, 2, MPI_COMM_WORLD, &status);
> }
> if (rank == 1)
> {
> MPI_Isend (send, size, MPI_DOUBLE, 0, 2, MPI_COMM_WORLD, &request);
> MPI_Recv (recv, size, MPI_DOUBLE, 0, 1, MPI_COMM_WORLD, &status);
> }
> if ((rank == 0) && (i > 0) && (i % 1000 == 0)) {
> printf("iteration = %i, time = %u\n", i, time(t)-oldtime);
> oldtime = time(t);
> }
> }
> MPI_Finalize ();
> return 0;
> }
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>

-- 
{+} Jeff Squyres
{+} jsquyres_at_[hidden]
{+} http://www.lam-mpi.org/