-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/coll/opland.c
        -:    0:Graph:opland.gcno
        -:    0:Data:opland.gcda
        -:    0:Runs:4382
        -:    0:Programs:1376
        -:    1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
        -:    2:/*
        -:    3: *
        -:    4: *  (C) 2001 by Argonne National Laboratory.
        -:    5: *      See COPYRIGHT in top-level directory.
        -:    6: */
        -:    7:
        -:    8:#include "mpiimpl.h"
        -:    9:#include "oputil.h"
        -:   10:#ifdef HAVE_FORTRAN_BINDING
        -:   11:#include "mpi_fortlogical.h"
        -:   12:#endif
        -:   13:
        -:   14:/* We have enabled extensive warnings when using gcc for certain builds.
        -:   15:   For this file, this generates many specious warnings */
        -:   16:#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
        -:   17:#pragma GCC diagnostic ignored "-Wfloat-equal"
        -:   18:#endif
        -:   19:
        -:   20:/*
        -:   21: * In MPI-2.1, this operation is valid only for C integer and Logical
        -:   22: * types (5.9.2 Predefined reduce operations)
        -:   23: */
        -:   24:#ifndef MPIR_LLAND
        -:   25:#define MPIR_LLAND(a,b) ((a)&&(b))
        -:   26:#endif
        -:   27:
        -:   28:#undef FUNCNAME
        -:   29:#define FUNCNAME MPIR_LAND
        -:   30:#undef FCNAME
        -:   31:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   32:void MPIR_LAND (
        -:   33:    void *invec,
        -:   34:    void *inoutvec,
        -:   35:    int *Len,
        -:   36:    MPI_Datatype *type )
     7566:   37:{
     7566:   38:    int i, len = *Len;
        -:   39:
     7566:   40:    switch (*type) {
        -:   41:#undef MPIR_OP_TYPE_MACRO
        -:   42:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPIR_LLAND)
        -:   43:        /* no semicolons by necessity */
     5203:   44:        MPIR_OP_TYPE_GROUP(C_INTEGER)
        -:   45:
        -:   46:        /* MPI_LOGICAL requires special handling (MPIR_{TO,FROM}_FLOG) */
        -:   47:#if defined(HAVE_FORTRAN_BINDING)
        -:   48:#  undef MPIR_OP_TYPE_MACRO_HAVE_FORTRAN
        -:   49:#  define MPIR_OP_TYPE_MACRO_HAVE_FORTRAN(mpi_type_, c_type_)          \
        -:   50:    case (mpi_type_): {                                                \
        -:   51:            c_type_ * restrict a = (c_type_ *)inoutvec;                \
        -:   52:            c_type_ * restrict b = (c_type_ *)invec;                   \
        -:   53:            for (i=0; i<len; i++)                                      \
        -:   54:                a[i] = MPIR_TO_FLOG(MPIR_LLAND(MPIR_FROM_FLOG(a[i]),   \
        -:   55:                                               MPIR_FROM_FLOG(b[i]))); \
        -:   56:            break;                                                     \
        -:   57:    }
        -:   58:        /* expand logicals (which may include MPI_C_BOOL, a non-Fortran type) */
    #####:   59:        MPIR_OP_TYPE_GROUP(LOGICAL)
        -:   60:        MPIR_OP_TYPE_GROUP(LOGICAL_EXTRA)
        -:   61:        /* now revert _HAVE_FORTRAN macro to default */
        -:   62:#  undef MPIR_OP_TYPE_MACRO_HAVE_FORTRAN
        -:   63:#  define MPIR_OP_TYPE_MACRO_HAVE_FORTRAN(mpi_type_, c_type_) MPIR_OP_TYPE_MACRO(mpi_type_, c_type_)
        -:   64:#else
        -:   65:        /* if we don't have Fortran support then we don't have to jump through
        -:   66:           any hoops, simply expand the group */
        -:   67:        MPIR_OP_TYPE_GROUP(LOGICAL)
        -:   68:        MPIR_OP_TYPE_GROUP(LOGICAL_EXTRA)
        -:   69:#endif
        -:   70:
        -:   71:        /* extra types that are not required to be supported by the MPI Standard */
        3:   72:        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
    #####:   73:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
    #####:   74:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        -:   75:        /* We previously supported floating point types, although I question
        -:   76:           their utility in logical boolean ops [goodell@ 2009-03-16] */
        3:   77:        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
    #####:   78:        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)
        -:   79:#undef MPIR_OP_TYPE_MACRO
        -:   80:        /* --BEGIN ERROR HANDLING-- */
        -:   81:        default: {
    #####:   82:            MPIU_THREADPRIV_DECL;
    #####:   83:            MPIU_THREADPRIV_GET;
    #####:   84:            MPIU_THREADPRIV_FIELD(op_errno) = MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_LAND" );
        -:   85:            break;
        -:   86:        }
        -:   87:        /* --END ERROR HANDLING-- */
        -:   88:    }
     7566:   89:}
        -:   90:
        -:   91:
        -:   92:#undef FUNCNAME
        -:   93:#define FUNCNAME MPIR_LAND
        -:   94:#undef FCNAME
        -:   95:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   96:int MPIR_LAND_check_dtype ( MPI_Datatype type )
    11934:   97:{
    11934:   98:    switch (type) {
        -:   99:#undef MPIR_OP_TYPE_MACRO
        -:  100:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_) case (mpi_type_):
        -:  101:        MPIR_OP_TYPE_GROUP(C_INTEGER)
        -:  102:        MPIR_OP_TYPE_GROUP(LOGICAL) /* no special handling needed in check_dtype code */
        -:  103:        MPIR_OP_TYPE_GROUP(LOGICAL_EXTRA)
        -:  104:
        -:  105:        /* extra types that are not required to be supported by the MPI Standard */
        -:  106:        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
        -:  107:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
        -:  108:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        -:  109:        /* We previously supported floating point types, although I question
        -:  110:           their utility in logical boolean ops [goodell@ 2009-03-16] */
        -:  111:        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        -:  112:        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)
        -:  113:#undef MPIR_OP_TYPE_MACRO
    11926:  114:            return MPI_SUCCESS;
        -:  115:        /* --BEGIN ERROR HANDLING-- */
        -:  116:        default:
        8:  117:            return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_LAND" );
        -:  118:        /* --END ERROR HANDLING-- */
        -:  119:    }
        -:  120:}
        -:  121: