This source file includes following definitions.
- main
1 #include <stdio.h>
2 #include <unistd.h>
3 #include "mpi.h"
4
5 const int count = 1234;
6 int buffer[1234] = {0};
7
8 int main(int argc, char *argv[])
9 {
10 int rank, size, i;
11
12 MPI_Init(&argc, &argv);
13 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
14 MPI_Comm_size(MPI_COMM_WORLD, &size);
15
16
17 for (i=0; i < 1000; i++) {
18 fprintf(stderr, "%d: Executing Bcast #%d\n", rank, i);
19 MPI_Bcast(buffer, count, MPI_INT, 0, MPI_COMM_WORLD);
20 if (0 != rank) {
21 sleep(1);
22 }
23 }
24
25 MPI_Finalize();
26 return 0;
27 }
28