Re: [mpich-discuss] Please explain
Hi Soheil, first of all, it is considered good style to post complete, minimal, programs, not just excerpts, so that others can quickly reproduce the problem you're reporting. To solve your homework, consider the following hints: 1. which lines of code does the for-loop enclose? 2. Which rank will send data to which other rank? 3. Which rank will receive data from which remote rank? (I'm using rank synonymous to process.) Best -Andreas On 07:17 Sun 22 Dec , Soheil Hooshdaran wrote:
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);
_______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss
-- ========================================================== Andreas Schäfer HPC and Grid Computing Chair of Computer Science 3 Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany +49 9131 85-27910 PGP/GPG key via keyserver http://www.libgeodecomp.org ========================================================== (\___/) (+'.'+) (")_(") This is Bunny. Copy and paste Bunny into your signature to help him gain world domination!
participants (1)
-
Andreas Schäfer