2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov) */
4 /* errhandler-no-error.c -- construct some MPI_Errhandlers and free them */
8 "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/errhandler-no-free.c,v 1.1 2002/05/29 16:09:48 bronis Exp $";
15 /* multiple instances of same errhandler to exercise more Umpire code... */
16 #define ERRHANDLER_COUNT 5
21 myErrhandler (MPI_Comm *comm, int *errorcode, ...)
23 char buf[MPI_MAX_ERROR_STRING];
27 fprintf (stderr, "Caught an MPI Error! Time to abort!\n");
29 /* get and print MPI error message... */
30 MPI_Error_string (*(errorcode), buf, &error_strlen);
31 fprintf (stderr, "%s\n", buf);
33 MPI_Abort (*comm, *errorcode);
40 main (int argc, char **argv)
44 MPI_Comm comm = MPI_COMM_WORLD;
46 char processor_name[128];
48 MPI_Errhandler newerrhandler[ERRHANDLER_COUNT];
51 MPI_Init (&argc, &argv);
52 MPI_Comm_size (comm, &nprocs);
53 MPI_Comm_rank (comm, &rank);
54 MPI_Get_processor_name (processor_name, &namelen);
55 printf ("(%d) is alive on %s\n", rank, processor_name);
60 for (i = 0; i < ERRHANDLER_COUNT; i++)
61 MPI_Errhandler_create (myErrhandler, &newerrhandler[i]);
65 printf ("(%d) Finished normally\n", rank);