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 / red3.c
index 32358d9..3d23759 100644 (file)
@@ -160,9 +160,15 @@ int main( int argc, char *argv[] )
        MPI_Type_commit( &mattype );
        
        buf = (int *)malloc( count * size * size * sizeof(int) );
-       if (!buf) MPI_Abort( MPI_COMM_WORLD, 1 );
+       if (!buf) {
+          MPI_Abort( MPI_COMM_WORLD, 1 );
+          exit(1);
+        }
        bufout = (int *)malloc( count * size * size * sizeof(int) );
-       if (!bufout) MPI_Abort( MPI_COMM_WORLD, 1 );
+       if (!bufout) {
+          MPI_Abort( MPI_COMM_WORLD, 1 );
+          exit(1);
+        }
 
        for (root = 0; root < size; root ++) {
            initMat( comm, buf );
@@ -182,6 +188,16 @@ int main( int argc, char *argv[] )
            if (rank == root) {
                errs += isShiftLeft( comm, bufout );
            }
+
+#if MTEST_HAVE_MIN_MPI_VERSION(2,2)
+            /* Try one more time without IN_PLACE to make sure we check
+             * aliasing correctly */
+            if (rank == root) {
+                MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
+                if (MPI_SUCCESS == MPI_Reduce( bufout, bufout, count, mattype, op, root, comm ))
+                    errs++;
+            }
+#endif
        }
 
        free( buf );