This source file includes following definitions.
- main
1
2
3
4
5
6
7
8 #include "orte_config.h"
9
10 #include <stdio.h>
11 #include <unistd.h>
12 #include "mpi.h"
13
14 int main(int argc, char* argv[])
15 {
16 int rank, size;
17 char hostname[OPAL_MAXHOSTNAMELEN];
18
19 MPI_Init(&argc, &argv);
20 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
21 MPI_Comm_size(MPI_COMM_WORLD, &size);
22
23 gethostname(hostname, sizeof(hostname));
24 printf("%s: I am %d of %d. pid=%d\n", hostname, rank, size, getpid());
25
26 if (rank%3 == 0) {
27 printf("%s: rank %d aborts\n", hostname, rank);
28 if (rank == 3) {
29 printf("%s: rank %d is going to sleep\n", hostname, rank);
30 sleep(2);
31 }
32 MPI_Abort(MPI_COMM_WORLD, 2);
33 printf("%s: sleeping. You should not see this\n", hostname);
34 sleep(100);
35 }
36
37 MPI_Finalize();
38 return 0;
39 }