Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Multiply memset size by size of element in umpire.
[simgrid.git] / teshsuite / smpi / isp / umpire / bcast-deadlock.c
1
2
3 #include <stdio.h>
4 #include <string.h>
5 #include "mpi.h"
6
7 #define buf_size 128
8
9 int
10 main (int argc, char **argv)
11 {
12   int rank;
13   MPI_Comm comm = MPI_COMM_WORLD;
14   char processor_name[128];
15   int namelen = 128;
16   int buf0[buf_size];
17   int buf1[buf_size];
18
19   /* init */
20   MPI_Init (&argc, &argv);
21   MPI_Comm_rank (comm, &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   if (rank == 0) {
27     memset (buf0, 0, buf_size*sizeof(int));
28     MPI_Bcast (buf0, buf_size, MPI_INT, 1, MPI_COMM_WORLD);     
29     MPI_Bcast (buf0, buf_size, MPI_INT, 0, MPI_COMM_WORLD);     
30   }
31   else {
32     if (rank == 1)
33       memset (buf1, 1, buf_size*sizeof(int));
34
35     MPI_Bcast (buf0, buf_size, MPI_INT, 0, MPI_COMM_WORLD);     
36     MPI_Bcast (buf0, buf_size, MPI_INT, 1, MPI_COMM_WORLD);     
37   }
38
39   MPI_Finalize ();
40   printf ("(%d) Finished normally\n", rank);
41 }
42
43 /* EOF */