Well, if you see, for rank 0, the (request + j) with j=0 works fine. You
will decrement your j in the else condition and 'for' will increment it,
and again j will be 0 for the next pass (rank = 0 only).
So there is nothing wrong with the request, I feel, it works fine for rank
0.
I guess somewhere you are playing with the memory in a wrong way, which is
affecting your request array (the pointers are being overwritten and
pointing to invalid location -- may be because of some side-effects in
other parts of your code). If it works fine with static allocation of
request (request[64]), then definitely it is some memory messing happening
in your code, nothing wrong with the MPI.
I would strongly recommend you check your code again through a memory
checking debugger (something like -- bcheck on Solaris/Valgrind on Linux).
That will help you know more about the issue.
-Vishal
On Thu, 1 Apr 2004 Llfrg_at_[hidden] wrote:
# 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.
# _______________________________________________
# This list is archived at http://www.lam-mpi.org/MailArchives/lam/
#
|