Minor Issue With Alltoall

Minor Issue With Alltoall

The work-around for this is rather obvious, but the behavior between MPI_Alltoall and MPI_Allgather is different as seen in the attached code. According to the standard for both -
The "in place" option for intracommunicators is specied by passing the valueMPI_IN_PLACE to the argument sendbuf at all processes. sendcount and sendtype are ignored.The \\in place" option for intracommunicators is specied by passing the value MPI_IN_PLACE to the argument sendbuf at all processes. sendcount and sendtype are ignored.
As seen in the code, this works correctly for MPI_Allgather. For MPI_Alltoall, the following error occursFatal error in MPI_Alltoall: Invalid datatype, error stack:MPI_Alltoall(851): MPI_Alltoall(sbuf=MPI_IN_PLACE, scount=0, MPI_DATATYPE_NULL, rbuf=0x7fffbfbaa410, rcount=1, MPI_INT, MPI_COMM_WORLD) failedMPI_Alltoall(740): Null Datatype pointerThe MPI_DATATYPE_NULL should be ignored along with the scount.//// test program for the MPI_Type_size bug//// David Race// 17 December 2011//#include #include #include #include //// mpi//#include "mpi.h"#define MAX_SIZE 32//////int main ( int argc, char *argv[] ){ // // definitions // int mpierror, isize, myRank; int typeSize; int valA[MAX_SIZE]; int i; int commRoot; // // start processing // printf("Start of program\\n"); printf("SIZE OF VALA %ld\\n",sizeof(valA)); mpierror = MPI_Init ( &argc, &argv ); mpierror = MPI_Comm_rank ( MPI_COMM_WORLD, &myRank ); mpierror = MPI_Comm_size ( MPI_COMM_WORLD, &isize ); MPI_Barrier(MPI_COMM_WORLD); // // test the mpi_type_size using MPI_Allgather // if (myRank == 0) { printf("=====================================================\\n"); printf(" Allgather \\n"); printf("=====================================================\\n"); fflush(stdout); } for(i=0;i valA[myRank] = myRank; mpierror = MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, valA, 1, MPI_INT, MPI_COMM_WORLD); if (myRank == 0) { for(i=0;i fflush(stdout); } MPI_Barrier(MPI_COMM_WORLD); // // test the mpi_type_size using MPI_Alltoall // if (myRank == 0) { printf("=====================================================\\n"); printf(" Alltoall \\n"); printf("=====================================================\\n"); fflush(stdout); } for(i=0;i commRoot = 0; mpierror = MPI_Alltoall(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, valA, 1, MPI_INT, MPI_COMM_WORLD); if (myRank == 0) { for(i=0;i fflush(stdout); } MPI_Barrier(MPI_COMM_WORLD); if (myRank == 1) { for(i=0;i fflush(stdout); } MPI_Barrier(MPI_COMM_WORLD); mpierror = MPI_Finalize(); fflush(stdout); printf("End of Program\\n");}

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi David,

Thank you for the post. We have submitted the issue to our tracker.

--
Dmitry

Login to leave a comment.