[mvapich-discuss] reduce in place
Roland Schulz
roland at utk.edu
Fri Dec 11 09:43:06 EST 2009
Hi,
the below program crashes in MPI_Reduce. It works fine in OpenMPI or an
equivalent version without MPI_IN_PLACE. Is MPI_IN_PLACE not supported with
MPI_Reduce?
Or do I call it wrong? Or is this a bug in mvapich?
It segfaults in 1.0.2 and 1.4 (with ofed 1.1).
Thanks Roland
==========
#include <mpi.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
double nr = 4;
double *r = (double*)malloc(nr*sizeof(double));
MPI_Comm comm_intra;
int rank;
MPI_Init(&argc,&argv);
comm_intra = MPI_COMM_WORLD;
MPI_Comm_rank(comm_intra, &rank);
if (rank==0) {
MPI_Reduce(MPI_IN_PLACE,r,nr,MPI_DOUBLE,MPI_SUM,0,
comm_intra);
} else {
MPI_Reduce(r,NULL,nr,MPI_DOUBLE,MPI_SUM,0,comm_intra);
}
free(r);
return 0;
}
--
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.cse.ohio-state.edu/pipermail/mvapich-discuss/attachments/20091211/706e35e7/attachment.html
More information about the mvapich-discuss
mailing list