Perhaps a better approach would be to not have master send to itself. The
reason for sending data to another machine is simply to get the data to the
other machine, obvious huh? ; )
Since master has the data already, there is no reason to send the data from
master to master because master already has the data.
So your code now looks like:
//MASTER sending RESULTS after doing some processing to rank-0
//MPI_Send(RESULT, 15, MPI_CHAR, 0, Result_TAG, MPI_COMM_WORLD);
//printf("I am rank %d sending %s towards rank-0 WITH tag %d\n", my_rank,
RESULT,Result_TAG);
//MASTER recieving Results from all nodes including master
while(done < ntasks) {
MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
source = status.MPI_SOURCE;
MPI_Recv(buff,15,MPI_CHAR,source,Result_TAG,MPI_COMM_WORLD,&status);
done++;
printf("Master recieved + %s +from rank %d \n",buff,source,ntasks);
}
printf("Master also has+ %s +from itself\n",RESULT);
(I commented out everything above the while loop, changed the loop to "done <
ntasks" because you are waiting for the master, and added the master printf
after the loop so that you end up with "ntasks" print statements.)
Hope this helps
-j
Quoting Prashanth <pcharapa_at_[hidden]>:
>
> Hi,
>
> You might want to use 'non-blocking' Sends and Receives in this case.
> (MPI_Isend and MPI_Irecv)
>
> When a process uses MPI_Send, it essentially blocks itself until a
> matching MPI_Recv is posted on the receiving side. In your case, when
> Master does an MPI_Send to itself, it is blocking on the MPI_Send and
> hence cannot post a MPI_Recv, which could explain your deadlock.
>
> Hope this helps.
>
> --
> Prashanth
> pcharapa_at_[hidden]
> LAM-MPI Team
>
>
> Thus spoke Irshad Ahmed in the message sent on Thu, 2 Oct 2003
>
> ->Hi, Jeremy
> ->yes, Master is also doing same job as the slaves, and sends the results of
> jobs to itself.
> ->I think that there is problem in
> ->* While statement.
> ->Thanks for your interest.
> ->Waiting anxiously for the reply.
> ->Regards,
> ->
> ->
> ->Ahmed irshad
> ->
> ->---------------------------------
> ->Do you Yahoo!?
> ->The New Yahoo! Shopping - with improved product search
> _______________________________________________
> This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
|