Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reactivate an umpire test, once disabled in 56fefe1bf81ca.
[simgrid.git] / teshsuite / smpi / isp / umpire / abort1.c
1 /* -*- Mode: C; -*- */
2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov) Tue Oct 29 2002 */
3 /* abort1.c -- call MPI abort in all tasks other than zero... */
4
5
6 #include <stdio.h>
7 #include "mpi.h"
8
9
10 int
11 main (int argc, char **argv)
12 {
13   int nprocs = -1;
14   int rank = -1;
15   char processor_name[128];
16   int namelen = 128;
17
18   /* init */
19   MPI_Init (&argc, &argv);
20   MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
21   MPI_Comm_rank (MPI_COMM_WORLD, &rank);
22   MPI_Get_processor_name (processor_name, &namelen);
23   printf ("(%d) is alive on %s\n", rank, processor_name);
24   fflush (stdout);
25
26   MPI_Barrier (MPI_COMM_WORLD);
27
28   if (nprocs < 2) {
29     printf ("not enough tasks\n");
30   }
31   else {
32     if (rank) {
33       printf ("(%d) Aborting\n", rank);
34       MPI_Abort (MPI_COMM_WORLD, -1);
35     }
36   }
37
38   MPI_Barrier (MPI_COMM_WORLD);
39   MPI_Finalize ();
40   printf ("(%d) Finished normally\n", rank);
41 }
42
43 /* EOF */