Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Andy Selle (aselle_at_[hidden])
Date: 2006-03-02 20:02:43

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[])
    int rank=MPI::COMM_WORLD.Get_rank();

    {bool test=true;
    bool result;
    std::cout<<"rank "<<rank<<" got in="<<test<<" out="<<result<<std::endl;}

    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

Alternatively on LAM this works fine and I get:

aselle_at_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)
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)
/* Logical */
FUNC_FUNC(lor, fortran_logical, ompi_fortran_logical_t)

I am using OpenMPI 1.0.1.