-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/coll/opprod.c
        -:    0:Graph:opprod.gcno
        -:    0:Data:opprod.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:
        -:   11:/*
        -:   12: * In MPI-2.1, this operation is valid only for C integer, Fortran integer,
        -:   13: * Floating point, and Complex types (5.9.2 Predefined reduce operations)
        -:   14: */
        -:   15:#define MPIR_LPROD(a,b) ((a)*(b))
        -:   16:
        -:   17:#undef FUNCNAME
        -:   18:#define FUNCNAME MPIR_PROD
        -:   19:#undef FCNAME
        -:   20:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   21:void MPIR_PROD (
        -:   22:    void *invec,
        -:   23:    void *inoutvec,
        -:   24:    int *Len,
        -:   25:    MPI_Datatype *type )
     4018:   26:{
     4018:   27:    int i, len = *Len;
        -:   28:
     4018:   29:    switch (*type) {
        -:   30:#undef MPIR_OP_TYPE_MACRO
        -:   31:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_, c_type_, MPIR_LPROD)
        -:   32:        /* no semicolons by necessity */
      440:   33:        MPIR_OP_TYPE_GROUP(C_INTEGER)
    #####:   34:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
      440:   35:        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        -:   36:        /* extra types that are not required to be supported by the MPI Standard */
        9:   37:        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
    #####:   38:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
    #####:   39:        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)
        -:   40:
        -:   41:        /* complex multiplication is slightly different than scalar multiplication */
        -:   42:#undef MPIR_OP_TYPE_MACRO
        -:   43:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_)          \
        -:   44:        case (mpi_type_): {                             \
        -:   45:            c_type_ * restrict a = (c_type_ *)inoutvec; \
        -:   46:            c_type_ * restrict b = (c_type_ *)invec;    \
        -:   47:            for ( i=0; i<len; i++ ) {                   \
        -:   48:                c_type_ c;                              \
        -:   49:                c.re = a[i].re; c.im = a[i].im;         \
        -:   50:                a[i].re = c.re*b[i].re - c.im*b[i].im;  \
        -:   51:                a[i].im = c.im*b[i].re + c.re*b[i].im;  \
        -:   52:            }                                           \
        -:   53:            break;                                      \
        -:   54:        }
        -:   55:#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
        -:   56:#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_,c_type_,MPIR_LPROD)
    #####:   57:        MPIR_OP_TYPE_GROUP(COMPLEX)
        9:   58:        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
        -:   59:        /* put things back where we found them */
        -:   60:#undef MPIR_OP_TYPE_MACRO
        -:   61:#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
        -:   62:#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_) MPIR_OP_TYPE_MACRO(mpi_type_,c_type_)
        -:   63:        /* --BEGIN ERROR HANDLING-- */
        -:   64:        default: {
    #####:   65:            MPIU_THREADPRIV_DECL;
    #####:   66:            MPIU_THREADPRIV_GET;
    #####:   67:            MPIU_THREADPRIV_FIELD(op_errno) = MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_PROD" );
        -:   68:            break;
        -:   69:        }
        -:   70:        /* --END ERROR HANDLING-- */
        -:   71:    }
     4018:   72:}
        -:   73:
        -:   74:
        -:   75:#undef FUNCNAME
        -:   76:#define FUNCNAME MPIR_PROD_check_dtype
        -:   77:#undef FCNAME
        -:   78:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   79:int MPIR_PROD_check_dtype( MPI_Datatype type )
     7282:   80:{
     7282:   81:    switch (type) {
        -:   82:#undef MPIR_OP_TYPE_MACRO
        -:   83:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_) case (mpi_type_):
        -:   84:        MPIR_OP_TYPE_GROUP(C_INTEGER)
        -:   85:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
        -:   86:        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        -:   87:        /* extra types that are not required to be supported by the MPI Standard */
        -:   88:        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
        -:   89:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        -:   90:        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)
        -:   91:
        -:   92:        MPIR_OP_TYPE_GROUP(COMPLEX)
        -:   93:        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
        -:   94:#undef MPIR_OP_TYPE_MACRO
     7274:   95:            return MPI_SUCCESS;
        -:   96:        /* --BEGIN ERROR HANDLING-- */
        -:   97:        default:
        8:   98:            return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_PROD" );
        -:   99:        /* --END ERROR HANDLING-- */
        -:  100:    }
        -:  101:}
        -:  102: