Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change include order for smpi tests/examples to avoid conflicts
[simgrid.git] / teshsuite / smpi / mpich3-test / coll / redscatblk3.c
index 5fb81e5..e23dc89 100644 (file)
@@ -38,6 +38,7 @@ int main( int argc, char **argv )
        fprintf( stderr, "Could not allocate %d ints for sendbuf\n", 
                 mycount * size );
        MPI_Abort( MPI_COMM_WORLD, 1 );
+        exit(1);
     }
     idx = 0;
     for (i=0; i<size; i++) {
@@ -50,6 +51,7 @@ int main( int argc, char **argv )
        fprintf( stderr, "Could not allocate %d ints for recvbuf\n", 
                 mycount );
        MPI_Abort( MPI_COMM_WORLD, 1 );
+        exit(1);
     }
 
     MPI_Reduce_scatter_block( sendbuf, recvbuf, mycount, MPI_INT, MPI_SUM, 
@@ -71,11 +73,11 @@ int main( int argc, char **argv )
     sumval = size * rank + ((size - 1) * size)/2;
     /* recv'ed values for my process should be size * (rank + i) */
     for (i=0; i<mycount; i++) {
-       if (sendbuf[rank*mycount+i] != sumval) {
-           err++;
-           fprintf( stdout, "Did not get expected value for reduce scatter (in place)\n" );
-           fprintf( stdout, "[%d] Got %d expected %d\n", rank, sendbuf[rank*mycount+i], sumval );
-       }
+        if (sendbuf[i] != sumval) {
+            err++;
+            fprintf( stdout, "Did not get expected value for reduce scatter (in place)\n" );
+            fprintf( stdout, "[%d] Got %d expected %d\n", rank, sendbuf[i], sumval );
+        }
     }
 
     free(sendbuf);