| 1 | /* -*- Mode: C; -*- */
|
|---|
| 2 | /* Creator: Bronis R. de Supinski (bronis@llnl.gov) Fri Dec 20 2002 */
|
|---|
| 3 |
|
|---|
| 4 | /* comm-dup-no-error.c - "correctly" use many communicators... */
|
|---|
| 5 |
|
|---|
| 6 | #ifndef lint
|
|---|
| 7 | static char *rcsid =
|
|---|
| 8 | "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/comm-dup-no-error.c,v 1.1 2003/01/13 18:31:47 bronis Exp $";
|
|---|
| 9 | #endif
|
|---|
| 10 |
|
|---|
| 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... */
|
|---|
| 19 | #define ITERATIONS 10
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | #include <stdio.h>
|
|---|
| 23 | #include <string.h>
|
|---|
| 24 | #include "mpi.h"
|
|---|
| 25 |
|
|---|
| 26 | #define buf_size 128
|
|---|
| 27 |
|
|---|
| 28 | int
|
|---|
| 29 | main (int argc, char **argv)
|
|---|
| 30 | {
|
|---|
| 31 | int nprocs = -1;
|
|---|
| 32 | int rank = -1;
|
|---|
| 33 | int i;
|
|---|
| 34 | char processor_name[128];
|
|---|
| 35 | int namelen = 128;
|
|---|
| 36 | MPI_Comm newcomm[ITERATIONS];
|
|---|
| 37 |
|
|---|
| 38 | /* init */
|
|---|
| 39 | MPI_Init (&argc, &argv);
|
|---|
| 40 | MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
|
|---|
| 41 | MPI_Comm_rank (MPI_COMM_WORLD, &rank);
|
|---|
| 42 | MPI_Get_processor_name (processor_name, &namelen);
|
|---|
| 43 | // printf ("(%d) is alive on %s\n", rank, processor_name);
|
|---|
| 44 | fflush (stdout);
|
|---|
| 45 |
|
|---|
| 46 | MPI_Barrier (MPI_COMM_WORLD);
|
|---|
| 47 |
|
|---|
| 48 | for (i = 0; i < ITERATIONS; i++) {
|
|---|
| 49 | MPI_Comm_dup (MPI_COMM_WORLD, &newcomm[i]);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | for (i = 0; i < ITERATIONS; i++) {
|
|---|
| 53 | MPI_Barrier (newcomm[i]);
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | for (i = 0; i < ITERATIONS; i++) {
|
|---|
| 58 | MPI_Comm_free (&newcomm[i]);
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | MPI_Barrier (MPI_COMM_WORLD);
|
|---|
| 62 |
|
|---|
| 63 | printf ("(%d) Finished normally\n", rank);
|
|---|
| 64 | MPI_Finalize ();
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | /* EOF */
|
|---|