Re: [OMPI devel] failure with zero-length Reduce() and both sbuf=rbuf=NULL

2010-02-09 Thread Lisandro Dalcín
BUMP. See http://code.google.com/p/mpi4py/issues/detail?id=14


On 12 December 2009 00:31, Lisandro Dalcin  wrote:
> On Thu, Dec 10, 2009 at 4:26 PM, George Bosilca  wrote:
>> 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, I have to disagree. Zero-length buffers are a very special
> case, and the MPI std is not very explicit about this limit case. Try
> the code pasted at the end.
>
> 1) In Open MPI, the only one of these failing for sbuf=rbuf=NULL is 
> MPI_Reduce()
>
> 2) As reference, all the calls succeed in MPICH2.
>
>
>
> #include 
> #include 
>
> int main( int argc, char ** argv ) {
>  int ierr;
>  MPI_Init(, );
>  ierr = MPI_Scan(
>                  NULL, NULL,
>                  0,
>                  MPI_INT,
>                  MPI_SUM,
>                  MPI_COMM_WORLD);
>  ierr = MPI_Exscan(
>                    NULL, NULL,
>                    0,
>                    MPI_INT,
>                    MPI_SUM,
>                    MPI_COMM_WORLD);
>  ierr = MPI_Allreduce(
>                       NULL, NULL,
>                       0,
>                       MPI_INT,
>                       MPI_SUM,
>                       MPI_COMM_WORLD);
> #if 1
>  ierr = MPI_Reduce(
>                    NULL, NULL,
>                    0,
>                    MPI_INT,
>                    MPI_SUM,
>                    0,
>                    MPI_COMM_WORLD);
> #endif
>  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
>



-- 
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



Re: [OMPI devel] failure with zero-length Reduce() and both sbuf=rbuf=NULL

2009-12-11 Thread Lisandro Dalcin
On Thu, Dec 10, 2009 at 4:26 PM, George Bosilca  wrote:
> 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, I have to disagree. Zero-length buffers are a very special
case, and the MPI std is not very explicit about this limit case. Try
the code pasted at the end.

1) In Open MPI, the only one of these failing for sbuf=rbuf=NULL is MPI_Reduce()

2) As reference, all the calls succeed in MPICH2.



#include 
#include 

int main( int argc, char ** argv ) {
  int ierr;
  MPI_Init(, );
  ierr = MPI_Scan(
  NULL, NULL,
  0,
  MPI_INT,
  MPI_SUM,
  MPI_COMM_WORLD);
  ierr = MPI_Exscan(
NULL, NULL,
0,
MPI_INT,
MPI_SUM,
MPI_COMM_WORLD);
  ierr = MPI_Allreduce(
   NULL, NULL,
   0,
   MPI_INT,
   MPI_SUM,
   MPI_COMM_WORLD);
#if 1
  ierr = MPI_Reduce(
NULL, NULL,
0,
MPI_INT,
MPI_SUM,
0,
MPI_COMM_WORLD);
#endif
  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



[OMPI devel] failure with zero-length Reduce() and both sbuf=rbuf=NULL

2009-12-10 Thread Lisandro Dalcin
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 

int main( int argc, char ** argv ) {
  int ierr;
  int sbuf,rbuf;
  MPI_Init(, );
  ierr = MPI_Reduce(/*, ,*/
/*, NULL,*/
/*NULL, ,*/
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