5 * intended to be run with at least 3 procs
7 int main(int argc, char ** argv)
9 MPI_Comm new_intercomm;
15 MPI_Init(&argc, &argv);
16 MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
17 MPI_Comm_size( MPI_COMM_WORLD, &my_size );
20 printf( "This test requires at least 3 processes: only %d provided\n",
22 MPI_Abort( MPI_COMM_WORLD, 1 );
25 printf("%d: Entering main()\n", my_rank); fflush(stdout);
27 /* pick one of the following two settings for procA,procB */
29 /* uncomment these and program will work */
30 /* procA = 0; procB = 2; */
32 /* uncomment these and program will hang */
34 /* The SGI implementation of MPI fails this test */
35 if (my_rank == procA || my_rank == procB)
46 printf("%d: Calling MPI_Intercomm_create()\n", my_rank); fflush(stdout);
48 MPI_Intercomm_create(MPI_COMM_SELF, 0,
49 MPI_COMM_WORLD, rrank,
53 printf("%d: Calling MPI_Comm_dup()\n", my_rank); fflush(stdout);
55 MPI_Comm_dup(new_intercomm, &new_comm);
57 /* Free these new communicators */
58 MPI_Comm_free( &new_comm );
59 MPI_Comm_free( &new_intercomm );
62 MPI_Barrier( MPI_COMM_WORLD );
64 printf( " No Errors\n" );
67 printf("%d: Calling MPI_Finalize()\n", my_rank); fflush(stdout);