1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
4 * (C) 2003 by Argonne National Laboratory.
5 * See COPYRIGHT in top-level directory.
14 * This check is intended to fail if there is a leak of context ids.
15 * Because this is trying to exhaust the number of context ids, it needs
16 * to run for a longer time than many tests. The for loop uses 100,000
17 * iterations, which is adequate for MPICH (with only about 1k context ids
21 int main(int argc, char **argv)
32 MTest_Init(&argc, &argv);
34 for (i = 1; i < argc; i++) {
35 if (strcmp(argv[i], "--loopcount") == 0) {
37 nLoop = atoi(argv[i]);
40 fprintf(stderr, "Unrecognized argument %s\n", argv[i]);
44 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
46 startTime = MPI_Wtime();
47 for (i = 0; i < nLoop; i++) {
49 if (rank == 0 && (i % 100 == 0)) {
50 double rate = MPI_Wtime() - startTime;
53 MTestPrintfMsg(10, "After %d (%f)\n", i, rate);
56 MTestPrintfMsg(10, "After %d\n", i);
60 /* FIXME: Explain the rationale behind rand in this test */
63 if (randval % (rank + 2) == 0) {
64 MPI_Comm_split(MPI_COMM_WORLD, 1, rank, &newcomm);
65 MPI_Comm_free(&newcomm);
68 MPI_Comm_split(MPI_COMM_WORLD, MPI_UNDEFINED, rank, &newcomm);
69 if (newcomm != MPI_COMM_NULL) {
71 printf("Created a non-null communicator with MPI_UNDEFINED\n");