Yoinks -- shame on me for not looking at the expanded reduction datatype/op tables in MPI-2 for C++. Double shame on me because I wrote that section. :-)

I've committed the fix to the trunk; it'll be in the upcoming 1.0.2 release.


On Mar 2, 2006, at 8:02 PM, Andy Selle wrote:

I am trying to do a reduction using a bool type using the C++ bindings. I am
using this sample program to test:

---------------------------------------------
#include <mpi.h>
#include <iostream>

int main(int argc,char *argv[])
{
    MPI::Init();
    int rank=MPI::COMM_WORLD.Get_rank();

    {bool test=true;
    bool result;
    MPI::COMM_WORLD.Allreduce(&test,&result,1,MPI::BOOL,MPI::LOR);
std::cout<<"rank "<<rank<<" got in="<<test<<" out="<<result<<std::endl;}

    MPI::Finalize();
    return 0;
}
---------------------------------------------

The result of running this on OpenMPI is:
---------------------------------------------
[div:17034] *** An error occurred in MPI_Allreduce: the reduction operation
MPI_LOR is not defined on the MPI_CXX_BOOL datatype
[div:17034] *** on communicator MPI_COMM_WORLD
[div:17034] *** MPI_ERR_OP: invalid reduce operation
[div:17034] *** MPI_ERRORS_ARE_FATAL (goodbye)
[div:17034] [0,0,0] ORTE_ERROR_LOG: Not found in file pls_base_proxy.c at line
183
---------------------------------------------

Alternatively on LAM this works fine and I get:

---------------------------------------------
aselle@div mpi $ mpirun -np 4 ./reduce.lam
rank 0 got in=1 out=1
rank 1 got in=1 out=1
rank 2 got in=1 out=1
rank 3 got in=1 out=1
---------------------------------------------

Looking at OpenMPI's source it doesn't seem like there is a type map entry for
the bool case in the op_predefined.c

---------
#undef current_func
#define current_func(a, b) ((a) || (b))
/* C integer */
FUNC_FUNC(lor, int, int)
FUNC_FUNC(lor, long, long)
FUNC_FUNC(lor, short, short)
FUNC_FUNC(lor, unsigned_short, unsigned short)
FUNC_FUNC(lor, unsigned, unsigned)
FUNC_FUNC(lor, unsigned_long, unsigned long)
#if HAVE_LONG_LONG
FUNC_FUNC(lor, long_long_int, long long int)
FUNC_FUNC(lor, long_long, long long)
FUNC_FUNC(lor, unsigned_long_long, unsigned long long)
#endif
/* Logical */
#if OMPI_HAVE_FORTRAN_LOGICAL
FUNC_FUNC(lor, fortran_logical, ompi_fortran_logical_t)
#endif

I am using OpenMPI 1.0.1.

-Andy
_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users


--
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/


Reply via email to