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 );
29 MPI_Comm_rank( MPI_COMM_WORLD, &rank );
31 /* Make an intercomm of the first two elements of comm_world */
33 int lrank = rank, rrank = -1;
36 remote_rank = 1 - rank;
37 MPI_Intercomm_create( MPI_COMM_SELF, 0,
38 MPI_COMM_WORLD, remote_rank, 27,
41 /* Now, communicate between them */
42 MPI_Sendrecv( &lrank, 1, MPI_INT, 0, 13,
43 &rrank, 1, MPI_INT, 0, 13, intercomm, &status );
45 if (rrank != remote_rank) {
47 printf( "%d Expected %d but received %d\n",
48 rank, remote_rank, rrank );
51 MPI_Comm_free( &intercomm );
54 /* The next test should create an intercomm with groups of different
57 MTest_Finalize( errs );