Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Remove XBT_INFO call"
[simgrid.git] / teshsuite / bug-17132 / bug-17132.c
1 #include "xbt/log.h"
2 #include <stdio.h>
3 #include <mpi.h>
4
5 XBT_LOG_NEW_DEFAULT_CATEGORY(MM_mpi, "Messages for this SMPI test");
6
7 int main(int argc, char ** argv)
8 {
9   size_t err;
10   size_t M = 8*1024;
11   size_t N = 32*1024;
12
13   MPI_Init(&argc, &argv);
14
15   double *a = malloc(sizeof(double) * M);
16   double *b = malloc(sizeof(double) * N);
17
18   // A broadcast
19   err = MPI_Bcast(a, M, MPI_DOUBLE, 0, MPI_COMM_WORLD);
20   if (err != MPI_SUCCESS) {
21     perror("Error Bcast A\n"); MPI_Finalize(); exit(-1);
22   }
23
24 //  Uncommenting this barrier fixes it!
25 //  MPI_Barrier(MPI_COMM_WORLD);
26
27   // Another broadcast
28   err = MPI_Bcast(b, N, MPI_DOUBLE, 0, MPI_COMM_WORLD );
29   if (err != MPI_SUCCESS) {
30     perror("Error Bcast B\n"); MPI_Finalize(); exit(-1);
31   }
32
33   // Commenting out this barrier fixes it!!
34   MPI_Barrier(MPI_COMM_WORLD);
35
36   MPI_Finalize();
37   free(a);
38   free(b);
39   return 0;
40 }