LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Ahmad Faraj (faraj_at_[hidden])
Date: 2004-08-29 08:11:04


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/
>