Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix umpire issues : MPI_Comm cannot be safely put inside an int
[simgrid.git] / teshsuite / smpi / isp / umpire / group-no-error.c
1 /* -*- Mode: C; -*- */
2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov) */
3
4 /* group-no-error.c -- construct a group and free it */
5
6 #ifndef lint
7 static char *rcsid =
8   "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/group-no-error.c,v 1.2 2003/01/13 18:31:48 bronis Exp $";
9 #endif
10
11 #include <stdio.h>
12 #include <string.h>
13 #include "mpi.h"
14
15 #define buf_size 128
16
17 int
18 main (int argc, char **argv)
19 {
20   int nprocs = -1;
21   int rank = -1;
22   char processor_name[128];
23   int namelen = 128;
24   MPI_Group newgroup, newgroup2;
25
26   /* init */
27   MPI_Init (&argc, &argv);
28   MPI_Comm_size (MPI_COMM_WORLD, &nprocs);
29   MPI_Comm_rank (MPI_COMM_WORLD, &rank);
30   MPI_Get_processor_name (processor_name, &namelen);
31   printf ("(%d) is alive on %s\n", rank, processor_name);
32   fflush (stdout);
33
34   MPI_Barrier (MPI_COMM_WORLD);
35   MPI_Comm_group (MPI_COMM_WORLD, &newgroup);
36   MPI_Group_free (&newgroup);
37   MPI_Barrier (MPI_COMM_WORLD);
38   /* now with an alias... */
39   MPI_Comm_group (MPI_COMM_WORLD, &newgroup);
40   newgroup2 = newgroup;
41   MPI_Group_free (&newgroup2);
42   MPI_Barrier (MPI_COMM_WORLD);
43   printf ("(%d) Finished normally\n", rank);
44   MPI_Finalize ();
45 }
46
47 /* EOF */