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 / deadlock-config.c
1 /* $Header: /usr/gapps/asde/cvs-vault/umpire/tests/deadlock-config.c,v 1.2 2001/09/20 22:27:28 bronis Exp $ */
2
3 #include <stdio.h>
4 #include "mpi.h"
5
6 #define buf_size 32000
7
8 int
9 main (int argc, char **argv)
10 {
11   int nprocs = -1;
12   int rank = -1;
13   float data[buf_size];
14   int tag = 30;
15   char processor_name[128];
16   int namelen = buf_size;
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   if (rank == 0)
23     {
24       printf ("WARNING: This test depends on the MPI's eager limit. "
25               "Set it appropriately.\n");
26     }
27   printf ("Initializing (%d of %d)\n", rank, nprocs);
28   MPI_Get_processor_name (processor_name, &namelen);
29   printf ("(%d) is alive on %s\n", rank, processor_name);
30   fflush (stdout);
31   {
32     int dest = (rank == nprocs - 1) ? (0) : (rank + 1);
33     data[0] = rank;
34     MPI_Send (data, buf_size, MPI_FLOAT, dest, tag, MPI_COMM_WORLD);
35     printf ("(%d) sent data %f\n", rank, data[0]);
36     fflush (stdout);
37   }
38   {
39     int src = (rank == 0) ? (nprocs - 1) : (rank - 1);
40     MPI_Status status;
41     MPI_Recv (data, buf_size, MPI_FLOAT, src, tag, MPI_COMM_WORLD, &status);
42     printf ("(%d) got data %f\n", rank, data[0]);
43     fflush (stdout);
44   }
45   MPI_Finalize ();
46   printf ("(%d) Finished normally\n", rank);
47 }
48
49                                  /* EOF */