the following MPI code. Explain whether deadlock will occur or not. If not, explain; if so, explain and fix it. Do not change the name of MPI Methods. Show your work. MPI_Ssend is a blocking send operation, it blocks itself until the receiver receives the message. double other_data ; .... if ( rank==0 || rank==2) { MPI_Ssend(&own_data, 1 ,MPI_DOUBLE , 3 , tag , MPI_COMM_WORLD ) ; MPI_Recv(&other_data, 1 ,MPI_DOUBLE , 1 , tag , MPI_COMM_WORLD ,&status ) ; } else if ( rank==1 ) { MPI_Ssend(&own_data , 1 , MPI_DOUBLE , 0 , tag , MPI_COMM_WORLD ) ; MPI_Ssend(&other_data , 1 , MPI_DOUBLE , 2 , tag , MPI_COMM_WORLD ) ; }
Consider the following MPI code. Explain whether deadlock will occur or not. If not, explain; if so, explain and fix it. Do not change the name of MPI Methods. Show your work. MPI_Ssend is a blocking send operation, it blocks itself until the receiver receives the message.
double other_data ;
....
if ( rank==0 || rank==2) {
MPI_Ssend(&own_data, 1 ,MPI_DOUBLE , 3 , tag , MPI_COMM_WORLD ) ;
MPI_Recv(&other_data, 1 ,MPI_DOUBLE , 1 , tag , MPI_COMM_WORLD ,&status ) ;
}
else if ( rank==1 ) {
MPI_Ssend(&own_data , 1 , MPI_DOUBLE , 0 , tag , MPI_COMM_WORLD ) ;
MPI_Ssend(&other_data , 1 , MPI_DOUBLE , 2 , tag , MPI_COMM_WORLD ) ;
}
else if (rank==3 ) {
MPI_Recv(&own_data,1 , MPI_DOUBLE , 0 , tag , MPI_COMM_WORLD ,&status);
MPI_Recv(&other_data,1,MPI_DOUBLE , 2 ,tag,MPI_COMM_WORLD,&status);
}
Step by step
Solved in 2 steps