0
I have been trying to write a cannon’s implementation of the Matrix Multiplication. Using MPI CVT, I am sending a few buffers using MPI_Isend and MPI_Irecv. The program does not proceed during this send recv. I have tried using MPI_Waitall at different places but still, some of the processes stop responding. How do I fix this? Using MPI_Send and MPI_Recv gives the same error. However, without the initial shift, the cannon’s algorithm loop works fine. It’s just the initial shift that is having issues. ”’ // Accounting initial shift for(int x=0;x<coords[0];x++){ // Shifting B MPI_Isend(&b1, nn, MPI_INT, nbrs[DOWN], 0, MPI_COMM_WORLD, &shiftreq[0]); MPI_Irecv(&b1, nn, MPI_INT, nbrs[UP], 0, MPI_COMM_WORLD, &shiftreq[1]); MPI_Waitall(2,shiftreq,MPI_STATUSES_IGNORE); printf(“Initial Shift B!\n”); } for(int x=0;x<coords[1];x++){ // Shifting A MPI_Isend(&a1, nn, MPI_INT, nbrs[RIGHT], 0, MPI_COMM_WORLD, &shiftreq[0]); MPI_Irecv(&a1, nn, MPI_INT, nbrs[LEFT], 0, MPI_COMM_WORLD, &shiftreq[1]); MPI_Waitall(2,shiftreq,MPI_STATUSES_IGNORE); printf(“Initial Shift A!\n”); }
for(i=0;i<n;i++){ // Cannon's Algorithm
mat_mult(n,a1,b1,c1);
//Shiftup
MPI_Isend(&b1, n*n, MPI_INT, nbrs[UP], 0, MPI_COMM_WORLD, &reqs[0]);
MPI_Irecv(&b1, n*n, MPI_INT, nbrs[DOWN], 0, MPI_COMM_WORLD, &reqs[1]);
//Shiftleft
MPI_Isend(&a1, n*n, MPI_INT, nbrs[LEFT], 0, MPI_COMM_WORLD, &reqs[2]);
MPI_Irecv(&a1, n*n, MPI_INT, nbrs[RIGHT], 0, MPI_COMM_WORLD, &reqs[3]);
MPI_Waitall(4, reqs, MPI_STATUSES_IGNORE);
}