3 A report was made that this program hung on a 2 processor LINUX cluster.
4 We haven't seen that problem, but since this does test whether process 0
5 waits for the other processes to complete before exiting, it is a good
10 #define MAX_NUM_PROCS 10
12 int main( int argc, char *argv[])
20 MPI_Init(&argc,&argv);
21 MPI_Comm_size(MPI_COMM_WORLD,&num_procs);
22 MPI_Comm_rank(MPI_COMM_WORLD,&my_id);
26 fprintf(stderr, "Need at least 3 processes for this bug\n");
32 fprintf(stderr, "%d Starting ....\n", my_id);
41 fprintf(stdout, "%d start send (%d) to %d\n", my_id, s, idx);
44 MPI_Send(&s, 1, MPI_INT, idx, 0, MPI_COMM_WORLD);
46 fprintf(stdout, "%d finished send to %d\n", my_id, idx);
55 fprintf(stdout, "%d start recv from %d\n", my_id, idx);
58 MPI_Recv (&r, 1, MPI_INT, idx, 0, MPI_COMM_WORLD, &status );
60 fprintf(stdout, "%d finished recv (%d) from %d\n", my_id, r, idx);
66 fprintf(stdout, "%d Done ....\n",my_id);
69 MPI_Barrier( MPI_COMM_WORLD );
71 /* If we reach here, we're done */
72 printf( " No Errors\n" );