2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov) Fri Dec 20 2002 */
4 /* comm-dup-no-free2.c - leak many communicators created with comm dup */
8 "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/comm-dup-no-free2.c,v 1.1 2003/01/13 18:31:47 bronis Exp $";
11 /* NOTE: Some value of ITERATIONS will imply resource exhaustion */
12 /* either in Umpire or MPI no matter how things are implemented */
13 /* the best we can hope for is to fail gracefully... */
14 /* Approximately 4100 gets "ERROR: 0032-160 Too many communicators" */
15 /* with IBM's MPI (AIX 5.1.0, PSSP 3.4) as of 1/13/03... */
16 /* Umpire failure is graceful - comm creates are identified... */
17 /* UNKNOWN N breaks umpire due to running out of memory as of 1/13/03... */
18 /* UMPIRE FAILURE IS NOT GRACEFUL AS OF THIS TIME IN THIS CASE... */
20 #define COMMS_PER_ITERATION 3
21 #define COMMS_LOST_PER_ITERATION 1
31 main (int argc, char **argv)
36 char processor_name[128];
38 MPI_Comm newcomm[COMMS_PER_ITERATION];
41 MPI_Init (&argc, &argv);
42 MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
43 MPI_Comm_rank (MPI_COMM_WORLD, &rank);
44 MPI_Get_processor_name (processor_name, &namelen);
45 printf ("(%d) is alive on %s\n", rank, processor_name);
48 MPI_Barrier (MPI_COMM_WORLD);
50 for (i = 0; i < ITERATIONS; i++) {
51 for (j = 0; j < COMMS_PER_ITERATION; j++) {
52 MPI_Comm_dup (MPI_COMM_WORLD, &newcomm[j]);
54 MPI_Barrier (newcomm[j]);
56 if (j < COMMS_PER_ITERATION - COMMS_LOST_PER_ITERATION) {
57 MPI_Comm_free (&newcomm[j]);
62 MPI_Barrier (MPI_COMM_WORLD);
64 printf ("(%d) Finished normally\n", rank);