Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] failure with zero-length Reduce() and both sbuf=rbuf=NULL
From: George Bosilca (bosilca_at_[hidden])
Date: 2009-12-10 14:26:22


Lisandro,

This code is not correct from the MPI standard perspective. The reason is independent of the datatype or count, it is solely related to the fact that the MPI_Reduce cannot accept a sendbuf equal to the recvbuf (or one has to use MPI_IN_PLACE).

  george.

On Dec 10, 2009, at 12:02 , Lisandro Dalcin wrote:

> See the code below. The commented-out combinations for sbuf,rbuf do
> work, but the one passing sbuf=rbuf=NULL (i.e, the uncommented one
> show below) makes the call fail with MPI_ERR_ARG.
>
> #include <mpi.h>
>
> int main( int argc, char ** argv ) {
> int ierr;
> int sbuf,rbuf;
> MPI_Init(&argc, &argv);
> ierr = MPI_Reduce(/*&sbuf, &rbuf,*/
> /*&sbuf, NULL,*/
> /*NULL, &rbuf,*/
> NULL, NULL,
> 0, MPI_INT,
> MPI_SUM, 0, MPI_COMM_WORLD);
> MPI_Finalize();
> return 0;
> }
>
>
> --
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel