- MTest_Init( &argc, &argv );
-
- MPI_Op_create( uop, 0, &op );
-
- while (MTestGetIntracommGeneral( &comm, minsize, 1 )) {
- if (comm == MPI_COMM_NULL) continue;
-
- MPI_Comm_size( comm, &size );
- MPI_Comm_rank( comm, &rank );
-
- matSize = size; /* used by the user-defined operation */
- /* Only one matrix for now */
- count = 1;
-
- /* A single matrix, the size of the communicator */
- MPI_Type_contiguous( size*size, MPI_INT, &mattype );
- MPI_Type_commit( &mattype );
-
- buf = (int *)malloc( count * size * size * sizeof(int) );
- if (!buf) MPI_Abort( MPI_COMM_WORLD, 1 );
- bufout = (int *)malloc( count * size * size * sizeof(int) );
- if (!bufout) MPI_Abort( MPI_COMM_WORLD, 1 );
-
- for (root = 0; root < size; root ++) {
- initMat( comm, buf );
- MPI_Reduce( buf, bufout, count, mattype, op, root, comm );
- if (rank == root) {
- errs += isShiftLeft( comm, bufout );
- }
-
- /* Try the same test, but using MPI_IN_PLACE */
- initMat( comm, bufout );
- if (rank == root) {
- MPI_Reduce( MPI_IN_PLACE, bufout, count, mattype, op, root, comm );
- }
- else {
- MPI_Reduce( bufout, NULL, count, mattype, op, root, comm );
- }
- if (rank == root) {
- errs += isShiftLeft( comm, bufout );
- }
- }
-
- free( buf );
- free( bufout );
-
- MPI_Type_free( &mattype );
-
- MTestFreeComm( &comm );
+ MTest_Init(&argc, &argv);
+
+ MPI_Op_create(uop, 0, &op);
+
+ while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
+ if (comm == MPI_COMM_NULL)
+ continue;
+
+ MPI_Comm_size(comm, &size);
+ MPI_Comm_rank(comm, &rank);
+
+ matSize = size; /* used by the user-defined operation */
+ /* Only one matrix for now */
+ count = 1;
+
+ /* A single matrix, the size of the communicator */
+ MPI_Type_contiguous(size * size, MPI_INT, &mattype);
+ MPI_Type_commit(&mattype);
+
+ buf = (int *) malloc(count * size * size * sizeof(int));
+ if (!buf)
+ MPI_Abort(MPI_COMM_WORLD, 1);
+ bufout = (int *) malloc(count * size * size * sizeof(int));
+ if (!bufout)
+ MPI_Abort(MPI_COMM_WORLD, 1);
+
+ for (root = 0; root < size; root++) {
+ initMat(comm, buf);
+ MPI_Reduce(buf, bufout, count, mattype, op, root, comm);
+ if (rank == root) {
+ errs += isShiftLeft(comm, bufout);
+ }
+
+ /* Try the same test, but using MPI_IN_PLACE */
+ initMat(comm, bufout);
+ if (rank == root) {
+ MPI_Reduce(MPI_IN_PLACE, bufout, count, mattype, op, root, comm);
+ }
+ else {
+ MPI_Reduce(bufout, NULL, count, mattype, op, root, comm);
+ }
+ if (rank == root) {
+ errs += isShiftLeft(comm, bufout);
+ }
+ }
+
+ free(buf);
+ free(bufout);
+
+ MPI_Type_free(&mattype);
+
+ MTestFreeComm(&comm);