- struct shortint { short val; int loc; } cinbuf[3], coutbuf[3];
-
- cinbuf[0].val = 1;
- cinbuf[0].loc = rank;
- cinbuf[1].val = 0;
- cinbuf[1].loc = rank;
- cinbuf[2].val = rank;
- cinbuf[2].loc = rank;
-
- coutbuf[0].val = 0;
- coutbuf[0].loc = -1;
- coutbuf[1].val = 1;
- coutbuf[1].loc = -1;
- coutbuf[2].val = 1;
- coutbuf[2].loc = -1;
- MPI_Reduce( cinbuf, coutbuf, 3, MPI_SHORT_INT, MPI_MAXLOC, 0, comm );
- if (rank == 0) {
- if (coutbuf[0].val != 1 || coutbuf[0].loc != 0) {
- errs++;
- fprintf( stderr, "short-int MAXLOC(1) test failed\n" );
- }
- if (coutbuf[1].val != 0) {
- errs++;
- fprintf( stderr, "short-int MAXLOC(0) test failed, value = %d, should be zero\n", coutbuf[1].val );
- }
- if (coutbuf[1].loc != 0) {
- errs++;
- fprintf( stderr, "short-int MAXLOC(0) test failed, location of max = %d, should be zero\n", coutbuf[1].loc );
- }
- if (coutbuf[2].val != size-1) {
- errs++;
- fprintf( stderr, "short-int MAXLOC(>) test failed, value = %d, should be %d\n", coutbuf[2].val, size-1 );
- }
- if (coutbuf[2].loc != size -1) {
- errs++;
- fprintf( stderr, "short-int MAXLOC(>) test failed, location of max = %d, should be %d\n", coutbuf[2].loc, size-1 );
- }
- }
+ struct shortint {
+ short val;
+ int loc;
+ } cinbuf[3], coutbuf[3];
+
+ cinbuf[0].val = 1;
+ cinbuf[0].loc = rank;
+ cinbuf[1].val = 0;
+ cinbuf[1].loc = rank;
+ cinbuf[2].val = rank;
+ cinbuf[2].loc = rank;
+
+ coutbuf[0].val = 0;
+ coutbuf[0].loc = -1;
+ coutbuf[1].val = 1;
+ coutbuf[1].loc = -1;
+ coutbuf[2].val = 1;
+ coutbuf[2].loc = -1;
+ MPI_Reduce(cinbuf, coutbuf, 3, MPI_SHORT_INT, MPI_MAXLOC, 0, comm);
+ if (rank == 0) {
+ if (coutbuf[0].val != 1 || coutbuf[0].loc != 0) {
+ errs++;
+ fprintf(stderr, "short-int MAXLOC(1) test failed\n");
+ }
+ if (coutbuf[1].val != 0) {
+ errs++;
+ fprintf(stderr, "short-int MAXLOC(0) test failed, value = %d, should be zero\n",
+ coutbuf[1].val);
+ }
+ if (coutbuf[1].loc != 0) {
+ errs++;
+ fprintf(stderr,
+ "short-int MAXLOC(0) test failed, location of max = %d, should be zero\n",
+ coutbuf[1].loc);
+ }
+ if (coutbuf[2].val != size - 1) {
+ errs++;
+ fprintf(stderr, "short-int MAXLOC(>) test failed, value = %d, should be %d\n",
+ coutbuf[2].val, size - 1);
+ }
+ if (coutbuf[2].loc != size - 1) {
+ errs++;
+ fprintf(stderr,
+ "short-int MAXLOC(>) test failed, location of max = %d, should be %d\n",
+ coutbuf[2].loc, size - 1);
+ }
+ }