int i, src, dst, rank, num_procs;
int X, Y, send_offset, recv_offset;
int my_row_base, my_col_base, src_row_base, block_size, num_reqs;
- int tag = 1;
+ int tag = COLL_TAG_ALLGATHER;
rank = smpi_comm_rank(comm);
num_procs = smpi_comm_size(comm);
block_size = extent * send_count;
- is_2dmesh(num_procs, &X, &Y);
+ if (!is_2dmesh(num_procs, &X, &Y))
+ return MPI_ERR_COMM;
+
my_row_base = (rank / Y) * Y;
my_col_base = rank % Y;