-
- 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 < size; count ++ ) {
-
- /* Allocate the matrices */
- buf = (int *)malloc( count * 9 * sizeof(int) );
- if (!buf) {
- MPI_Abort( MPI_COMM_WORLD, 1 );
- exit(1);
- }
-
- bufout = (int *)malloc( count * 9 * sizeof(int) );
- if (!bufout) {
- MPI_Abort( MPI_COMM_WORLD, 1 );
- exit(1);
- }
-
- for (i=0; i < count; i++) {
- initMat( rank, size, i, &buf[i*9] );
- }
-
- MPI_Allreduce( buf, bufout, count, mattype, op, comm );
- errs += checkResult( count, bufout, "" );
-
- /* Try the same test, but using MPI_IN_PLACE */
- for (i=0; i < count; i++) {
- initMat( rank, size, i, &bufout[i*9] );
- }
- MPI_Allreduce( MPI_IN_PLACE, bufout, count, mattype, op, comm );
- errs += checkResult( count, bufout, "IN_PLACE" );
-
- free( buf );
- free( bufout );
- }
- MTestFreeComm( &comm );
+
+ 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 < size; count++) {
+
+ /* Allocate the matrices */
+ buf = (int *) malloc(count * 9 * sizeof(int));
+ if (!buf) {
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
+ bufout = (int *) malloc(count * 9 * sizeof(int));
+ if (!bufout) {
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ }
+
+ for (i = 0; i < count; i++) {
+ initMat(rank, size, i, &buf[i * 9]);
+ }
+
+ MPI_Allreduce(buf, bufout, count, mattype, op, comm);
+ errs += checkResult(count, bufout, "");
+
+ /* Try the same test, but using MPI_IN_PLACE */
+ for (i = 0; i < count; i++) {
+ initMat(rank, size, i, &bufout[i * 9]);
+ }
+ MPI_Allreduce(MPI_IN_PLACE, bufout, count, mattype, op, comm);
+ errs += checkResult(count, bufout, "IN_PLACE");
+
+ free(buf);
+ free(bufout);
+ }
+ MTestFreeComm(&comm);