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) {
31 MTest_Init(&argc,&argv);
33 for (i=1; i<argc; i++) {
34 if (strcmp( argv[i], "--loopcount" ) == 0) {
36 nLoop = atoi( argv[i] );
39 fprintf( stderr, "Unrecognized argument %s\n", argv[i] );
43 MPI_Comm_rank(MPI_COMM_WORLD,&rank);
45 startTime = MPI_Wtime();
46 for (i=0; i<nLoop; i++) {
48 if ( rank == 0 && (i%100 == 0) ) {
49 double rate = MPI_Wtime() - startTime;
52 MTestPrintfMsg( 10, "After %d (%f)\n", i, rate );
55 MTestPrintfMsg( 10, "After %d\n", i );
59 /* FIXME: Explain the rationale behind rand in this test */
62 if (randval%(rank+2) == 0) {
63 MPI_Comm_split(MPI_COMM_WORLD,1,rank,&newcomm);
64 MPI_Comm_free( &newcomm );
67 MPI_Comm_split(MPI_COMM_WORLD,MPI_UNDEFINED,rank,&newcomm);
68 if (newcomm != MPI_COMM_NULL) {
70 printf( "Created a non-null communicator with MPI_UNDEFINED\n" );
76 MTest_Finalize( errs );