Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reactivate an umpire test, once disabled in 56fefe1bf81ca.
[simgrid.git] / teshsuite / smpi / isp / umpire / group-no-free2.c
1 /* -*- Mode: C; -*- */
2 /* Creator: Bronis R. de Supinski (bronis@llnl.gov) */
3
4 /* group-no-free2.c -- construct many groups without freeing some */
5
6 #ifndef lint
7 static char *rcsid =
8   "$Header: /usr/gapps/asde/cvs-vault/umpire/tests/group-no-free2.c,v 1.1 2003/01/13 18:31:48 bronis Exp $";
9 #endif
10
11
12 /* NOTE: Some value of ITERATIONS will imply resource exhaustion */
13 /*       either in Umpire or MPI no matter how things are implemented */
14 /*       the best we can hope for is to fail gracefully... */
15 /* UNKNOWN N breaks umpire due to running out of memory as of 12/20/02... */
16 /* FAILURE IS NOT GRACEFUL AS OF THIS TIME... */
17 #define ITERATIONS                  100
18 #define GROUPS_PER_ITERATION          3
19 #define GROUPS_LOST_PER_ITERATION     1
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, j;
34   char processor_name[128];
35   int namelen = 128;
36   MPI_Group newgroup[GROUPS_PER_ITERATION];
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     for (j = 0; j < GROUPS_PER_ITERATION; j++) {
50       MPI_Comm_group (MPI_COMM_WORLD, &newgroup[j]);
51
52       if (j < GROUPS_PER_ITERATION - GROUPS_LOST_PER_ITERATION) {
53         MPI_Group_free (&newgroup[j]);
54       }
55     }
56   }
57
58   MPI_Barrier (MPI_COMM_WORLD);
59   printf ("(%d) Finished normally\n", rank);
60   MPI_Finalize ();
61 }
62
63 /* EOF */