Logo AND Algorithmique Numérique Distribuée

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