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-08-29 09:51:09


I second the motion that you should check the standard and/or get a
good MPI book. There's also some good MPI tutorials out there. Go
read up on the non-blocking MPI communication section -- it's good
material to know and understand when writing heavy-duty MPI
applications; don't rely on reading the internal code of MPI
implementations.

What we do in alltoall is create persistent requests -- not simple
non-blocking requests. Persistent requests have to be explicitly freed
because they are designed to be started, completed, and re-started
again. Note the use of various *_init functions and the startall
function in alltoall. (the reason for doing persistent in alltoall is
not for repetitiveness, but actually to help avoid unintentional
serialization -- I can explain further if people care).

Finally, can you upgrade? 7.x is *much* better (in many ways) than
6.5. Also, I think I mentioned it earlier today, 6.5.x is no longer
supported.

On Aug 29, 2004, at 9:11 AM, Ahmad Faraj wrote:

> Well, if mpi_allwait frees the resources and no need to call
> MPI_REQUEST_FREE, then why does lam (i have version 6.5.9) in alltoall
> implementation does that (take a look at the c2calltoall in
> alltoall.c):
>
> post all recvs
> post all sends
> startall
> waitall
> then free each request in a for loop using MPI_REQUEST_FREE
>
> that is where i thought we are supposed to do that
>
> *********************************************************************
> Ahmad Faraj Office: 170 James Lov Building
> Ph.D Candidate Phone: (850)644-1533
> Department of Computer Science Fax: (850)644-0058
> Florida State University Email: faraj_at_[hidden]
> Tallahassee, FL 32306 URL: http://www.cs.fsu.edu/~faraj
> **********************************************************************
>
> On Sun, 29 Aug 2004, Ralf Wildenhues wrote:
>
>> * Ahmad Faraj wrote on Sun, Aug 29, 2004 at 03:12:40AM CEST:
>>> hi all;
>>> i have this code snippet, it gives me errors that i really cant
>>> explain:
>>
>> Quick shot:
>>
>>> int main (int argc, char *argv[])
>>> {
>>> MPI_Request * req;
>>> int my_rank;
>>> char tmp = 'a';
>>>
>>> MPI_Init(&argc, &argv);
>>> MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
>>>
>>> if(my_rank==0)
>>> {
>>> req = malloc(2 * sizeof(MPI_Request));
>>
>> nits: req != NULL? stdlib.h included?
>>
>>> MPI_Irecv(&tmp, 1, MPI_CHAR, 0, 3, MPI_COMM_WORLD, &req[0]);
>>> MPI_Isend(&tmp, 1, MPI_CHAR, 0, 3, MPI_COMM_WORLD, &req[1]);
>>
>> This is a bug. You may not re-use the buffer &tmp at this point, as
>> the
>> Irecv can write there until the Waitall is completed.
>>
>>> MPI_Waitall(2, req, MPI_STATUSES_IGNORE);
>>>
>>> MPI_Request_free(&req[0]);
>>> MPI_Request_free(&req[1]);
>>
>> MPI_Waitall deallocates the MPI_Request data. No need (and that fixes
>> the bug you reported) to call MPI_Request_free().
>>
>>> free((char*)req);
>>
>> cast to char* is not necessary.
>>
>>> }
>>>
>>> return 0;
>>> }
>>>
>>> here is the error
>>> MPI_Request_free: invalid request handle (rank 0, MPI_COMM_WORLD)
>>> Rank (0, MPI_COMM_WORLD): Call stack within LAM:
>>> Rank (0, MPI_COMM_WORLD): - MPI_Request_free()
>>> Rank (0, MPI_COMM_WORLD): - main()
>>
>> Regards,
>> Ralf
>> _______________________________________________
>> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>>
>
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>

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