LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Llfrg_at_[hidden]
Date: 2004-04-01 12:14:38


Neil wrote:

>What is the value of "i"?
>What is the value of "size"?

Below is the block of code where I call MPI_Isend. I guess it makes clear the values of i and j (both int):

 for (i=0, j=0; i < size; i++, j++){
   if(i != rank){
    MPI_Isend(&sbuf[i],1,MPI_INT,i,124,MPI_COMM_WORLD,request+j);
   }
   else j--;
 }

Process 0 goes through this for and sends all of its messages, but when another process is about to send its first message (i and j are zero), I get the segmentation fault.

size is an integer initialized with:

  MPI_Comm_size(MPI_COMM_WORLD, &size);

and sbuf:

  sbuf = (int *)malloc(size*sizeof(int));

I assume the problem is with request because if I do declare

   MPI_Request request[64];

instead of mallocing it, the program works.

Thanks,
Leonardo.