This source file includes following definitions.
- main
1 #include <mpi.h>
2 #include <stdio.h>
3
4 int main(int argc, char* argv[])
5 {
6 int myid, nprocs, tag;
7 int i, m, nt;
8 MPI_Status status;
9 double workarray1[561], workarray2[561];
10 const int numm = 50000;
11 const int numt = 142;
12
13 MPI_Init(NULL, NULL);
14 MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
15 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
16
17 for (m = 0; m < numm; ++m) {
18 if (0 == (m % 1000)) {
19 printf("rank %d, m = %d\n", myid, m);
20 }
21 for (nt = 0; nt <= numt; ++nt) {
22 if (0 == myid) {
23 for (i = 0; i < 561; ++i) {
24 workarray1[i] = numm * numt * i;
25 workarray2[i] = numm * numt * (i + 1);
26 }
27 }
28 MPI_Bcast(workarray1, 561, MPI_DOUBLE, 0, MPI_COMM_WORLD);
29 MPI_Bcast(workarray2, 561, MPI_DOUBLE, 0, MPI_COMM_WORLD);
30 }
31 }
32 MPI_Finalize();
33
34 return 0;
35 }
36