This source file includes following definitions.
- main
1 #include <mpi.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 int main(int argc, char *argv[])
6 {
7 long count = 0;
8 int i = 8, j;
9 int self;
10 int do_barrier = 0;
11 int k;
12 double pi;
13
14 if (getenv("DO_BARRIER")) {
15 do_barrier = 1;
16 }
17
18 MPI_Init(&argc, &argv);
19 MPI_Comm_rank(MPI_COMM_WORLD, &self);
20 while (1) {
21 #if 0
22 for (k=0; k < (7-self)*1000; k++) {
23 pi = 3.14159 * 18.0 / 35.3;
24 }
25 #endif
26 MPI_Reduce(&i, &j, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
27 if (do_barrier) {
28 MPI_Barrier(MPI_COMM_WORLD);
29 }
30 if (0 == (++count % 10000)) {
31 fprintf(stderr, "%d still going at %ld\n", self, count);
32 }
33 }
34 MPI_Finalize();
35
36 return 0;
37 }