1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2001 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
8 * A simple test of the intercomm create routine, with a communication test
14 int main( int argc, char *argv[] )
17 int remote_rank, rank, size, errs = 0;
19 MTest_Init( &argc, &argv );
23 MPI_Comm_size( MPI_COMM_WORLD, &size );
25 printf( "Size must be at least 2\n" );
26 MPI_Abort( MPI_COMM_WORLD, 0 );
30 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
32 /* Make an intercomm of the first two elements of comm_world */
34 int lrank = rank, rrank = -1;
37 remote_rank = 1 - rank;
38 MPI_Intercomm_create( MPI_COMM_SELF, 0,
39 MPI_COMM_WORLD, remote_rank, 27,
42 /* Now, communicate between them */
43 MPI_Sendrecv( &lrank, 1, MPI_INT, 0, 13,
44 &rrank, 1, MPI_INT, 0, 13, intercomm, &status );
46 if (rrank != remote_rank) {
48 printf( "%d Expected %d but received %d\n",
49 rank, remote_rank, rrank );
52 MPI_Comm_free( &intercomm );
55 /* The next test should create an intercomm with groups of different
58 MTest_Finalize( errs );