[mpich-discuss] Please explain

Soheil Hooshdaran shooshdaran577 at gmail.com
Sat Dec 21 21:47:44 CST 2013


Hello.
This program deadlocks and I cannot see the reason. Would you please
explain it to me?

Thanks in advance

int send_buf[10];
  int recv_buf[10];
  int i;
  for(i=0;i<world_size;++i)
  if (world_rank == 0) {
    // If we are rank 0, set the number to -1 and send it to process 1
    printf("sent to process %d\n", i);
    MPI_Send(send_buf, 10, MPI_INT, 1, 0, MPI_COMM_WORLD);
  }
    printf("process %d\n", world_rank);
    MPI_Recv(recv_buf, 10, MPI_INT, 0, 0, MPI_COMM_WORLD,
MPI_STATUS_IGNORE);
    printf("Process %d received %d bytes from process 0\n", world_rank, 10);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20131222/e8f6412e/attachment.html>


More information about the discuss mailing list