This source file includes following definitions.
- main
1 #include <string.h>
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <pthread.h>
6 #include <semaphore.h>
7 #include "mpi.h"
8
9
10 int main( int argc, char **argv )
11 {
12 MPI_Comm parent;
13 MPI_Comm merged;
14 int rank;
15 int size;
16
17 MPI_Init(&argc, &argv);
18 printf("Child: launch\n");
19 MPI_Comm_get_parent(&parent);
20 MPI_Intercomm_merge(parent, 1, &merged);
21 MPI_Comm_rank(merged, &rank);
22 MPI_Comm_size(merged, &size);
23 printf("Child merged rank = %d, size = %d\n", rank, size);
24
25 MPI_Comm_free(&merged);
26 MPI_Comm_disconnect(&parent);
27 MPI_Finalize();
28 printf("Child %d: exiting\n", (int)getpid());
29 return 0;
30 }