7 #include "../pt2pt/gcomm.h"
10 int main( int argc, char **argv )
12 int count, errcnt = 0, gerr = 0, toterr, size, rank;
16 int ncomm, ii, world_rank;
18 MPI_Init( &argc, &argv );
19 MPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
22 MakeComms( comms, 10, &ncomm, 0 );
23 for (ii=0; ii<ncomm; ii++) {
24 if (world_rank == 0 && verbose) printf( "Testing with communicator %d\n", ii );
28 MPI_Comm_size( comm, &size );
29 MPI_Comm_rank( comm, &rank );
33 if (world_rank == 0 && verbose) printf( "Testing MPI_SUM...\n" );
40 in = (int *)malloc( count * sizeof(int) );
41 out = (int *)malloc( count * sizeof(int) );
42 sol = (int *)malloc( count * sizeof(int) );
43 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
45 MPI_Allreduce( in, out, count, MPI_INT, MPI_SUM, comm );
46 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
47 if (fnderr) fprintf( stderr,
48 "(%d) Error for type MPI_INT and op MPI_SUM\n", world_rank );
58 in = (long *)malloc( count * sizeof(long) );
59 out = (long *)malloc( count * sizeof(long) );
60 sol = (long *)malloc( count * sizeof(long) );
61 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
63 MPI_Allreduce( in, out, count, MPI_LONG, MPI_SUM, comm );
64 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
65 if (fnderr) fprintf( stderr,
66 "(%d) Error for type MPI_LONG and op MPI_SUM\n", world_rank );
74 short *in, *out, *sol;
76 in = (short *)malloc( count * sizeof(short) );
77 out = (short *)malloc( count * sizeof(short) );
78 sol = (short *)malloc( count * sizeof(short) );
79 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
81 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_SUM, comm );
82 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
83 if (fnderr) fprintf( stderr,
84 "(%d) Error for type MPI_SHORT and op MPI_SUM\n", world_rank );
92 unsigned short *in, *out, *sol;
94 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
95 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
96 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
97 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
99 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_SUM, comm );
100 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
101 if (fnderr) fprintf( stderr,
102 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_SUM\n", world_rank );
110 unsigned *in, *out, *sol;
112 in = (unsigned *)malloc( count * sizeof(unsigned) );
113 out = (unsigned *)malloc( count * sizeof(unsigned) );
114 sol = (unsigned *)malloc( count * sizeof(unsigned) );
115 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
117 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_SUM, comm );
118 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
119 if (fnderr) fprintf( stderr,
120 "(%d) Error for type MPI_UNSIGNED and op MPI_SUM\n", world_rank );
128 unsigned long *in, *out, *sol;
130 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
131 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
132 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
133 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
135 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_SUM, comm );
136 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
137 if (fnderr) fprintf( stderr,
138 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_SUM\n", world_rank );
146 float *in, *out, *sol;
148 in = (float *)malloc( count * sizeof(float) );
149 out = (float *)malloc( count * sizeof(float) );
150 sol = (float *)malloc( count * sizeof(float) );
151 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
153 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_SUM, comm );
154 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
155 if (fnderr) fprintf( stderr,
156 "(%d) Error for type MPI_FLOAT and op MPI_SUM\n", world_rank );
164 double *in, *out, *sol;
166 in = (double *)malloc( count * sizeof(double) );
167 out = (double *)malloc( count * sizeof(double) );
168 sol = (double *)malloc( count * sizeof(double) );
169 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
171 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_SUM, comm );
172 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
173 if (fnderr) fprintf( stderr,
174 "(%d) Error for type MPI_DOUBLE and op MPI_SUM\n", world_rank );
183 printf( "Found %d errors on %d for MPI_SUM\n", errcnt, rank );
187 if (world_rank == 0 && verbose) printf( "Testing MPI_PROD...\n" );
192 in = (int *)malloc( count * sizeof(int) );
193 out = (int *)malloc( count * sizeof(int) );
194 sol = (int *)malloc( count * sizeof(int) );
195 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
197 MPI_Allreduce( in, out, count, MPI_INT, MPI_PROD, comm );
198 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
199 if (fnderr) fprintf( stderr,
200 "(%d) Error for type MPI_INT and op MPI_PROD\n", world_rank );
208 long *in, *out, *sol;
210 in = (long *)malloc( count * sizeof(long) );
211 out = (long *)malloc( count * sizeof(long) );
212 sol = (long *)malloc( count * sizeof(long) );
213 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
215 MPI_Allreduce( in, out, count, MPI_LONG, MPI_PROD, comm );
216 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
217 if (fnderr) fprintf( stderr,
218 "(%d) Error for type MPI_LONG and op MPI_PROD\n", world_rank );
226 short *in, *out, *sol;
228 in = (short *)malloc( count * sizeof(short) );
229 out = (short *)malloc( count * sizeof(short) );
230 sol = (short *)malloc( count * sizeof(short) );
231 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
233 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_PROD, comm );
234 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
235 if (fnderr) fprintf( stderr,
236 "(%d) Error for type MPI_SHORT and op MPI_PROD\n", world_rank );
244 unsigned short *in, *out, *sol;
246 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
247 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
248 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
249 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
251 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_PROD, comm );
252 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
253 if (fnderr) fprintf( stderr,
254 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_PROD\n", world_rank );
262 unsigned *in, *out, *sol;
264 in = (unsigned *)malloc( count * sizeof(unsigned) );
265 out = (unsigned *)malloc( count * sizeof(unsigned) );
266 sol = (unsigned *)malloc( count * sizeof(unsigned) );
267 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
269 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_PROD, comm );
270 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
271 if (fnderr) fprintf( stderr,
272 "(%d) Error for type MPI_UNSIGNED and op MPI_PROD\n", world_rank );
280 unsigned long *in, *out, *sol;
282 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
283 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
284 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
285 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
287 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_PROD, comm );
288 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
289 if (fnderr) fprintf( stderr,
290 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_PROD\n", world_rank );
298 float *in, *out, *sol;
300 in = (float *)malloc( count * sizeof(float) );
301 out = (float *)malloc( count * sizeof(float) );
302 sol = (float *)malloc( count * sizeof(float) );
303 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
305 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_PROD, comm );
306 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
307 if (fnderr) fprintf( stderr,
308 "(%d) Error for type MPI_FLOAT and op MPI_PROD\n", world_rank );
316 double *in, *out, *sol;
318 in = (double *)malloc( count * sizeof(double) );
319 out = (double *)malloc( count * sizeof(double) );
320 sol = (double *)malloc( count * sizeof(double) );
321 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
323 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_PROD, comm );
324 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
325 if (fnderr) fprintf( stderr,
326 "(%d) Error for type MPI_DOUBLE and op MPI_PROD\n", world_rank );
335 printf( "Found %d errors on %d for MPI_PROD\n", errcnt, rank );
339 if (world_rank == 0 && verbose) printf( "Testing MPI_MAX...\n" );
344 in = (int *)malloc( count * sizeof(int) );
345 out = (int *)malloc( count * sizeof(int) );
346 sol = (int *)malloc( count * sizeof(int) );
347 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
349 MPI_Allreduce( in, out, count, MPI_INT, MPI_MAX, comm );
350 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
351 if (fnderr) fprintf( stderr,
352 "(%d) Error for type MPI_INT and op MPI_MAX\n", world_rank );
360 long *in, *out, *sol;
362 in = (long *)malloc( count * sizeof(long) );
363 out = (long *)malloc( count * sizeof(long) );
364 sol = (long *)malloc( count * sizeof(long) );
365 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
367 MPI_Allreduce( in, out, count, MPI_LONG, MPI_MAX, comm );
368 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
369 if (fnderr) fprintf( stderr,
370 "(%d) Error for type MPI_LONG and op MPI_MAX\n", world_rank );
378 short *in, *out, *sol;
380 in = (short *)malloc( count * sizeof(short) );
381 out = (short *)malloc( count * sizeof(short) );
382 sol = (short *)malloc( count * sizeof(short) );
383 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
385 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MAX, comm );
386 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
387 if (fnderr) fprintf( stderr,
388 "(%d) Error for type MPI_SHORT and op MPI_MAX\n", world_rank );
396 unsigned short *in, *out, *sol;
398 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
399 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
400 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
401 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
403 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MAX, comm );
404 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
405 if (fnderr) fprintf( stderr,
406 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MAX\n", world_rank );
414 unsigned *in, *out, *sol;
416 in = (unsigned *)malloc( count * sizeof(unsigned) );
417 out = (unsigned *)malloc( count * sizeof(unsigned) );
418 sol = (unsigned *)malloc( count * sizeof(unsigned) );
419 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
421 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MAX, comm );
422 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
423 if (fnderr) fprintf( stderr,
424 "(%d) Error for type MPI_UNSIGNED and op MPI_MAX\n", world_rank );
432 unsigned long *in, *out, *sol;
434 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
435 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
436 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
437 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
439 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MAX, comm );
440 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
441 if (fnderr) fprintf( stderr,
442 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MAX\n", world_rank );
450 float *in, *out, *sol;
452 in = (float *)malloc( count * sizeof(float) );
453 out = (float *)malloc( count * sizeof(float) );
454 sol = (float *)malloc( count * sizeof(float) );
455 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
457 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MAX, comm );
458 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
459 if (fnderr) fprintf( stderr,
460 "(%d) Error for type MPI_FLOAT and op MPI_MAX\n", world_rank );
468 double *in, *out, *sol;
470 in = (double *)malloc( count * sizeof(double) );
471 out = (double *)malloc( count * sizeof(double) );
472 sol = (double *)malloc( count * sizeof(double) );
473 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
475 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MAX, comm );
476 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
477 if (fnderr) fprintf( stderr,
478 "(%d) Error for type MPI_DOUBLE and op MPI_MAX\n", world_rank );
487 printf( "Found %d errors on %d for MPI_MAX\n", errcnt, rank );
491 if (world_rank == 0 && verbose) printf( "Testing MPI_MIN...\n" );
496 in = (int *)malloc( count * sizeof(int) );
497 out = (int *)malloc( count * sizeof(int) );
498 sol = (int *)malloc( count * sizeof(int) );
499 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
501 MPI_Allreduce( in, out, count, MPI_INT, MPI_MIN, comm );
502 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
503 if (fnderr) fprintf( stderr,
504 "(%d) Error for type MPI_INT and op MPI_MIN\n", world_rank );
512 long *in, *out, *sol;
514 in = (long *)malloc( count * sizeof(long) );
515 out = (long *)malloc( count * sizeof(long) );
516 sol = (long *)malloc( count * sizeof(long) );
517 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
519 MPI_Allreduce( in, out, count, MPI_LONG, MPI_MIN, comm );
520 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
521 if (fnderr) fprintf( stderr,
522 "(%d) Error for type MPI_LONG and op MPI_MIN\n", world_rank );
530 short *in, *out, *sol;
532 in = (short *)malloc( count * sizeof(short) );
533 out = (short *)malloc( count * sizeof(short) );
534 sol = (short *)malloc( count * sizeof(short) );
535 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
537 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MIN, comm );
538 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
539 if (fnderr) fprintf( stderr,
540 "(%d) Error for type MPI_SHORT and op MPI_MIN\n", world_rank );
548 unsigned short *in, *out, *sol;
550 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
551 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
552 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
553 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
555 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MIN, comm );
556 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
557 if (fnderr) fprintf( stderr,
558 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MIN\n", world_rank );
566 unsigned *in, *out, *sol;
568 in = (unsigned *)malloc( count * sizeof(unsigned) );
569 out = (unsigned *)malloc( count * sizeof(unsigned) );
570 sol = (unsigned *)malloc( count * sizeof(unsigned) );
571 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
573 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MIN, comm );
574 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
575 if (fnderr) fprintf( stderr,
576 "(%d) Error for type MPI_UNSIGNED and op MPI_MIN\n", world_rank );
584 unsigned long *in, *out, *sol;
586 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
587 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
588 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
589 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
591 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MIN, comm );
592 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
593 if (fnderr) fprintf( stderr,
594 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MIN\n", world_rank );
602 float *in, *out, *sol;
604 in = (float *)malloc( count * sizeof(float) );
605 out = (float *)malloc( count * sizeof(float) );
606 sol = (float *)malloc( count * sizeof(float) );
607 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
609 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MIN, comm );
610 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
611 if (fnderr) fprintf( stderr,
612 "(%d) Error for type MPI_FLOAT and op MPI_MIN\n", world_rank );
620 double *in, *out, *sol;
622 in = (double *)malloc( count * sizeof(double) );
623 out = (double *)malloc( count * sizeof(double) );
624 sol = (double *)malloc( count * sizeof(double) );
625 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
627 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MIN, comm );
628 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
629 if (fnderr) fprintf( stderr,
630 "(%d) Error for type MPI_DOUBLE and op MPI_MIN\n", world_rank );
639 printf( "Found %d errors on %d for MPI_MIN\n", errcnt, rank );
643 if (world_rank == 0 && verbose) printf( "Testing MPI_LOR...\n" );
648 in = (int *)malloc( count * sizeof(int) );
649 out = (int *)malloc( count * sizeof(int) );
650 sol = (int *)malloc( count * sizeof(int) );
651 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
653 MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
654 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
655 if (fnderr) fprintf( stderr,
656 "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
664 long *in, *out, *sol;
666 in = (long *)malloc( count * sizeof(long) );
667 out = (long *)malloc( count * sizeof(long) );
668 sol = (long *)malloc( count * sizeof(long) );
669 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
671 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
672 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
673 if (fnderr) fprintf( stderr,
674 "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
682 short *in, *out, *sol;
684 in = (short *)malloc( count * sizeof(short) );
685 out = (short *)malloc( count * sizeof(short) );
686 sol = (short *)malloc( count * sizeof(short) );
687 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
689 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
690 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
691 if (fnderr) fprintf( stderr,
692 "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
700 unsigned short *in, *out, *sol;
702 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
703 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
704 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
705 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
707 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
708 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
709 if (fnderr) fprintf( stderr,
710 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
718 unsigned *in, *out, *sol;
720 in = (unsigned *)malloc( count * sizeof(unsigned) );
721 out = (unsigned *)malloc( count * sizeof(unsigned) );
722 sol = (unsigned *)malloc( count * sizeof(unsigned) );
723 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
725 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
726 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
727 if (fnderr) fprintf( stderr,
728 "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
736 unsigned long *in, *out, *sol;
738 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
739 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
740 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
741 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
743 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
744 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
745 if (fnderr) fprintf( stderr,
746 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
755 printf( "Found %d errors on %d for MPI_LOR(1)\n", errcnt, rank );
762 in = (int *)malloc( count * sizeof(int) );
763 out = (int *)malloc( count * sizeof(int) );
764 sol = (int *)malloc( count * sizeof(int) );
765 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
767 MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
768 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
769 if (fnderr) fprintf( stderr,
770 "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
778 long *in, *out, *sol;
780 in = (long *)malloc( count * sizeof(long) );
781 out = (long *)malloc( count * sizeof(long) );
782 sol = (long *)malloc( count * sizeof(long) );
783 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
785 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
786 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
787 if (fnderr) fprintf( stderr,
788 "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
796 short *in, *out, *sol;
798 in = (short *)malloc( count * sizeof(short) );
799 out = (short *)malloc( count * sizeof(short) );
800 sol = (short *)malloc( count * sizeof(short) );
801 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
803 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
804 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
805 if (fnderr) fprintf( stderr,
806 "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
814 unsigned short *in, *out, *sol;
816 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
817 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
818 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
819 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
821 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
822 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
823 if (fnderr) fprintf( stderr,
824 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
832 unsigned *in, *out, *sol;
834 in = (unsigned *)malloc( count * sizeof(unsigned) );
835 out = (unsigned *)malloc( count * sizeof(unsigned) );
836 sol = (unsigned *)malloc( count * sizeof(unsigned) );
837 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
839 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
840 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
841 if (fnderr) fprintf( stderr,
842 "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
850 unsigned long *in, *out, *sol;
852 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
853 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
854 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
855 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
857 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
858 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
859 if (fnderr) fprintf( stderr,
860 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
869 printf( "Found %d errors on %d for MPI_LOR(0)\n", errcnt, rank );
873 if (world_rank == 0 && verbose) printf( "Testing MPI_LXOR...\n" );
878 in = (int *)malloc( count * sizeof(int) );
879 out = (int *)malloc( count * sizeof(int) );
880 sol = (int *)malloc( count * sizeof(int) );
881 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
883 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
884 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
885 if (fnderr) fprintf( stderr,
886 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
894 long *in, *out, *sol;
896 in = (long *)malloc( count * sizeof(long) );
897 out = (long *)malloc( count * sizeof(long) );
898 sol = (long *)malloc( count * sizeof(long) );
899 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
901 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
902 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
903 if (fnderr) fprintf( stderr,
904 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
912 short *in, *out, *sol;
914 in = (short *)malloc( count * sizeof(short) );
915 out = (short *)malloc( count * sizeof(short) );
916 sol = (short *)malloc( count * sizeof(short) );
917 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
919 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
920 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
921 if (fnderr) fprintf( stderr,
922 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
930 unsigned short *in, *out, *sol;
932 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
933 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
934 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
935 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
937 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
938 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
939 if (fnderr) fprintf( stderr,
940 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
948 unsigned *in, *out, *sol;
950 in = (unsigned *)malloc( count * sizeof(unsigned) );
951 out = (unsigned *)malloc( count * sizeof(unsigned) );
952 sol = (unsigned *)malloc( count * sizeof(unsigned) );
953 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
955 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
956 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
957 if (fnderr) fprintf( stderr,
958 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
966 unsigned long *in, *out, *sol;
968 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
969 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
970 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
971 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
973 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
974 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
975 if (fnderr) fprintf( stderr,
976 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
985 printf( "Found %d errors on %d for MPI_LXOR(1)\n", errcnt, rank );
992 in = (int *)malloc( count * sizeof(int) );
993 out = (int *)malloc( count * sizeof(int) );
994 sol = (int *)malloc( count * sizeof(int) );
995 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
997 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
998 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
999 if (fnderr) fprintf( stderr,
1000 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
1008 long *in, *out, *sol;
1010 in = (long *)malloc( count * sizeof(long) );
1011 out = (long *)malloc( count * sizeof(long) );
1012 sol = (long *)malloc( count * sizeof(long) );
1013 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1015 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
1016 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1017 if (fnderr) fprintf( stderr,
1018 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
1026 short *in, *out, *sol;
1028 in = (short *)malloc( count * sizeof(short) );
1029 out = (short *)malloc( count * sizeof(short) );
1030 sol = (short *)malloc( count * sizeof(short) );
1031 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1033 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
1034 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1035 if (fnderr) fprintf( stderr,
1036 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
1044 unsigned short *in, *out, *sol;
1046 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1047 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1048 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1049 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1051 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
1052 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1053 if (fnderr) fprintf( stderr,
1054 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
1062 unsigned *in, *out, *sol;
1064 in = (unsigned *)malloc( count * sizeof(unsigned) );
1065 out = (unsigned *)malloc( count * sizeof(unsigned) );
1066 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1067 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1069 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
1070 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1071 if (fnderr) fprintf( stderr,
1072 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
1080 unsigned long *in, *out, *sol;
1082 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1083 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1084 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1085 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1087 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
1088 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1089 if (fnderr) fprintf( stderr,
1090 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
1099 printf( "Found %d errors on %d for MPI_LXOR(0)\n", errcnt, rank );
1104 int *in, *out, *sol;
1106 in = (int *)malloc( count * sizeof(int) );
1107 out = (int *)malloc( count * sizeof(int) );
1108 sol = (int *)malloc( count * sizeof(int) );
1109 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1111 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
1112 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1113 if (fnderr) fprintf( stderr,
1114 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
1122 long *in, *out, *sol;
1124 in = (long *)malloc( count * sizeof(long) );
1125 out = (long *)malloc( count * sizeof(long) );
1126 sol = (long *)malloc( count * sizeof(long) );
1127 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1129 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
1130 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1131 if (fnderr) fprintf( stderr,
1132 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
1140 short *in, *out, *sol;
1142 in = (short *)malloc( count * sizeof(short) );
1143 out = (short *)malloc( count * sizeof(short) );
1144 sol = (short *)malloc( count * sizeof(short) );
1145 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1147 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
1148 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1149 if (fnderr) fprintf( stderr,
1150 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
1158 unsigned short *in, *out, *sol;
1160 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1161 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1162 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1163 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1165 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
1166 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1167 if (fnderr) fprintf( stderr,
1168 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
1176 unsigned *in, *out, *sol;
1178 in = (unsigned *)malloc( count * sizeof(unsigned) );
1179 out = (unsigned *)malloc( count * sizeof(unsigned) );
1180 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1181 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1183 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
1184 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1185 if (fnderr) fprintf( stderr,
1186 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
1194 unsigned long *in, *out, *sol;
1196 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1197 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1198 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1199 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1201 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
1202 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1203 if (fnderr) fprintf( stderr,
1204 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
1213 printf( "Found %d errors on %d for MPI_LXOR(1-0)\n", errcnt, rank );
1217 if (world_rank == 0 && verbose) printf( "Testing MPI_LAND...\n" );
1220 int *in, *out, *sol;
1222 in = (int *)malloc( count * sizeof(int) );
1223 out = (int *)malloc( count * sizeof(int) );
1224 sol = (int *)malloc( count * sizeof(int) );
1225 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1227 MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
1228 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1229 if (fnderr) fprintf( stderr,
1230 "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
1238 long *in, *out, *sol;
1240 in = (long *)malloc( count * sizeof(long) );
1241 out = (long *)malloc( count * sizeof(long) );
1242 sol = (long *)malloc( count * sizeof(long) );
1243 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1245 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
1246 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1247 if (fnderr) fprintf( stderr,
1248 "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
1256 short *in, *out, *sol;
1258 in = (short *)malloc( count * sizeof(short) );
1259 out = (short *)malloc( count * sizeof(short) );
1260 sol = (short *)malloc( count * sizeof(short) );
1261 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1263 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
1264 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1265 if (fnderr) fprintf( stderr,
1266 "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
1274 unsigned short *in, *out, *sol;
1276 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1277 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1278 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1279 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1281 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
1282 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1283 if (fnderr) fprintf( stderr,
1284 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
1292 unsigned *in, *out, *sol;
1294 in = (unsigned *)malloc( count * sizeof(unsigned) );
1295 out = (unsigned *)malloc( count * sizeof(unsigned) );
1296 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1297 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1299 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
1300 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1301 if (fnderr) fprintf( stderr,
1302 "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
1310 unsigned long *in, *out, *sol;
1312 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1313 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1314 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1315 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1317 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
1318 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1319 if (fnderr) fprintf( stderr,
1320 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
1329 printf( "Found %d errors on %d for MPI_LAND(0)\n", errcnt, rank );
1334 int *in, *out, *sol;
1336 in = (int *)malloc( count * sizeof(int) );
1337 out = (int *)malloc( count * sizeof(int) );
1338 sol = (int *)malloc( count * sizeof(int) );
1339 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1341 MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
1342 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1343 if (fnderr) fprintf( stderr,
1344 "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
1352 long *in, *out, *sol;
1354 in = (long *)malloc( count * sizeof(long) );
1355 out = (long *)malloc( count * sizeof(long) );
1356 sol = (long *)malloc( count * sizeof(long) );
1357 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1359 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
1360 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1361 if (fnderr) fprintf( stderr,
1362 "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
1370 short *in, *out, *sol;
1372 in = (short *)malloc( count * sizeof(short) );
1373 out = (short *)malloc( count * sizeof(short) );
1374 sol = (short *)malloc( count * sizeof(short) );
1375 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1377 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
1378 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1379 if (fnderr) fprintf( stderr,
1380 "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
1388 unsigned short *in, *out, *sol;
1390 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1391 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1392 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1393 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1395 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
1396 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1397 if (fnderr) fprintf( stderr,
1398 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
1406 unsigned *in, *out, *sol;
1408 in = (unsigned *)malloc( count * sizeof(unsigned) );
1409 out = (unsigned *)malloc( count * sizeof(unsigned) );
1410 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1411 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1413 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
1414 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1415 if (fnderr) fprintf( stderr,
1416 "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
1424 unsigned long *in, *out, *sol;
1426 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1427 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1428 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1429 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1431 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
1432 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1433 if (fnderr) fprintf( stderr,
1434 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
1443 printf( "Found %d errors on %d for MPI_LAND(1)\n", errcnt, rank );
1447 if (world_rank == 0 && verbose) printf( "Testing MPI_BOR...\n" );
1450 int *in, *out, *sol;
1452 in = (int *)malloc( count * sizeof(int) );
1453 out = (int *)malloc( count * sizeof(int) );
1454 sol = (int *)malloc( count * sizeof(int) );
1455 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1457 MPI_Allreduce( in, out, count, MPI_INT, MPI_BOR, comm );
1458 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1459 if (fnderr) fprintf( stderr,
1460 "(%d) Error for type MPI_INT and op MPI_BOR\n", world_rank );
1468 long *in, *out, *sol;
1470 in = (long *)malloc( count * sizeof(long) );
1471 out = (long *)malloc( count * sizeof(long) );
1472 sol = (long *)malloc( count * sizeof(long) );
1473 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1475 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BOR, comm );
1476 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1477 if (fnderr) fprintf( stderr,
1478 "(%d) Error for type MPI_LONG and op MPI_BOR\n", world_rank );
1486 short *in, *out, *sol;
1488 in = (short *)malloc( count * sizeof(short) );
1489 out = (short *)malloc( count * sizeof(short) );
1490 sol = (short *)malloc( count * sizeof(short) );
1491 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1493 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BOR, comm );
1494 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1495 if (fnderr) fprintf( stderr,
1496 "(%d) Error for type MPI_SHORT and op MPI_BOR\n", world_rank );
1504 unsigned short *in, *out, *sol;
1506 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1507 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1508 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1509 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1511 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BOR, comm );
1512 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1513 if (fnderr) fprintf( stderr,
1514 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BOR\n", world_rank );
1522 unsigned *in, *out, *sol;
1524 in = (unsigned *)malloc( count * sizeof(unsigned) );
1525 out = (unsigned *)malloc( count * sizeof(unsigned) );
1526 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1527 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1529 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BOR, comm );
1530 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1531 if (fnderr) fprintf( stderr,
1532 "(%d) Error for type MPI_UNSIGNED and op MPI_BOR\n", world_rank );
1540 unsigned long *in, *out, *sol;
1542 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1543 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1544 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1545 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1547 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BOR, comm );
1548 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1549 if (fnderr) fprintf( stderr,
1550 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BOR\n", world_rank );
1558 unsigned char *in, *out, *sol;
1560 in = (unsigned char *)malloc( count * sizeof(unsigned char) );
1561 out = (unsigned char *)malloc( count * sizeof(unsigned char) );
1562 sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
1563 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1565 MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BOR, comm );
1566 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1567 if (fnderr) fprintf( stderr,
1568 "(%d) Error for type MPI_BYTE and op MPI_BOR\n", world_rank );
1577 printf( "Found %d errors on %d for MPI_BOR(1)\n", errcnt, rank );
1581 if (world_rank == 0 && verbose) printf( "Testing MPI_BAND...\n" );
1584 int *in, *out, *sol;
1586 in = (int *)malloc( count * sizeof(int) );
1587 out = (int *)malloc( count * sizeof(int) );
1588 sol = (int *)malloc( count * sizeof(int) );
1589 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1591 MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
1592 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1593 if (fnderr) fprintf( stderr,
1594 "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
1602 long *in, *out, *sol;
1604 in = (long *)malloc( count * sizeof(long) );
1605 out = (long *)malloc( count * sizeof(long) );
1606 sol = (long *)malloc( count * sizeof(long) );
1607 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1609 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
1610 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1611 if (fnderr) fprintf( stderr,
1612 "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
1620 short *in, *out, *sol;
1622 in = (short *)malloc( count * sizeof(short) );
1623 out = (short *)malloc( count * sizeof(short) );
1624 sol = (short *)malloc( count * sizeof(short) );
1625 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1627 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
1628 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1629 if (fnderr) fprintf( stderr,
1630 "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
1638 unsigned short *in, *out, *sol;
1640 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1641 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1642 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1643 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1645 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
1646 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1647 if (fnderr) fprintf( stderr,
1648 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
1656 unsigned *in, *out, *sol;
1658 in = (unsigned *)malloc( count * sizeof(unsigned) );
1659 out = (unsigned *)malloc( count * sizeof(unsigned) );
1660 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1661 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1663 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
1664 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1665 if (fnderr) fprintf( stderr,
1666 "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
1674 unsigned long *in, *out, *sol;
1676 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1677 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1678 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1679 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1681 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
1682 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1683 if (fnderr) fprintf( stderr,
1684 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
1692 unsigned char *in, *out, *sol;
1694 in = (unsigned char *)malloc( count * sizeof(unsigned char) );
1695 out = (unsigned char *)malloc( count * sizeof(unsigned char) );
1696 sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
1697 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1699 MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BAND, comm );
1700 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1701 if (fnderr) fprintf( stderr,
1702 "(%d) Error for type MPI_BYTE and op MPI_BAND\n", world_rank );
1711 printf( "Found %d errors on %d for MPI_BAND(1)\n", errcnt, rank );
1716 int *in, *out, *sol;
1718 in = (int *)malloc( count * sizeof(int) );
1719 out = (int *)malloc( count * sizeof(int) );
1720 sol = (int *)malloc( count * sizeof(int) );
1721 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1723 MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
1724 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1725 if (fnderr) fprintf( stderr,
1726 "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
1734 long *in, *out, *sol;
1736 in = (long *)malloc( count * sizeof(long) );
1737 out = (long *)malloc( count * sizeof(long) );
1738 sol = (long *)malloc( count * sizeof(long) );
1739 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1741 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
1742 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1743 if (fnderr) fprintf( stderr,
1744 "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
1752 short *in, *out, *sol;
1754 in = (short *)malloc( count * sizeof(short) );
1755 out = (short *)malloc( count * sizeof(short) );
1756 sol = (short *)malloc( count * sizeof(short) );
1757 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1759 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
1760 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1761 if (fnderr) fprintf( stderr,
1762 "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
1770 unsigned short *in, *out, *sol;
1772 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1773 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1774 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1775 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1777 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
1778 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1779 if (fnderr) fprintf( stderr,
1780 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
1788 unsigned *in, *out, *sol;
1790 in = (unsigned *)malloc( count * sizeof(unsigned) );
1791 out = (unsigned *)malloc( count * sizeof(unsigned) );
1792 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1793 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1795 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
1796 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1797 if (fnderr) fprintf( stderr,
1798 "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
1806 unsigned long *in, *out, *sol;
1808 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1809 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1810 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1811 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1813 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
1814 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1815 if (fnderr) fprintf( stderr,
1816 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
1825 printf( "Found %d errors on %d for MPI_BAND(0)\n", errcnt, rank );
1829 if (world_rank == 0 && verbose) printf( "Testing MPI_BXOR...\n" );
1832 int *in, *out, *sol;
1834 in = (int *)malloc( count * sizeof(int) );
1835 out = (int *)malloc( count * sizeof(int) );
1836 sol = (int *)malloc( count * sizeof(int) );
1837 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1839 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
1840 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1841 if (fnderr) fprintf( stderr,
1842 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
1850 long *in, *out, *sol;
1852 in = (long *)malloc( count * sizeof(long) );
1853 out = (long *)malloc( count * sizeof(long) );
1854 sol = (long *)malloc( count * sizeof(long) );
1855 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1857 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
1858 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1859 if (fnderr) fprintf( stderr,
1860 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
1868 short *in, *out, *sol;
1870 in = (short *)malloc( count * sizeof(short) );
1871 out = (short *)malloc( count * sizeof(short) );
1872 sol = (short *)malloc( count * sizeof(short) );
1873 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1875 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
1876 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1877 if (fnderr) fprintf( stderr,
1878 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
1886 unsigned short *in, *out, *sol;
1888 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1889 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1890 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1891 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1893 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
1894 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1895 if (fnderr) fprintf( stderr,
1896 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
1904 unsigned *in, *out, *sol;
1906 in = (unsigned *)malloc( count * sizeof(unsigned) );
1907 out = (unsigned *)malloc( count * sizeof(unsigned) );
1908 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1909 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1911 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
1912 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1913 if (fnderr) fprintf( stderr,
1914 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
1922 unsigned long *in, *out, *sol;
1924 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1925 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1926 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1927 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1929 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
1930 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1931 if (fnderr) fprintf( stderr,
1932 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
1941 printf( "Found %d errors on %d for MPI_BXOR(1)\n", errcnt, rank );
1946 int *in, *out, *sol;
1948 in = (int *)malloc( count * sizeof(int) );
1949 out = (int *)malloc( count * sizeof(int) );
1950 sol = (int *)malloc( count * sizeof(int) );
1951 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1953 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
1954 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1955 if (fnderr) fprintf( stderr,
1956 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
1964 long *in, *out, *sol;
1966 in = (long *)malloc( count * sizeof(long) );
1967 out = (long *)malloc( count * sizeof(long) );
1968 sol = (long *)malloc( count * sizeof(long) );
1969 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1971 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
1972 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1973 if (fnderr) fprintf( stderr,
1974 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
1982 short *in, *out, *sol;
1984 in = (short *)malloc( count * sizeof(short) );
1985 out = (short *)malloc( count * sizeof(short) );
1986 sol = (short *)malloc( count * sizeof(short) );
1987 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1989 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
1990 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1991 if (fnderr) fprintf( stderr,
1992 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
2000 unsigned short *in, *out, *sol;
2002 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
2003 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
2004 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
2005 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2007 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
2008 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2009 if (fnderr) fprintf( stderr,
2010 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
2018 unsigned *in, *out, *sol;
2020 in = (unsigned *)malloc( count * sizeof(unsigned) );
2021 out = (unsigned *)malloc( count * sizeof(unsigned) );
2022 sol = (unsigned *)malloc( count * sizeof(unsigned) );
2023 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2025 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
2026 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2027 if (fnderr) fprintf( stderr,
2028 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
2036 unsigned long *in, *out, *sol;
2038 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
2039 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
2040 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
2041 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2043 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
2044 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2045 if (fnderr) fprintf( stderr,
2046 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
2055 printf( "Found %d errors on %d for MPI_BXOR(0)\n", errcnt, rank );
2060 int *in, *out, *sol;
2062 in = (int *)malloc( count * sizeof(int) );
2063 out = (int *)malloc( count * sizeof(int) );
2064 sol = (int *)malloc( count * sizeof(int) );
2065 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2067 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
2068 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2069 if (fnderr) fprintf( stderr,
2070 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
2078 long *in, *out, *sol;
2080 in = (long *)malloc( count * sizeof(long) );
2081 out = (long *)malloc( count * sizeof(long) );
2082 sol = (long *)malloc( count * sizeof(long) );
2083 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2085 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
2086 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2087 if (fnderr) fprintf( stderr,
2088 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
2096 short *in, *out, *sol;
2098 in = (short *)malloc( count * sizeof(short) );
2099 out = (short *)malloc( count * sizeof(short) );
2100 sol = (short *)malloc( count * sizeof(short) );
2101 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2103 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
2104 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2105 if (fnderr) fprintf( stderr,
2106 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
2114 unsigned short *in, *out, *sol;
2116 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
2117 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
2118 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
2119 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2121 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
2122 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2123 if (fnderr) fprintf( stderr,
2124 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
2132 unsigned *in, *out, *sol;
2134 in = (unsigned *)malloc( count * sizeof(unsigned) );
2135 out = (unsigned *)malloc( count * sizeof(unsigned) );
2136 sol = (unsigned *)malloc( count * sizeof(unsigned) );
2137 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2139 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
2140 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2141 if (fnderr) fprintf( stderr,
2142 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
2150 unsigned long *in, *out, *sol;
2152 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
2153 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
2154 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
2155 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2157 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
2158 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2159 if (fnderr) fprintf( stderr,
2160 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
2169 printf( "Found %d errors on %d for MPI_BXOR(1-0)\n", errcnt, rank );
2173 if (world_rank == 0 && verbose) printf( "Testing MPI_MAXLOC...\n" );
2176 struct int_test { int a; int b; } *in, *out, *sol;
2178 in = (struct int_test *)malloc( count * sizeof(struct int_test) );
2179 out = (struct int_test *)malloc( count * sizeof(struct int_test) );
2180 sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
2181 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2182 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2183 (out + i)->a = 0; (out + i)->b = -1; }
2184 MPI_Allreduce( in, out, count, MPI_2INT, MPI_MAXLOC, comm );
2185 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2186 (out + i)->b != (sol + i)->b) {
2188 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2189 (int)((sol + i)->a),
2190 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2192 if (fnderr) fprintf( stderr,
2193 "(%d) Error for type MPI_2INT and op MPI_MAXLOC (%d of %d wrong)\n",
2194 world_rank, fnderr, count );
2202 struct long_test { long a; int b; } *in, *out, *sol;
2204 in = (struct long_test *)malloc( count * sizeof(struct long_test) );
2205 out = (struct long_test *)malloc( count * sizeof(struct long_test) );
2206 sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
2207 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2208 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2209 (out + i)->a = 0; (out + i)->b = -1; }
2210 MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MAXLOC, comm );
2211 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2212 (out + i)->b != (sol + i)->b) {
2214 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2215 (int)((sol + i)->a),
2216 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2218 if (fnderr) fprintf( stderr,
2219 "(%d) Error for type MPI_LONG_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2220 world_rank, fnderr, count );
2228 struct short_test { short a; int b; } *in, *out, *sol;
2230 in = (struct short_test *)malloc( count * sizeof(struct short_test) );
2231 out = (struct short_test *)malloc( count * sizeof(struct short_test) );
2232 sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
2233 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2234 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2235 (out + i)->a = 0; (out + i)->b = -1; }
2236 MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MAXLOC, comm );
2237 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2238 (out + i)->b != (sol + i)->b) {
2240 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2241 (int)((sol + i)->a),
2242 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2244 if (fnderr) fprintf( stderr,
2245 "(%d) Error for type MPI_SHORT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2246 world_rank, fnderr, count );
2254 struct float_test { float a; int b; } *in, *out, *sol;
2256 in = (struct float_test *)malloc( count * sizeof(struct float_test) );
2257 out = (struct float_test *)malloc( count * sizeof(struct float_test) );
2258 sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
2259 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2260 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2261 (out + i)->a = 0; (out + i)->b = -1; }
2262 MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MAXLOC, comm );
2263 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2264 (out + i)->b != (sol + i)->b) {
2266 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2267 (int)((sol + i)->a),
2268 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2270 if (fnderr) fprintf( stderr,
2271 "(%d) Error for type MPI_FLOAT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2272 world_rank, fnderr, count );
2280 struct double_test { double a; int b; } *in, *out, *sol;
2282 in = (struct double_test *)malloc( count * sizeof(struct double_test) );
2283 out = (struct double_test *)malloc( count * sizeof(struct double_test) );
2284 sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
2285 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2286 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2287 (out + i)->a = 0; (out + i)->b = -1; }
2288 MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MAXLOC, comm );
2289 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2290 (out + i)->b != (sol + i)->b) {
2292 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2293 (int)((sol + i)->a),
2294 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2296 if (fnderr) fprintf( stderr,
2297 "(%d) Error for type MPI_DOUBLE_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2298 world_rank, fnderr, count );
2307 printf( "Found %d errors on %d for MPI_MAXLOC\n", errcnt, rank );
2311 if (world_rank == 0 && verbose) printf( "Testing MPI_MINLOC...\n" );
2315 struct int_test { int a; int b; } *in, *out, *sol;
2317 in = (struct int_test *)malloc( count * sizeof(struct int_test) );
2318 out = (struct int_test *)malloc( count * sizeof(struct int_test) );
2319 sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
2320 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2321 (sol + i)->a = i; (sol + i)->b = 0;
2322 (out + i)->a = 0; (out + i)->b = -1; }
2323 MPI_Allreduce( in, out, count, MPI_2INT, MPI_MINLOC, comm );
2324 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2325 (out + i)->b != (sol + i)->b) {
2327 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2328 (int)((sol + i)->a),
2329 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2331 if (fnderr) fprintf( stderr,
2332 "(%d) Error for type MPI_2INT and op MPI_MINLOC (%d of %d wrong)\n",
2333 world_rank, fnderr, count );
2341 struct long_test { long a; int b; } *in, *out, *sol;
2343 in = (struct long_test *)malloc( count * sizeof(struct long_test) );
2344 out = (struct long_test *)malloc( count * sizeof(struct long_test) );
2345 sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
2346 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2347 (sol + i)->a = i; (sol + i)->b = 0;
2348 (out + i)->a = 0; (out + i)->b = -1; }
2349 MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MINLOC, comm );
2350 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2351 (out + i)->b != (sol + i)->b) {
2353 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2354 (int)((sol + i)->a),
2355 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2357 if (fnderr) fprintf( stderr,
2358 "(%d) Error for type MPI_LONG_INT and op MPI_MINLOC (%d of %d wrong)\n",
2359 world_rank, fnderr, count );
2367 struct short_test { short a; int b; } *in, *out, *sol;
2369 in = (struct short_test *)malloc( count * sizeof(struct short_test) );
2370 out = (struct short_test *)malloc( count * sizeof(struct short_test) );
2371 sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
2372 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2373 (sol + i)->a = i; (sol + i)->b = 0;
2374 (out + i)->a = 0; (out + i)->b = -1; }
2375 MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MINLOC, comm );
2376 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2377 (out + i)->b != (sol + i)->b) {
2379 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2380 (int)((sol + i)->a),
2381 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2383 if (fnderr) fprintf( stderr,
2384 "(%d) Error for type MPI_SHORT_INT and op MPI_MINLOC (%d of %d wrong)\n",
2385 world_rank, fnderr, count );
2393 struct float_test { float a; int b; } *in, *out, *sol;
2395 in = (struct float_test *)malloc( count * sizeof(struct float_test) );
2396 out = (struct float_test *)malloc( count * sizeof(struct float_test) );
2397 sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
2398 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2399 (sol + i)->a = i; (sol + i)->b = 0;
2400 (out + i)->a = 0; (out + i)->b = -1; }
2401 MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MINLOC, comm );
2402 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2403 (out + i)->b != (sol + i)->b) {
2405 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2406 (int)((sol + i)->a),
2407 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2409 if (fnderr) fprintf( stderr,
2410 "(%d) Error for type MPI_FLOAT_INT and op MPI_MINLOC (%d of %d wrong)\n",
2411 world_rank, fnderr, count );
2419 struct double_test { double a; int b; } *in, *out, *sol;
2421 in = (struct double_test *)malloc( count * sizeof(struct double_test) );
2422 out = (struct double_test *)malloc( count * sizeof(struct double_test) );
2423 sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
2424 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2425 (sol + i)->a = i; (sol + i)->b = 0;
2426 (out + i)->a = 0; (out + i)->b = -1; }
2427 MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MINLOC, comm );
2428 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2429 (out + i)->b != (sol + i)->b) {
2431 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2432 (int)((sol + i)->a),
2433 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2435 if (fnderr) fprintf( stderr,
2436 "(%d) Error for type MPI_DOUBLE_INT and op MPI_MINLOC (%d of %d wrong)\n",
2437 world_rank, fnderr, count );
2446 printf( "Found %d errors on %d for MPI_MINLOC\n", errcnt, rank );
2451 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
2452 printf( "Found %d errors overall on %d\n", gerr, rank );
2454 MPI_Allreduce( &gerr, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
2455 if (world_rank == 0) {
2457 printf( " No Errors\n" );
2460 printf (" Found %d errors\n", toterr );
2463 FreeComms( comms, ncomm );