Community
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Race
Beginner
50 Views

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 speci ed by passing the value
MPI_IN_PLACE to the argument sendbuf at all processes. sendcount and sendtype are ignored.
The \\in place" option for intracommunicators is speci ed 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 occurs
Fatal 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_WOR
LD) failed
MPI_Alltoall(740): Null Datatype pointer
The 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 = 0;
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 = 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");
}
0 Kudos
1 Reply
Dmitry_S_Intel
Moderator
50 Views

Hi David,

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

--
Dmitry
Reply