This source file includes following definitions.
- main
1
2
3
4
5
6
7
8 #include <stdio.h>
9 #include "mpi.h"
10
11 int main(int argc, char* argv[])
12 {
13 int rank, size;
14 MPI_Comm server;
15 MPI_Info info;
16 char port[MPI_MAX_PORT_NAME];
17
18 MPI_Init(&argc, &argv);
19
20 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
21 MPI_Comm_size(MPI_COMM_WORLD, &size);
22
23 printf("Hello, World, I am %d of %d\n", rank, size);
24
25 MPI_Info_create(&info);
26 MPI_Info_set(info, "ompi_global_scope", "true");
27
28 MPI_Lookup_name("test-pub", info, port);
29 MPI_Comm_connect(port, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &server);
30
31 MPI_Barrier(server);
32
33 MPI_Finalize();
34 return 0;
35 }