Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / teshsuite / smpi / mpich3-test / coll / coll6.c
index 0ab19de075565ac84b56f985590d9869c82ffe91..e0973f9a1b571c66a7a41c779220c65c57c1b1a3 100644 (file)
@@ -54,9 +54,14 @@ int main( int argc, char **argv )
          table[i][j] = rank + 10;
       
       /* Everybody gets the gathered data */
-      MPI_Allgatherv(&table[begin_row][0], send_count, MPI_INT, 
-                    &table[0][0], recv_counts, displs, 
-                     MPI_INT, test_comm);
+      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);
 
       /* Everybody should have the same table now.