h***@gmail.com
2008-05-23 13:36:30 UTC
Hello,
I'm trying to broadcast a 4MB of data, but even though I followed all
the guidelines for using MPI_Bcast the slaves buffers don't get the
values from root.
I have a master (rank 0), result manager (rank 1) and some slaves.
After some number crunching they all get to following lines
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(Bhalf->data[0], Bhalf->rows*Bhalf->cols, MPI_FLOAT, 0,
MPI_WORLD_COMM);
printf("bcasted, rank:%i [0][0]=%f size:%u\n",rank, Bhalf->data[0][0],
Bhalf->rows*Bhalf->cols);
but the output reads
bcasted, rank:0 [0][0]=27.000000 size:1048576
bcasted, rank:1 [0][0]=0.000000 size:1048576
bcasted, rank:2 [0][0]=0.000000 size:1048576
bcasted, rank:4 [0][0]=0.000000 size:1048576
bcasted, rank:3 [0][0]=0.000000 size:1048576
bcasted, rank:10 [0][0]=0.000000 size:1048576
bcasted, rank:8 [0][0]=0.000000 size:1048576
bcasted, rank:7 [0][0]=0.000000 size:1048576
bcasted, rank:9 [0][0]=0.000000 size:1048576
bcasted, rank:6 [0][0]=0.000000 size:1048576
bcasted, rank:5 [0][0]=0.000000 size:1048576
I have verified via a debugger that they in fact meet at the bcast at
the same time, that the Bhalf is initialized with the same values.
I'm trying to broadcast a 4MB of data, but even though I followed all
the guidelines for using MPI_Bcast the slaves buffers don't get the
values from root.
I have a master (rank 0), result manager (rank 1) and some slaves.
After some number crunching they all get to following lines
MPI_Barrier(MPI_COMM_WORLD);
MPI_Bcast(Bhalf->data[0], Bhalf->rows*Bhalf->cols, MPI_FLOAT, 0,
MPI_WORLD_COMM);
printf("bcasted, rank:%i [0][0]=%f size:%u\n",rank, Bhalf->data[0][0],
Bhalf->rows*Bhalf->cols);
but the output reads
bcasted, rank:0 [0][0]=27.000000 size:1048576
bcasted, rank:1 [0][0]=0.000000 size:1048576
bcasted, rank:2 [0][0]=0.000000 size:1048576
bcasted, rank:4 [0][0]=0.000000 size:1048576
bcasted, rank:3 [0][0]=0.000000 size:1048576
bcasted, rank:10 [0][0]=0.000000 size:1048576
bcasted, rank:8 [0][0]=0.000000 size:1048576
bcasted, rank:7 [0][0]=0.000000 size:1048576
bcasted, rank:9 [0][0]=0.000000 size:1048576
bcasted, rank:6 [0][0]=0.000000 size:1048576
bcasted, rank:5 [0][0]=0.000000 size:1048576
I have verified via a debugger that they in fact meet at the bcast at
the same time, that the Bhalf is initialized with the same values.