Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This used to work by accident
[simgrid.git] / teshsuite / smpi / mpich-test / coll / bcastbug2.c
1 #include "mpi.h"
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include "test.h"
5
6 int main( int argc, char **argv)
7 {
8    char *buf;
9    int i, iam;
10    MPI_Init(&argc, &argv);
11    MPI_Barrier(MPI_COMM_WORLD);
12    buf = (char *)malloc(32*1024);
13    MPI_Comm_rank(MPI_COMM_WORLD, &iam);
14    for(i=1; i<=32; i++){
15       if (iam == 0){
16          *buf=i;
17          printf("Broadcasting %d bytes\n", i*64);
18          }
19       MPI_Bcast(buf, i*64, MPI_BYTE, 0, MPI_COMM_WORLD);
20       if (*buf != i) printf("Sanity check error on node %d\n", iam);
21 /*      gsync();
22 */
23       MPI_Barrier(MPI_COMM_WORLD);
24       }
25    Test_Waitforall( );
26    MPI_Finalize();
27
28    return 0;
29 }