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;
20 MTest_Init(&argc, &argv);
23 /* while (trigger) ; */
25 MPI_Comm_size(MPI_COMM_WORLD, &size);
27 printf("Size must be at least 2\n");
28 MPI_Abort(MPI_COMM_WORLD, 0);
31 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
33 /* Make an intercomm of the first two elements of comm_world */
35 int lrank = rank, rrank = -1;
38 remote_rank = 1 - rank;
39 MPI_Intercomm_create(MPI_COMM_SELF, 0, MPI_COMM_WORLD, remote_rank, 27, &intercomm);
41 /* Now, communicate between them */
42 MPI_Sendrecv(&lrank, 1, MPI_INT, 0, 13, &rrank, 1, MPI_INT, 0, 13, intercomm, &status);
44 if (rrank != remote_rank) {
46 printf("%d Expected %d but received %d\n", rank, remote_rank, rrank);
49 MPI_Comm_free(&intercomm);
52 /* The next test should create an intercomm with groups of different