- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Everybody gets the gathered data */
- if ((char *) &table[begin_row][0] != (char *) table + displs[rank]*sizeof(int))
- MPI_Allgatherv(&table[begin_row][0], send_count, MPI_INT,
- &table[0][0], recv_counts, displs,
- MPI_INT, test_comm);
- else
- MPI_Allgatherv(MPI_IN_PLACE, send_count, MPI_INT,
- &table[0][0], recv_counts, displs,
- MPI_INT, test_comm);
+ /* Fill in the displacements and recv_counts */
+ for (i = 0; i < participants; i++) {
+ displs[i] = i * block_size * MAX_PROCESSES;
+ recv_counts[i] = send_count;
+ }