Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] MPI Persistent Communication Question
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2010-06-28 08:29:47


On Jun 28, 2010, at 4:03 AM, amjad ali wrote:

> (1)
> Call this subroutines 1000 times
> =============================
> call MPI_RECV_Init()
> call MPI_Send_Init()
> call MPI_Startall()
> call MPI_Free()
> =============================
>
> (2)
> Call this subroutines 1000 times
> ===========================
> call MPI_RECV_Init()
> call MPI_Send_Init()
> call MPI_Startall()
> ==========================
> call MPI_Free() --------- call it only once at the end.

Neither is better. The idea is to do this:

    MPI_Recv_init()
    MPI_Send_init()
    for (i = 0; i < 1000; ++i) {
        MPI_Startall()
        /* do whatever */
        MPI_Waitall()
    }
    for (i = 0; i < 1000; ++i) {
        MPI_Request_free()
    }

So in your inner loop, you just call MPI_Startall() and a corresponding MPI_Test* / MPI_Wait* call to complete those requests.

The idea is that the MPI_*_init() functions do some one-time setup on the requests and then you just start and complete those same requests over and over and over. When you're done, you free them.

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/