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.
-Ken
#include <mpi.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv)
{
int rank;
MPI_Comm smallComm;
int senddata[4], recvdata[4], length, offset;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// Split up into communicators of size 1.
MPI_Comm_split(MPI_COMM_WORLD, rank, 0, &smallComm);
// Now try to do a gatherv.
senddata[0] = 5; senddata[1] = 6; senddata[2] = 7; senddata[3] = 8;
recvdata[0] = 0; recvdata[1] = 0; recvdata[2] = 0; recvdata[3] = 0;
length = 3;
offset = 1;
MPI_Gatherv(senddata, length, MPI_INT,
recvdata, &length, &offset, MPI_INT, 0, smallComm);
if (senddata[0] != recvdata[offset])
{
printf("%d: %d != %d?\n", rank, senddata[0], recvdata[offset]);
}
else
{
printf("%d: Everything OK.\n", rank);
}
return 0;
}
**** Kenneth Moreland
*** Sandia National Laboratories
***********
*** *** *** email: kmorel_at_[hidden]
** *** ** phone: (505) 844-8919
*** fax: (505) 845-0833
|