- MPI_Irecv(recv_buff + src_row_base * block_size, recv_count * Y,
- recv_type, src, tag, comm, req_ptr++);
+ if (i + my_row_base == rank)
+ MPI_Sendrecv(send_buff + recv_offset, send_count, send_type,
+ rank, tag, recv_buff + recv_offset, recv_count,
+ recv_type, rank, tag, comm, &s);
+
+ else
+ MPI_Sendrecv(tmp_buff1 + send_offset, send_count, send_type,
+ rank, tag,
+ recv_buff + recv_offset, recv_count, recv_type,
+ rank, tag, comm, &s);
+ }
+
+
+ for (i = 0; i < X; i++) {
+ src = (i * Y + my_col_base);
+ if (src == rank)
+ continue;
+ src_row_base = (src / Y) * Y;
+
+ MPI_Irecv(recv_buff + src_row_base * block_size, recv_count * Y,
+ recv_type, src, tag, comm, req_ptr++);