Sorry to reply to my own mail, but the bug only affects MPI_Allgatherv.
In this changeset:
https://svn.open-mpi.org/trac/ompi/changeset/16360
In coll_self_allgatherv.c, the "extent" variable is never used. So the
fix is just to multiply
"extent" by disps[0], on line 50. I've verified that this fixes the
problem.
Daniel G. Hyams wrote:
I don't think that the displacements (disps) are being handled correctly
in MPI_Allgatherv, for a single process case.
The disps are being handled as byte offsets, instead of 'item'
offsets...they need to be multiplied by the size, in bytes,
of the MPI_Datatype being sent.
This bug seems to be closely related this:
https://svn.open-mpi.org/trac/ompi/changeset/16360
and probably is present in all of the routines listed there.
The following code demonstrates the problem; make sure you run it as one
process only. The input and output should
be the same, but that is not the case.
==================================================
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
void tcalloc(int **p,int n)
{
*p = (int*)calloc(n,sizeof(int));
}
int main(int argc, char * argv[])
{
int i;
int nto_global = 0;
int np = 1;
int *propto_global = NULL;
int *propto = NULL;
int nto = 10;
int counts[1];
int displs[1];
MPI_Init(&argc,&argv);
tcalloc(&propto,nto+1);
for (i = 1; i <= nto; i++) propto[i] = i;
counts[0] = nto;
displs[0] = 1;
// BUG: if I set displs[0] above to 4, things work as expected. But,
the displacements
// are supposed to be the number of items, not bytes.
for (i = 0; i < np; i++)
{
nto_global += counts[i];
}
tcalloc(&propto_global, nto_global+1);
for (i = 1; i <= nto; i++) printf("INPUT %d --> %d\n",i,propto[i]);
MPI_Allgatherv(propto+1,
nto,
MPI_INT,
propto_global,
counts,
displs,
MPI_INT,
MPI_COMM_WORLD);
for (i = 1; i <= nto_global; i++) printf("OUTPUT %d -->
%d\n",i,propto_global[i]);
free(propto_global);
free(propto);
return(0);
}
--
=========================================================
Daniel G. Hyams
Associate Research Professor
UT SimCenter at Chattanooga
Email: daniel-hy...@utc.edu
Phone: 423-425-5491
Fax: 423-425-5517
=========================================================