- while (MTestGetIntracommGeneral( &comm, minsize, 1 )) {
- if (comm == MPI_COMM_NULL) continue;
- MPI_Comm_size( comm, &size );
- MPI_Comm_rank( comm, &rank );
-
- for (count = 1; count < 65000; count = count * 2) {
- /* Contiguous data */
- buf = (int *)malloc( count * sizeof(int) );
- for (i=0; i<count; i++) buf[i] = rank + i;
- MPI_Allreduce( MPI_IN_PLACE, buf, count, MPI_INT, op, comm );
- /* Check the results */
- for (i=0; i<count; i++) {
- int result = i * size + (size*(size-1))/2;
- if (buf[i] != result) {
- errs ++;
- if (errs < 10) {
- fprintf( stderr, "buf[%d] = %d expected %d\n",
- i, buf[i], result );
- }
- }
- }
- free( buf );
- }
- MTestFreeComm( &comm );
+ for (count = 1; count < 65000; count = count * 2) {
+ /* Contiguous data */
+ buf = (int *) malloc(count * sizeof(int));
+ for (i = 0; i < count; i++)
+ buf[i] = rank + i;
+ MPI_Allreduce(MPI_IN_PLACE, buf, count, MPI_INT, op, comm);
+ /* Check the results */
+ for (i = 0; i < count; i++) {
+ int result = i * size + (size * (size - 1)) / 2;
+ if (buf[i] != result) {
+ errs++;
+ if (errs < 10) {
+ fprintf(stderr, "buf[%d] = %d expected %d\n", i, buf[i], result);
+ }
+ }
+ }
+ free(buf);
+ }
+ MTestFreeComm(&comm);