MPI hypercube broadcast error
Posted
by luvieere
on Stack Overflow
See other posts from Stack Overflow
or by luvieere
Published on 2010-06-08T04:33:25Z
Indexed on
2010/06/10
7:22 UTC
Read the original article
Hit count: 465
I've got a one to all broadcast method for a hypercube, written using MPI:
one2allbcast(int n, int rank, void *data, int count, MPI_Datatype dtype)
{
MPI_Status status;
int mask, partner;
int mask2 = ((1 << n) - 1) ^ (1 << n-1);
for (mask = (1 << n-1); mask; mask >>= 1, mask2 >>= 1)
{
if (rank & mask2 == 0)
{
partner = rank ^ mask;
if (rank & mask)
MPI_Recv(data, count, dtype, partner, 99, MPI_COMM_WORLD, &status);
else
MPI_Send(data, count, dtype, partner, 99, MPI_COMM_WORLD);
}
}
}
Upon calling it from main:
int main( int argc, char **argv )
{
int n, rank;
MPI_Init (&argc, &argv);
MPI_Comm_size (MPI_COMM_WORLD, &n);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);
one2allbcast(floor(log(n) / log (2)), rank, "message", sizeof(message), MPI_CHAR);
MPI_Finalize();
return 0;
}
compiling and executing on 8 nodes, I receive a series of errors reporting that processes 1, 3, 5, 7 were stopped before the point of receiving any data:
MPI_Recv: process in local group is dead (rank 1, MPI_COMM_WORLD)
Rank (1, MPI_COMM_WORLD): Call stack within LAM:
Rank (1, MPI_COMM_WORLD): - MPI_Recv()
Rank (1, MPI_COMM_WORLD): - main()
MPI_Recv: process in local group is dead (rank 3, MPI_COMM_WORLD)
Rank (3, MPI_COMM_WORLD): Call stack within LAM:
Rank (3, MPI_COMM_WORLD): - MPI_Recv()
Rank (3, MPI_COMM_WORLD): - main()
MPI_Recv: process in local group is dead (rank 5, MPI_COMM_WORLD)
Rank (5, MPI_COMM_WORLD): Call stack within LAM:
Rank (5, MPI_COMM_WORLD): - MPI_Recv()
Rank (5, MPI_COMM_WORLD): - main()
MPI_Recv: process in local group is dead (rank 7, MPI_COMM_WORLD)
Rank (7, MPI_COMM_WORLD): Call stack within LAM:
Rank (7, MPI_COMM_WORLD): - MPI_Recv()
Rank (7, MPI_COMM_WORLD): - main()
Where do I go wrong?
© Stack Overflow or respective owner