I recently ran into a problem with GATHERV while running some randomized
tests on my MPI code. The problem seems to occur when running
MPI_Gatherv with a displacement on a communicator with a single process.
The code listed below exercises this errant behavior. I have tried it
on OpenMPI 1.1.2 and 1.2.4.
Granted, this is not a situation that one would normally run into in a
real application, but I just wanted to check to make sure I was not
doing anything wrong.
int main(int argc, char **argv)
int senddata, recvdata, length, offset;
// Split up into communicators of size 1.
MPI_Comm_split(MPI_COMM_WORLD, rank, 0, &smallComm);
// Now try to do a gatherv.
senddata = 5; senddata = 6; senddata = 7; senddata = 8;
recvdata = 0; recvdata = 0; recvdata = 0; recvdata = 0;
length = 3;
offset = 1;
MPI_Gatherv(senddata, length, MPI_INT,
recvdata, &length, &offset, MPI_INT, 0, smallComm);
if (senddata != recvdata[offset])
printf("%d: %d != %d?\n", rank, senddata, recvdata[offset]);
printf("%d: Everything OK.\n", rank);
**** Kenneth Moreland
*** Sandia National Laboratories
*** *** *** email: kmorel_at_[hidden]
** *** ** phone: (505) 844-8919
*** fax: (505) 845-0833