7 #include "../pt2pt/gcomm.h"
10 int main( int argc, char **argv )
12 int count, errcnt = 0, gerr = 0, toterr, size, rank;
17 MPI_Init( &argc, &argv );
18 MPI_Comm_rank( MPI_COMM_WORLD, &world_rank );
21 //MakeComms( comms, 10, &ncomm, 0 );
22 //for (ii=0; ii<ncomm; ii++) {
23 comm = MPI_COMM_WORLD;
26 MPI_Comm_size( comm, &size );
27 MPI_Comm_rank( comm, &rank );
31 if (world_rank == 0 && verbose) printf( "Testing MPI_SUM...\n" );
38 in = (int *)malloc( count * sizeof(int) );
39 out = (int *)malloc( count * sizeof(int) );
40 sol = (int *)malloc( count * sizeof(int) );
41 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
43 MPI_Allreduce( in, out, count, MPI_INT, MPI_SUM, comm );
44 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
45 if (fnderr) fprintf( stderr,
46 "(%d) Error for type MPI_INT and op MPI_SUM\n", world_rank );
56 in = (long *)malloc( count * sizeof(long) );
57 out = (long *)malloc( count * sizeof(long) );
58 sol = (long *)malloc( count * sizeof(long) );
59 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
61 MPI_Allreduce( in, out, count, MPI_LONG, MPI_SUM, comm );
62 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
63 if (fnderr) fprintf( stderr,
64 "(%d) Error for type MPI_LONG and op MPI_SUM\n", world_rank );
72 short *in, *out, *sol;
74 in = (short *)malloc( count * sizeof(short) );
75 out = (short *)malloc( count * sizeof(short) );
76 sol = (short *)malloc( count * sizeof(short) );
77 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
79 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_SUM, comm );
80 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
81 if (fnderr) fprintf( stderr,
82 "(%d) Error for type MPI_SHORT and op MPI_SUM\n", world_rank );
90 unsigned short *in, *out, *sol;
92 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
93 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
94 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
95 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
97 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_SUM, comm );
98 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
99 if (fnderr) fprintf( stderr,
100 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_SUM\n", world_rank );
108 unsigned *in, *out, *sol;
110 in = (unsigned *)malloc( count * sizeof(unsigned) );
111 out = (unsigned *)malloc( count * sizeof(unsigned) );
112 sol = (unsigned *)malloc( count * sizeof(unsigned) );
113 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
115 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_SUM, comm );
116 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
117 if (fnderr) fprintf( stderr,
118 "(%d) Error for type MPI_UNSIGNED and op MPI_SUM\n", world_rank );
126 unsigned long *in, *out, *sol;
128 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
129 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
130 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
131 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
133 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_SUM, comm );
134 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
135 if (fnderr) fprintf( stderr,
136 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_SUM\n", world_rank );
144 float *in, *out, *sol;
146 in = (float *)malloc( count * sizeof(float) );
147 out = (float *)malloc( count * sizeof(float) );
148 sol = (float *)malloc( count * sizeof(float) );
149 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
151 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_SUM, comm );
152 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
153 if (fnderr) fprintf( stderr,
154 "(%d) Error for type MPI_FLOAT and op MPI_SUM\n", world_rank );
162 double *in, *out, *sol;
164 in = (double *)malloc( count * sizeof(double) );
165 out = (double *)malloc( count * sizeof(double) );
166 sol = (double *)malloc( count * sizeof(double) );
167 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = i*size;
169 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_SUM, comm );
170 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
171 if (fnderr) fprintf( stderr,
172 "(%d) Error for type MPI_DOUBLE and op MPI_SUM\n", world_rank );
181 printf( "Found %d errors on %d for MPI_SUM\n", errcnt, rank );
185 if (world_rank == 0 && verbose) printf( "Testing MPI_PROD...\n" );
190 in = (int *)malloc( count * sizeof(int) );
191 out = (int *)malloc( count * sizeof(int) );
192 sol = (int *)malloc( count * sizeof(int) );
193 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
195 MPI_Allreduce( in, out, count, MPI_INT, MPI_PROD, comm );
196 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
197 if (fnderr) fprintf( stderr,
198 "(%d) Error for type MPI_INT and op MPI_PROD\n", world_rank );
206 long *in, *out, *sol;
208 in = (long *)malloc( count * sizeof(long) );
209 out = (long *)malloc( count * sizeof(long) );
210 sol = (long *)malloc( count * sizeof(long) );
211 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
213 MPI_Allreduce( in, out, count, MPI_LONG, MPI_PROD, comm );
214 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
215 if (fnderr) fprintf( stderr,
216 "(%d) Error for type MPI_LONG and op MPI_PROD\n", world_rank );
224 short *in, *out, *sol;
226 in = (short *)malloc( count * sizeof(short) );
227 out = (short *)malloc( count * sizeof(short) );
228 sol = (short *)malloc( count * sizeof(short) );
229 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
231 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_PROD, comm );
232 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
233 if (fnderr) fprintf( stderr,
234 "(%d) Error for type MPI_SHORT and op MPI_PROD\n", world_rank );
242 unsigned short *in, *out, *sol;
244 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
245 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
246 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
247 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
249 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_PROD, comm );
250 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
251 if (fnderr) fprintf( stderr,
252 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_PROD\n", world_rank );
260 unsigned *in, *out, *sol;
262 in = (unsigned *)malloc( count * sizeof(unsigned) );
263 out = (unsigned *)malloc( count * sizeof(unsigned) );
264 sol = (unsigned *)malloc( count * sizeof(unsigned) );
265 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
267 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_PROD, comm );
268 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
269 if (fnderr) fprintf( stderr,
270 "(%d) Error for type MPI_UNSIGNED and op MPI_PROD\n", world_rank );
278 unsigned long *in, *out, *sol;
280 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
281 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
282 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
283 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
285 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_PROD, comm );
286 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
287 if (fnderr) fprintf( stderr,
288 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_PROD\n", world_rank );
296 float *in, *out, *sol;
298 in = (float *)malloc( count * sizeof(float) );
299 out = (float *)malloc( count * sizeof(float) );
300 sol = (float *)malloc( count * sizeof(float) );
301 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
303 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_PROD, comm );
304 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
305 if (fnderr) fprintf( stderr,
306 "(%d) Error for type MPI_FLOAT and op MPI_PROD\n", world_rank );
314 double *in, *out, *sol;
316 in = (double *)malloc( count * sizeof(double) );
317 out = (double *)malloc( count * sizeof(double) );
318 sol = (double *)malloc( count * sizeof(double) );
319 for (i=0; i<count; i++) { *(in + i) = i; *(sol + i) = (i > 0) ? (int)(pow((double)(i),(double)size)+0.1) : 0;
321 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_PROD, comm );
322 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
323 if (fnderr) fprintf( stderr,
324 "(%d) Error for type MPI_DOUBLE and op MPI_PROD\n", world_rank );
333 printf( "Found %d errors on %d for MPI_PROD\n", errcnt, rank );
337 if (world_rank == 0 && verbose) printf( "Testing MPI_MAX...\n" );
342 in = (int *)malloc( count * sizeof(int) );
343 out = (int *)malloc( count * sizeof(int) );
344 sol = (int *)malloc( count * sizeof(int) );
345 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
347 MPI_Allreduce( in, out, count, MPI_INT, MPI_MAX, comm );
348 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
349 if (fnderr) fprintf( stderr,
350 "(%d) Error for type MPI_INT and op MPI_MAX\n", world_rank );
358 long *in, *out, *sol;
360 in = (long *)malloc( count * sizeof(long) );
361 out = (long *)malloc( count * sizeof(long) );
362 sol = (long *)malloc( count * sizeof(long) );
363 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
365 MPI_Allreduce( in, out, count, MPI_LONG, MPI_MAX, comm );
366 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
367 if (fnderr) fprintf( stderr,
368 "(%d) Error for type MPI_LONG and op MPI_MAX\n", world_rank );
376 short *in, *out, *sol;
378 in = (short *)malloc( count * sizeof(short) );
379 out = (short *)malloc( count * sizeof(short) );
380 sol = (short *)malloc( count * sizeof(short) );
381 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
383 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MAX, comm );
384 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
385 if (fnderr) fprintf( stderr,
386 "(%d) Error for type MPI_SHORT and op MPI_MAX\n", world_rank );
394 unsigned short *in, *out, *sol;
396 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
397 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
398 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
399 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
401 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MAX, comm );
402 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
403 if (fnderr) fprintf( stderr,
404 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MAX\n", world_rank );
412 unsigned *in, *out, *sol;
414 in = (unsigned *)malloc( count * sizeof(unsigned) );
415 out = (unsigned *)malloc( count * sizeof(unsigned) );
416 sol = (unsigned *)malloc( count * sizeof(unsigned) );
417 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
419 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MAX, comm );
420 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
421 if (fnderr) fprintf( stderr,
422 "(%d) Error for type MPI_UNSIGNED and op MPI_MAX\n", world_rank );
430 unsigned long *in, *out, *sol;
432 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
433 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
434 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
435 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
437 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MAX, comm );
438 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
439 if (fnderr) fprintf( stderr,
440 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MAX\n", world_rank );
448 float *in, *out, *sol;
450 in = (float *)malloc( count * sizeof(float) );
451 out = (float *)malloc( count * sizeof(float) );
452 sol = (float *)malloc( count * sizeof(float) );
453 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
455 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MAX, comm );
456 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
457 if (fnderr) fprintf( stderr,
458 "(%d) Error for type MPI_FLOAT and op MPI_MAX\n", world_rank );
466 double *in, *out, *sol;
468 in = (double *)malloc( count * sizeof(double) );
469 out = (double *)malloc( count * sizeof(double) );
470 sol = (double *)malloc( count * sizeof(double) );
471 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = (size - 1 + i);
473 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MAX, comm );
474 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
475 if (fnderr) fprintf( stderr,
476 "(%d) Error for type MPI_DOUBLE and op MPI_MAX\n", world_rank );
485 printf( "Found %d errors on %d for MPI_MAX\n", errcnt, rank );
489 if (world_rank == 0 && verbose) printf( "Testing MPI_MIN...\n" );
494 in = (int *)malloc( count * sizeof(int) );
495 out = (int *)malloc( count * sizeof(int) );
496 sol = (int *)malloc( count * sizeof(int) );
497 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
499 MPI_Allreduce( in, out, count, MPI_INT, MPI_MIN, comm );
500 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
501 if (fnderr) fprintf( stderr,
502 "(%d) Error for type MPI_INT and op MPI_MIN\n", world_rank );
510 long *in, *out, *sol;
512 in = (long *)malloc( count * sizeof(long) );
513 out = (long *)malloc( count * sizeof(long) );
514 sol = (long *)malloc( count * sizeof(long) );
515 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
517 MPI_Allreduce( in, out, count, MPI_LONG, MPI_MIN, comm );
518 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
519 if (fnderr) fprintf( stderr,
520 "(%d) Error for type MPI_LONG and op MPI_MIN\n", world_rank );
528 short *in, *out, *sol;
530 in = (short *)malloc( count * sizeof(short) );
531 out = (short *)malloc( count * sizeof(short) );
532 sol = (short *)malloc( count * sizeof(short) );
533 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
535 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_MIN, comm );
536 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
537 if (fnderr) fprintf( stderr,
538 "(%d) Error for type MPI_SHORT and op MPI_MIN\n", world_rank );
546 unsigned short *in, *out, *sol;
548 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
549 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
550 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
551 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
553 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_MIN, comm );
554 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
555 if (fnderr) fprintf( stderr,
556 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_MIN\n", world_rank );
564 unsigned *in, *out, *sol;
566 in = (unsigned *)malloc( count * sizeof(unsigned) );
567 out = (unsigned *)malloc( count * sizeof(unsigned) );
568 sol = (unsigned *)malloc( count * sizeof(unsigned) );
569 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
571 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_MIN, comm );
572 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
573 if (fnderr) fprintf( stderr,
574 "(%d) Error for type MPI_UNSIGNED and op MPI_MIN\n", world_rank );
582 unsigned long *in, *out, *sol;
584 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
585 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
586 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
587 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
589 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_MIN, comm );
590 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
591 if (fnderr) fprintf( stderr,
592 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_MIN\n", world_rank );
600 float *in, *out, *sol;
602 in = (float *)malloc( count * sizeof(float) );
603 out = (float *)malloc( count * sizeof(float) );
604 sol = (float *)malloc( count * sizeof(float) );
605 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
607 MPI_Allreduce( in, out, count, MPI_FLOAT, MPI_MIN, comm );
608 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
609 if (fnderr) fprintf( stderr,
610 "(%d) Error for type MPI_FLOAT and op MPI_MIN\n", world_rank );
618 double *in, *out, *sol;
620 in = (double *)malloc( count * sizeof(double) );
621 out = (double *)malloc( count * sizeof(double) );
622 sol = (double *)malloc( count * sizeof(double) );
623 for (i=0; i<count; i++) { *(in + i) = (rank + i); *(sol + i) = i;
625 MPI_Allreduce( in, out, count, MPI_DOUBLE, MPI_MIN, comm );
626 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
627 if (fnderr) fprintf( stderr,
628 "(%d) Error for type MPI_DOUBLE and op MPI_MIN\n", world_rank );
637 printf( "Found %d errors on %d for MPI_MIN\n", errcnt, rank );
641 if (world_rank == 0 && verbose) printf( "Testing MPI_LOR...\n" );
646 in = (int *)malloc( count * sizeof(int) );
647 out = (int *)malloc( count * sizeof(int) );
648 sol = (int *)malloc( count * sizeof(int) );
649 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
651 MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
652 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
653 if (fnderr) fprintf( stderr,
654 "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
662 long *in, *out, *sol;
664 in = (long *)malloc( count * sizeof(long) );
665 out = (long *)malloc( count * sizeof(long) );
666 sol = (long *)malloc( count * sizeof(long) );
667 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
669 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
670 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
671 if (fnderr) fprintf( stderr,
672 "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
680 short *in, *out, *sol;
682 in = (short *)malloc( count * sizeof(short) );
683 out = (short *)malloc( count * sizeof(short) );
684 sol = (short *)malloc( count * sizeof(short) );
685 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
687 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
688 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
689 if (fnderr) fprintf( stderr,
690 "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
698 unsigned short *in, *out, *sol;
700 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
701 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
702 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
703 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
705 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
706 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
707 if (fnderr) fprintf( stderr,
708 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
716 unsigned *in, *out, *sol;
718 in = (unsigned *)malloc( count * sizeof(unsigned) );
719 out = (unsigned *)malloc( count * sizeof(unsigned) );
720 sol = (unsigned *)malloc( count * sizeof(unsigned) );
721 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
723 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
724 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
725 if (fnderr) fprintf( stderr,
726 "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
734 unsigned long *in, *out, *sol;
736 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
737 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
738 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
739 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = (size > 1);
741 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
742 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
743 if (fnderr) fprintf( stderr,
744 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
753 printf( "Found %d errors on %d for MPI_LOR(1)\n", errcnt, rank );
760 in = (int *)malloc( count * sizeof(int) );
761 out = (int *)malloc( count * sizeof(int) );
762 sol = (int *)malloc( count * sizeof(int) );
763 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
765 MPI_Allreduce( in, out, count, MPI_INT, MPI_LOR, comm );
766 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
767 if (fnderr) fprintf( stderr,
768 "(%d) Error for type MPI_INT and op MPI_LOR\n", world_rank );
776 long *in, *out, *sol;
778 in = (long *)malloc( count * sizeof(long) );
779 out = (long *)malloc( count * sizeof(long) );
780 sol = (long *)malloc( count * sizeof(long) );
781 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
783 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LOR, comm );
784 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
785 if (fnderr) fprintf( stderr,
786 "(%d) Error for type MPI_LONG and op MPI_LOR\n", world_rank );
794 short *in, *out, *sol;
796 in = (short *)malloc( count * sizeof(short) );
797 out = (short *)malloc( count * sizeof(short) );
798 sol = (short *)malloc( count * sizeof(short) );
799 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
801 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LOR, comm );
802 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
803 if (fnderr) fprintf( stderr,
804 "(%d) Error for type MPI_SHORT and op MPI_LOR\n", world_rank );
812 unsigned short *in, *out, *sol;
814 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
815 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
816 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
817 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
819 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LOR, comm );
820 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
821 if (fnderr) fprintf( stderr,
822 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LOR\n", world_rank );
830 unsigned *in, *out, *sol;
832 in = (unsigned *)malloc( count * sizeof(unsigned) );
833 out = (unsigned *)malloc( count * sizeof(unsigned) );
834 sol = (unsigned *)malloc( count * sizeof(unsigned) );
835 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
837 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LOR, comm );
838 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
839 if (fnderr) fprintf( stderr,
840 "(%d) Error for type MPI_UNSIGNED and op MPI_LOR\n", world_rank );
848 unsigned long *in, *out, *sol;
850 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
851 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
852 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
853 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
855 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LOR, comm );
856 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
857 if (fnderr) fprintf( stderr,
858 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LOR\n", world_rank );
867 printf( "Found %d errors on %d for MPI_LOR(0)\n", errcnt, rank );
871 if (world_rank == 0 && verbose) printf( "Testing MPI_LXOR...\n" );
876 in = (int *)malloc( count * sizeof(int) );
877 out = (int *)malloc( count * sizeof(int) );
878 sol = (int *)malloc( count * sizeof(int) );
879 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
881 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
882 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
883 if (fnderr) fprintf( stderr,
884 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
892 long *in, *out, *sol;
894 in = (long *)malloc( count * sizeof(long) );
895 out = (long *)malloc( count * sizeof(long) );
896 sol = (long *)malloc( count * sizeof(long) );
897 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
899 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
900 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
901 if (fnderr) fprintf( stderr,
902 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
910 short *in, *out, *sol;
912 in = (short *)malloc( count * sizeof(short) );
913 out = (short *)malloc( count * sizeof(short) );
914 sol = (short *)malloc( count * sizeof(short) );
915 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
917 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
918 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
919 if (fnderr) fprintf( stderr,
920 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
928 unsigned short *in, *out, *sol;
930 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
931 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
932 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
933 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
935 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
936 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
937 if (fnderr) fprintf( stderr,
938 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
946 unsigned *in, *out, *sol;
948 in = (unsigned *)malloc( count * sizeof(unsigned) );
949 out = (unsigned *)malloc( count * sizeof(unsigned) );
950 sol = (unsigned *)malloc( count * sizeof(unsigned) );
951 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
953 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
954 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
955 if (fnderr) fprintf( stderr,
956 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
964 unsigned long *in, *out, *sol;
966 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
967 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
968 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
969 for (i=0; i<count; i++) { *(in + i) = (rank == 1); *(sol + i) = (size > 1);
971 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
972 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
973 if (fnderr) fprintf( stderr,
974 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
983 printf( "Found %d errors on %d for MPI_LXOR(1)\n", errcnt, rank );
990 in = (int *)malloc( count * sizeof(int) );
991 out = (int *)malloc( count * sizeof(int) );
992 sol = (int *)malloc( count * sizeof(int) );
993 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
995 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
996 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
997 if (fnderr) fprintf( stderr,
998 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
1006 long *in, *out, *sol;
1008 in = (long *)malloc( count * sizeof(long) );
1009 out = (long *)malloc( count * sizeof(long) );
1010 sol = (long *)malloc( count * sizeof(long) );
1011 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1013 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
1014 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1015 if (fnderr) fprintf( stderr,
1016 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
1024 short *in, *out, *sol;
1026 in = (short *)malloc( count * sizeof(short) );
1027 out = (short *)malloc( count * sizeof(short) );
1028 sol = (short *)malloc( count * sizeof(short) );
1029 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1031 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
1032 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1033 if (fnderr) fprintf( stderr,
1034 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
1042 unsigned short *in, *out, *sol;
1044 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1045 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1046 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1047 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1049 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
1050 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1051 if (fnderr) fprintf( stderr,
1052 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
1060 unsigned *in, *out, *sol;
1062 in = (unsigned *)malloc( count * sizeof(unsigned) );
1063 out = (unsigned *)malloc( count * sizeof(unsigned) );
1064 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1065 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1067 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
1068 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1069 if (fnderr) fprintf( stderr,
1070 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
1078 unsigned long *in, *out, *sol;
1080 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1081 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1082 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1083 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1085 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
1086 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1087 if (fnderr) fprintf( stderr,
1088 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
1097 printf( "Found %d errors on %d for MPI_LXOR(0)\n", errcnt, rank );
1102 int *in, *out, *sol;
1104 in = (int *)malloc( count * sizeof(int) );
1105 out = (int *)malloc( count * sizeof(int) );
1106 sol = (int *)malloc( count * sizeof(int) );
1107 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1109 MPI_Allreduce( in, out, count, MPI_INT, MPI_LXOR, comm );
1110 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1111 if (fnderr) fprintf( stderr,
1112 "(%d) Error for type MPI_INT and op MPI_LXOR\n", world_rank );
1120 long *in, *out, *sol;
1122 in = (long *)malloc( count * sizeof(long) );
1123 out = (long *)malloc( count * sizeof(long) );
1124 sol = (long *)malloc( count * sizeof(long) );
1125 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1127 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LXOR, comm );
1128 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1129 if (fnderr) fprintf( stderr,
1130 "(%d) Error for type MPI_LONG and op MPI_LXOR\n", world_rank );
1138 short *in, *out, *sol;
1140 in = (short *)malloc( count * sizeof(short) );
1141 out = (short *)malloc( count * sizeof(short) );
1142 sol = (short *)malloc( count * sizeof(short) );
1143 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1145 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LXOR, comm );
1146 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1147 if (fnderr) fprintf( stderr,
1148 "(%d) Error for type MPI_SHORT and op MPI_LXOR\n", world_rank );
1156 unsigned short *in, *out, *sol;
1158 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1159 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1160 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1161 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1163 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LXOR, comm );
1164 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1165 if (fnderr) fprintf( stderr,
1166 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LXOR\n", world_rank );
1174 unsigned *in, *out, *sol;
1176 in = (unsigned *)malloc( count * sizeof(unsigned) );
1177 out = (unsigned *)malloc( count * sizeof(unsigned) );
1178 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1179 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1181 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LXOR, comm );
1182 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1183 if (fnderr) fprintf( stderr,
1184 "(%d) Error for type MPI_UNSIGNED and op MPI_LXOR\n", world_rank );
1192 unsigned long *in, *out, *sol;
1194 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1195 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1196 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1197 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 0;
1199 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LXOR, comm );
1200 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1201 if (fnderr) fprintf( stderr,
1202 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LXOR\n", world_rank );
1211 printf( "Found %d errors on %d for MPI_LXOR(1-0)\n", errcnt, rank );
1215 if (world_rank == 0 && verbose) printf( "Testing MPI_LAND...\n" );
1218 int *in, *out, *sol;
1220 in = (int *)malloc( count * sizeof(int) );
1221 out = (int *)malloc( count * sizeof(int) );
1222 sol = (int *)malloc( count * sizeof(int) );
1223 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1225 MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
1226 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1227 if (fnderr) fprintf( stderr,
1228 "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
1236 long *in, *out, *sol;
1238 in = (long *)malloc( count * sizeof(long) );
1239 out = (long *)malloc( count * sizeof(long) );
1240 sol = (long *)malloc( count * sizeof(long) );
1241 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1243 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
1244 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1245 if (fnderr) fprintf( stderr,
1246 "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
1254 short *in, *out, *sol;
1256 in = (short *)malloc( count * sizeof(short) );
1257 out = (short *)malloc( count * sizeof(short) );
1258 sol = (short *)malloc( count * sizeof(short) );
1259 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1261 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
1262 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1263 if (fnderr) fprintf( stderr,
1264 "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
1272 unsigned short *in, *out, *sol;
1274 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1275 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1276 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1277 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1279 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
1280 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1281 if (fnderr) fprintf( stderr,
1282 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
1290 unsigned *in, *out, *sol;
1292 in = (unsigned *)malloc( count * sizeof(unsigned) );
1293 out = (unsigned *)malloc( count * sizeof(unsigned) );
1294 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1295 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1297 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
1298 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1299 if (fnderr) fprintf( stderr,
1300 "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
1308 unsigned long *in, *out, *sol;
1310 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1311 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1312 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1313 for (i=0; i<count; i++) { *(in + i) = (rank & 0x1); *(sol + i) = 0;
1315 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
1316 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1317 if (fnderr) fprintf( stderr,
1318 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
1327 printf( "Found %d errors on %d for MPI_LAND(0)\n", errcnt, rank );
1332 int *in, *out, *sol;
1334 in = (int *)malloc( count * sizeof(int) );
1335 out = (int *)malloc( count * sizeof(int) );
1336 sol = (int *)malloc( count * sizeof(int) );
1337 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1339 MPI_Allreduce( in, out, count, MPI_INT, MPI_LAND, comm );
1340 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1341 if (fnderr) fprintf( stderr,
1342 "(%d) Error for type MPI_INT and op MPI_LAND\n", world_rank );
1350 long *in, *out, *sol;
1352 in = (long *)malloc( count * sizeof(long) );
1353 out = (long *)malloc( count * sizeof(long) );
1354 sol = (long *)malloc( count * sizeof(long) );
1355 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1357 MPI_Allreduce( in, out, count, MPI_LONG, MPI_LAND, comm );
1358 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1359 if (fnderr) fprintf( stderr,
1360 "(%d) Error for type MPI_LONG and op MPI_LAND\n", world_rank );
1368 short *in, *out, *sol;
1370 in = (short *)malloc( count * sizeof(short) );
1371 out = (short *)malloc( count * sizeof(short) );
1372 sol = (short *)malloc( count * sizeof(short) );
1373 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1375 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_LAND, comm );
1376 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1377 if (fnderr) fprintf( stderr,
1378 "(%d) Error for type MPI_SHORT and op MPI_LAND\n", world_rank );
1386 unsigned short *in, *out, *sol;
1388 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1389 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1390 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1391 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1393 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_LAND, comm );
1394 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1395 if (fnderr) fprintf( stderr,
1396 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_LAND\n", world_rank );
1404 unsigned *in, *out, *sol;
1406 in = (unsigned *)malloc( count * sizeof(unsigned) );
1407 out = (unsigned *)malloc( count * sizeof(unsigned) );
1408 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1409 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1411 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_LAND, comm );
1412 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1413 if (fnderr) fprintf( stderr,
1414 "(%d) Error for type MPI_UNSIGNED and op MPI_LAND\n", world_rank );
1422 unsigned long *in, *out, *sol;
1424 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1425 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1426 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1427 for (i=0; i<count; i++) { *(in + i) = 1; *(sol + i) = 1;
1429 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_LAND, comm );
1430 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1431 if (fnderr) fprintf( stderr,
1432 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_LAND\n", world_rank );
1441 printf( "Found %d errors on %d for MPI_LAND(1)\n", errcnt, rank );
1445 if (world_rank == 0 && verbose) printf( "Testing MPI_BOR...\n" );
1448 int *in, *out, *sol;
1450 in = (int *)malloc( count * sizeof(int) );
1451 out = (int *)malloc( count * sizeof(int) );
1452 sol = (int *)malloc( count * sizeof(int) );
1453 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1455 MPI_Allreduce( in, out, count, MPI_INT, MPI_BOR, comm );
1456 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1457 if (fnderr) fprintf( stderr,
1458 "(%d) Error for type MPI_INT and op MPI_BOR\n", world_rank );
1466 long *in, *out, *sol;
1468 in = (long *)malloc( count * sizeof(long) );
1469 out = (long *)malloc( count * sizeof(long) );
1470 sol = (long *)malloc( count * sizeof(long) );
1471 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1473 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BOR, comm );
1474 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1475 if (fnderr) fprintf( stderr,
1476 "(%d) Error for type MPI_LONG and op MPI_BOR\n", world_rank );
1484 short *in, *out, *sol;
1486 in = (short *)malloc( count * sizeof(short) );
1487 out = (short *)malloc( count * sizeof(short) );
1488 sol = (short *)malloc( count * sizeof(short) );
1489 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1491 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BOR, comm );
1492 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1493 if (fnderr) fprintf( stderr,
1494 "(%d) Error for type MPI_SHORT and op MPI_BOR\n", world_rank );
1502 unsigned short *in, *out, *sol;
1504 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1505 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1506 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1507 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1509 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BOR, comm );
1510 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1511 if (fnderr) fprintf( stderr,
1512 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BOR\n", world_rank );
1520 unsigned *in, *out, *sol;
1522 in = (unsigned *)malloc( count * sizeof(unsigned) );
1523 out = (unsigned *)malloc( count * sizeof(unsigned) );
1524 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1525 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1527 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BOR, comm );
1528 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1529 if (fnderr) fprintf( stderr,
1530 "(%d) Error for type MPI_UNSIGNED and op MPI_BOR\n", world_rank );
1538 unsigned long *in, *out, *sol;
1540 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1541 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1542 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1543 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1545 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BOR, comm );
1546 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1547 if (fnderr) fprintf( stderr,
1548 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BOR\n", world_rank );
1556 unsigned char *in, *out, *sol;
1558 in = (unsigned char *)malloc( count * sizeof(unsigned char) );
1559 out = (unsigned char *)malloc( count * sizeof(unsigned char) );
1560 sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
1561 for (i=0; i<count; i++) { *(in + i) = rank & 0x3; *(sol + i) = (size < 3) ? size - 1 : 0x3;
1563 MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BOR, comm );
1564 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1565 if (fnderr) fprintf( stderr,
1566 "(%d) Error for type MPI_BYTE and op MPI_BOR\n", world_rank );
1575 printf( "Found %d errors on %d for MPI_BOR(1)\n", errcnt, rank );
1579 if (world_rank == 0 && verbose) printf( "Testing MPI_BAND...\n" );
1582 int *in, *out, *sol;
1584 in = (int *)malloc( count * sizeof(int) );
1585 out = (int *)malloc( count * sizeof(int) );
1586 sol = (int *)malloc( count * sizeof(int) );
1587 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1589 MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
1590 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1591 if (fnderr) fprintf( stderr,
1592 "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
1600 long *in, *out, *sol;
1602 in = (long *)malloc( count * sizeof(long) );
1603 out = (long *)malloc( count * sizeof(long) );
1604 sol = (long *)malloc( count * sizeof(long) );
1605 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1607 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
1608 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1609 if (fnderr) fprintf( stderr,
1610 "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
1618 short *in, *out, *sol;
1620 in = (short *)malloc( count * sizeof(short) );
1621 out = (short *)malloc( count * sizeof(short) );
1622 sol = (short *)malloc( count * sizeof(short) );
1623 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1625 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
1626 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1627 if (fnderr) fprintf( stderr,
1628 "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
1636 unsigned short *in, *out, *sol;
1638 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1639 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1640 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1641 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1643 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
1644 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1645 if (fnderr) fprintf( stderr,
1646 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
1654 unsigned *in, *out, *sol;
1656 in = (unsigned *)malloc( count * sizeof(unsigned) );
1657 out = (unsigned *)malloc( count * sizeof(unsigned) );
1658 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1659 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1661 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
1662 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1663 if (fnderr) fprintf( stderr,
1664 "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
1672 unsigned long *in, *out, *sol;
1674 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1675 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1676 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1677 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1679 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
1680 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1681 if (fnderr) fprintf( stderr,
1682 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
1690 unsigned char *in, *out, *sol;
1692 in = (unsigned char *)malloc( count * sizeof(unsigned char) );
1693 out = (unsigned char *)malloc( count * sizeof(unsigned char) );
1694 sol = (unsigned char *)malloc( count * sizeof(unsigned char) );
1695 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : ~0); *(sol + i) = i;
1697 MPI_Allreduce( in, out, count, MPI_BYTE, MPI_BAND, comm );
1698 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1699 if (fnderr) fprintf( stderr,
1700 "(%d) Error for type MPI_BYTE and op MPI_BAND\n", world_rank );
1709 printf( "Found %d errors on %d for MPI_BAND(1)\n", errcnt, rank );
1714 int *in, *out, *sol;
1716 in = (int *)malloc( count * sizeof(int) );
1717 out = (int *)malloc( count * sizeof(int) );
1718 sol = (int *)malloc( count * sizeof(int) );
1719 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1721 MPI_Allreduce( in, out, count, MPI_INT, MPI_BAND, comm );
1722 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1723 if (fnderr) fprintf( stderr,
1724 "(%d) Error for type MPI_INT and op MPI_BAND\n", world_rank );
1732 long *in, *out, *sol;
1734 in = (long *)malloc( count * sizeof(long) );
1735 out = (long *)malloc( count * sizeof(long) );
1736 sol = (long *)malloc( count * sizeof(long) );
1737 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1739 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BAND, comm );
1740 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1741 if (fnderr) fprintf( stderr,
1742 "(%d) Error for type MPI_LONG and op MPI_BAND\n", world_rank );
1750 short *in, *out, *sol;
1752 in = (short *)malloc( count * sizeof(short) );
1753 out = (short *)malloc( count * sizeof(short) );
1754 sol = (short *)malloc( count * sizeof(short) );
1755 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1757 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BAND, comm );
1758 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1759 if (fnderr) fprintf( stderr,
1760 "(%d) Error for type MPI_SHORT and op MPI_BAND\n", world_rank );
1768 unsigned short *in, *out, *sol;
1770 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1771 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1772 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1773 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1775 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BAND, comm );
1776 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1777 if (fnderr) fprintf( stderr,
1778 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BAND\n", world_rank );
1786 unsigned *in, *out, *sol;
1788 in = (unsigned *)malloc( count * sizeof(unsigned) );
1789 out = (unsigned *)malloc( count * sizeof(unsigned) );
1790 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1791 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1793 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BAND, comm );
1794 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1795 if (fnderr) fprintf( stderr,
1796 "(%d) Error for type MPI_UNSIGNED and op MPI_BAND\n", world_rank );
1804 unsigned long *in, *out, *sol;
1806 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1807 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1808 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1809 for (i=0; i<count; i++) { *(in + i) = (rank == size-1 ? i : 0); *(sol + i) = 0;
1811 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BAND, comm );
1812 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1813 if (fnderr) fprintf( stderr,
1814 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BAND\n", world_rank );
1823 printf( "Found %d errors on %d for MPI_BAND(0)\n", errcnt, rank );
1827 if (world_rank == 0 && verbose) printf( "Testing MPI_BXOR...\n" );
1830 int *in, *out, *sol;
1832 in = (int *)malloc( count * sizeof(int) );
1833 out = (int *)malloc( count * sizeof(int) );
1834 sol = (int *)malloc( count * sizeof(int) );
1835 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1837 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
1838 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1839 if (fnderr) fprintf( stderr,
1840 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
1848 long *in, *out, *sol;
1850 in = (long *)malloc( count * sizeof(long) );
1851 out = (long *)malloc( count * sizeof(long) );
1852 sol = (long *)malloc( count * sizeof(long) );
1853 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1855 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
1856 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1857 if (fnderr) fprintf( stderr,
1858 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
1866 short *in, *out, *sol;
1868 in = (short *)malloc( count * sizeof(short) );
1869 out = (short *)malloc( count * sizeof(short) );
1870 sol = (short *)malloc( count * sizeof(short) );
1871 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1873 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
1874 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1875 if (fnderr) fprintf( stderr,
1876 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
1884 unsigned short *in, *out, *sol;
1886 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
1887 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
1888 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
1889 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1891 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
1892 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1893 if (fnderr) fprintf( stderr,
1894 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
1902 unsigned *in, *out, *sol;
1904 in = (unsigned *)malloc( count * sizeof(unsigned) );
1905 out = (unsigned *)malloc( count * sizeof(unsigned) );
1906 sol = (unsigned *)malloc( count * sizeof(unsigned) );
1907 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1909 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
1910 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1911 if (fnderr) fprintf( stderr,
1912 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
1920 unsigned long *in, *out, *sol;
1922 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
1923 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
1924 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
1925 for (i=0; i<count; i++) { *(in + i) = (rank == 1)*0xf0 ; *(sol + i) = (size > 1)*0xf0 ;
1927 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
1928 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1929 if (fnderr) fprintf( stderr,
1930 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
1939 printf( "Found %d errors on %d for MPI_BXOR(1)\n", errcnt, rank );
1944 int *in, *out, *sol;
1946 in = (int *)malloc( count * sizeof(int) );
1947 out = (int *)malloc( count * sizeof(int) );
1948 sol = (int *)malloc( count * sizeof(int) );
1949 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1951 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
1952 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1953 if (fnderr) fprintf( stderr,
1954 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
1962 long *in, *out, *sol;
1964 in = (long *)malloc( count * sizeof(long) );
1965 out = (long *)malloc( count * sizeof(long) );
1966 sol = (long *)malloc( count * sizeof(long) );
1967 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1969 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
1970 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1971 if (fnderr) fprintf( stderr,
1972 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
1980 short *in, *out, *sol;
1982 in = (short *)malloc( count * sizeof(short) );
1983 out = (short *)malloc( count * sizeof(short) );
1984 sol = (short *)malloc( count * sizeof(short) );
1985 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
1987 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
1988 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
1989 if (fnderr) fprintf( stderr,
1990 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
1998 unsigned short *in, *out, *sol;
2000 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
2001 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
2002 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
2003 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2005 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
2006 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2007 if (fnderr) fprintf( stderr,
2008 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
2016 unsigned *in, *out, *sol;
2018 in = (unsigned *)malloc( count * sizeof(unsigned) );
2019 out = (unsigned *)malloc( count * sizeof(unsigned) );
2020 sol = (unsigned *)malloc( count * sizeof(unsigned) );
2021 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2023 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
2024 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2025 if (fnderr) fprintf( stderr,
2026 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
2034 unsigned long *in, *out, *sol;
2036 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
2037 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
2038 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
2039 for (i=0; i<count; i++) { *(in + i) = 0; *(sol + i) = 0;
2041 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
2042 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2043 if (fnderr) fprintf( stderr,
2044 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
2053 printf( "Found %d errors on %d for MPI_BXOR(0)\n", errcnt, rank );
2058 int *in, *out, *sol;
2060 in = (int *)malloc( count * sizeof(int) );
2061 out = (int *)malloc( count * sizeof(int) );
2062 sol = (int *)malloc( count * sizeof(int) );
2063 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2065 MPI_Allreduce( in, out, count, MPI_INT, MPI_BXOR, comm );
2066 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2067 if (fnderr) fprintf( stderr,
2068 "(%d) Error for type MPI_INT and op MPI_BXOR\n", world_rank );
2076 long *in, *out, *sol;
2078 in = (long *)malloc( count * sizeof(long) );
2079 out = (long *)malloc( count * sizeof(long) );
2080 sol = (long *)malloc( count * sizeof(long) );
2081 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2083 MPI_Allreduce( in, out, count, MPI_LONG, MPI_BXOR, comm );
2084 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2085 if (fnderr) fprintf( stderr,
2086 "(%d) Error for type MPI_LONG and op MPI_BXOR\n", world_rank );
2094 short *in, *out, *sol;
2096 in = (short *)malloc( count * sizeof(short) );
2097 out = (short *)malloc( count * sizeof(short) );
2098 sol = (short *)malloc( count * sizeof(short) );
2099 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2101 MPI_Allreduce( in, out, count, MPI_SHORT, MPI_BXOR, comm );
2102 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2103 if (fnderr) fprintf( stderr,
2104 "(%d) Error for type MPI_SHORT and op MPI_BXOR\n", world_rank );
2112 unsigned short *in, *out, *sol;
2114 in = (unsigned short *)malloc( count * sizeof(unsigned short) );
2115 out = (unsigned short *)malloc( count * sizeof(unsigned short) );
2116 sol = (unsigned short *)malloc( count * sizeof(unsigned short) );
2117 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2119 MPI_Allreduce( in, out, count, MPI_UNSIGNED_SHORT, MPI_BXOR, comm );
2120 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2121 if (fnderr) fprintf( stderr,
2122 "(%d) Error for type MPI_UNSIGNED_SHORT and op MPI_BXOR\n", world_rank );
2130 unsigned *in, *out, *sol;
2132 in = (unsigned *)malloc( count * sizeof(unsigned) );
2133 out = (unsigned *)malloc( count * sizeof(unsigned) );
2134 sol = (unsigned *)malloc( count * sizeof(unsigned) );
2135 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2137 MPI_Allreduce( in, out, count, MPI_UNSIGNED, MPI_BXOR, comm );
2138 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2139 if (fnderr) fprintf( stderr,
2140 "(%d) Error for type MPI_UNSIGNED and op MPI_BXOR\n", world_rank );
2148 unsigned long *in, *out, *sol;
2150 in = (unsigned long *)malloc( count * sizeof(unsigned long) );
2151 out = (unsigned long *)malloc( count * sizeof(unsigned long) );
2152 sol = (unsigned long *)malloc( count * sizeof(unsigned long) );
2153 for (i=0; i<count; i++) { *(in + i) = ~0; *(sol + i) = 0;
2155 MPI_Allreduce( in, out, count, MPI_UNSIGNED_LONG, MPI_BXOR, comm );
2156 for (i=0; i<count; i++) { if (*(out + i) != *(sol + i)) {errcnt++; fnderr++;}}
2157 if (fnderr) fprintf( stderr,
2158 "(%d) Error for type MPI_UNSIGNED_LONG and op MPI_BXOR\n", world_rank );
2167 printf( "Found %d errors on %d for MPI_BXOR(1-0)\n", errcnt, rank );
2171 if (world_rank == 0 && verbose) printf( "Testing MPI_MAXLOC...\n" );
2174 struct int_test { int a; int b; } *in, *out, *sol;
2176 in = (struct int_test *)malloc( count * sizeof(struct int_test) );
2177 out = (struct int_test *)malloc( count * sizeof(struct int_test) );
2178 sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
2179 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2180 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2181 (out + i)->a = 0; (out + i)->b = -1; }
2182 MPI_Allreduce( in, out, count, MPI_2INT, MPI_MAXLOC, comm );
2183 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2184 (out + i)->b != (sol + i)->b) {
2186 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2187 (int)((sol + i)->a),
2188 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2190 if (fnderr) fprintf( stderr,
2191 "(%d) Error for type MPI_2INT and op MPI_MAXLOC (%d of %d wrong)\n",
2192 world_rank, fnderr, count );
2200 struct long_test { long a; int b; } *in, *out, *sol;
2202 in = (struct long_test *)malloc( count * sizeof(struct long_test) );
2203 out = (struct long_test *)malloc( count * sizeof(struct long_test) );
2204 sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
2205 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2206 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2207 (out + i)->a = 0; (out + i)->b = -1; }
2208 MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MAXLOC, comm );
2209 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2210 (out + i)->b != (sol + i)->b) {
2212 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2213 (int)((sol + i)->a),
2214 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2216 if (fnderr) fprintf( stderr,
2217 "(%d) Error for type MPI_LONG_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2218 world_rank, fnderr, count );
2226 struct short_test { short a; int b; } *in, *out, *sol;
2228 in = (struct short_test *)malloc( count * sizeof(struct short_test) );
2229 out = (struct short_test *)malloc( count * sizeof(struct short_test) );
2230 sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
2231 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2232 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2233 (out + i)->a = 0; (out + i)->b = -1; }
2234 MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MAXLOC, comm );
2235 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2236 (out + i)->b != (sol + i)->b) {
2238 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2239 (int)((sol + i)->a),
2240 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2242 if (fnderr) fprintf( stderr,
2243 "(%d) Error for type MPI_SHORT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2244 world_rank, fnderr, count );
2252 struct float_test { float a; int b; } *in, *out, *sol;
2254 in = (struct float_test *)malloc( count * sizeof(struct float_test) );
2255 out = (struct float_test *)malloc( count * sizeof(struct float_test) );
2256 sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
2257 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2258 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2259 (out + i)->a = 0; (out + i)->b = -1; }
2260 MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MAXLOC, comm );
2261 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2262 (out + i)->b != (sol + i)->b) {
2264 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2265 (int)((sol + i)->a),
2266 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2268 if (fnderr) fprintf( stderr,
2269 "(%d) Error for type MPI_FLOAT_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2270 world_rank, fnderr, count );
2278 struct double_test { double a; int b; } *in, *out, *sol;
2280 in = (struct double_test *)malloc( count * sizeof(struct double_test) );
2281 out = (struct double_test *)malloc( count * sizeof(struct double_test) );
2282 sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
2283 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2284 (sol + i)->a = (size - 1 + i); (sol + i)->b = (size-1);
2285 (out + i)->a = 0; (out + i)->b = -1; }
2286 MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MAXLOC, comm );
2287 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2288 (out + i)->b != (sol + i)->b) {
2290 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2291 (int)((sol + i)->a),
2292 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2294 if (fnderr) fprintf( stderr,
2295 "(%d) Error for type MPI_DOUBLE_INT and op MPI_MAXLOC (%d of %d wrong)\n",
2296 world_rank, fnderr, count );
2305 printf( "Found %d errors on %d for MPI_MAXLOC\n", errcnt, rank );
2309 if (world_rank == 0 && verbose) printf( "Testing MPI_MINLOC...\n" );
2313 struct int_test { int a; int b; } *in, *out, *sol;
2315 in = (struct int_test *)malloc( count * sizeof(struct int_test) );
2316 out = (struct int_test *)malloc( count * sizeof(struct int_test) );
2317 sol = (struct int_test *)malloc( count * sizeof(struct int_test) );
2318 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2319 (sol + i)->a = i; (sol + i)->b = 0;
2320 (out + i)->a = 0; (out + i)->b = -1; }
2321 MPI_Allreduce( in, out, count, MPI_2INT, MPI_MINLOC, comm );
2322 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2323 (out + i)->b != (sol + i)->b) {
2325 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2326 (int)((sol + i)->a),
2327 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2329 if (fnderr) fprintf( stderr,
2330 "(%d) Error for type MPI_2INT and op MPI_MINLOC (%d of %d wrong)\n",
2331 world_rank, fnderr, count );
2339 struct long_test { long a; int b; } *in, *out, *sol;
2341 in = (struct long_test *)malloc( count * sizeof(struct long_test) );
2342 out = (struct long_test *)malloc( count * sizeof(struct long_test) );
2343 sol = (struct long_test *)malloc( count * sizeof(struct long_test) );
2344 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2345 (sol + i)->a = i; (sol + i)->b = 0;
2346 (out + i)->a = 0; (out + i)->b = -1; }
2347 MPI_Allreduce( in, out, count, MPI_LONG_INT, MPI_MINLOC, comm );
2348 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2349 (out + i)->b != (sol + i)->b) {
2351 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2352 (int)((sol + i)->a),
2353 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2355 if (fnderr) fprintf( stderr,
2356 "(%d) Error for type MPI_LONG_INT and op MPI_MINLOC (%d of %d wrong)\n",
2357 world_rank, fnderr, count );
2365 struct short_test { short a; int b; } *in, *out, *sol;
2367 in = (struct short_test *)malloc( count * sizeof(struct short_test) );
2368 out = (struct short_test *)malloc( count * sizeof(struct short_test) );
2369 sol = (struct short_test *)malloc( count * sizeof(struct short_test) );
2370 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2371 (sol + i)->a = i; (sol + i)->b = 0;
2372 (out + i)->a = 0; (out + i)->b = -1; }
2373 MPI_Allreduce( in, out, count, MPI_SHORT_INT, MPI_MINLOC, comm );
2374 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2375 (out + i)->b != (sol + i)->b) {
2377 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2378 (int)((sol + i)->a),
2379 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2381 if (fnderr) fprintf( stderr,
2382 "(%d) Error for type MPI_SHORT_INT and op MPI_MINLOC (%d of %d wrong)\n",
2383 world_rank, fnderr, count );
2391 struct float_test { float a; int b; } *in, *out, *sol;
2393 in = (struct float_test *)malloc( count * sizeof(struct float_test) );
2394 out = (struct float_test *)malloc( count * sizeof(struct float_test) );
2395 sol = (struct float_test *)malloc( count * sizeof(struct float_test) );
2396 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2397 (sol + i)->a = i; (sol + i)->b = 0;
2398 (out + i)->a = 0; (out + i)->b = -1; }
2399 MPI_Allreduce( in, out, count, MPI_FLOAT_INT, MPI_MINLOC, comm );
2400 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2401 (out + i)->b != (sol + i)->b) {
2403 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2404 (int)((sol + i)->a),
2405 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2407 if (fnderr) fprintf( stderr,
2408 "(%d) Error for type MPI_FLOAT_INT and op MPI_MINLOC (%d of %d wrong)\n",
2409 world_rank, fnderr, count );
2417 struct double_test { double a; int b; } *in, *out, *sol;
2419 in = (struct double_test *)malloc( count * sizeof(struct double_test) );
2420 out = (struct double_test *)malloc( count * sizeof(struct double_test) );
2421 sol = (struct double_test *)malloc( count * sizeof(struct double_test) );
2422 for (i=0; i<count; i++) { (in + i)->a = (rank + i); (in + i)->b = rank;
2423 (sol + i)->a = i; (sol + i)->b = 0;
2424 (out + i)->a = 0; (out + i)->b = -1; }
2425 MPI_Allreduce( in, out, count, MPI_DOUBLE_INT, MPI_MINLOC, comm );
2426 for (i=0; i<count; i++) { if ((out + i)->a != (sol + i)->a ||
2427 (out + i)->b != (sol + i)->b) {
2429 fprintf( stderr, "(%d) Expected (%d,%d) got (%d,%d)\n", world_rank,
2430 (int)((sol + i)->a),
2431 (sol+i)->b, (int)((out+i)->a), (out+i)->b );
2433 if (fnderr) fprintf( stderr,
2434 "(%d) Error for type MPI_DOUBLE_INT and op MPI_MINLOC (%d of %d wrong)\n",
2435 world_rank, fnderr, count );
2444 printf( "Found %d errors on %d for MPI_MINLOC\n", errcnt, rank );
2449 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
2450 printf( "Found %d errors overall on %d\n", gerr, rank );
2452 MPI_Allreduce( &gerr, &toterr, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD );
2453 if (world_rank == 0) {
2455 printf( " No Errors\n" );
2458 printf (" Found %d errors\n", toterr );
2461 //FreeComms( comms, ncomm );