This source file includes following definitions.
- main
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "mpi.h"
5
6 #define MAX_DATA 100
7
8 int main( int argc, char **argv )
9 {
10 MPI_Comm server;
11 double buf[MAX_DATA];
12 char port_name[MPI_MAX_PORT_NAME];
13 int done = 0, tag, n, CNT=0;
14
15 MPI_Init( &argc, &argv );
16 strcpy(port_name, argv[1] );
17
18 MPI_Comm_connect( port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &server );
19
20 n = MAX_DATA;
21
22 while (!done)
23 {
24 tag = 2;
25 if ( CNT == 5 ) { tag = 0; done = 1; }
26 fprintf(stderr, "Client sending message %d\n", CNT);
27 MPI_Send( buf, n, MPI_DOUBLE, 0, tag, server );
28 CNT++;
29
30 }
31
32 MPI_Comm_disconnect( &server );
33 MPI_Finalize();
34
35 return 0;
36 }
37