-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/coll/opsum.c
        -:    0:Graph:opsum.gcno
        -:    0:Data:opsum.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_LSUM(a,b) ((a)+(b))
        -:   16:
        -:   17:#undef FUNCNAME
        -:   18:#define FUNCNAME MPIR_SUM
        -:   19:#undef FCNAME
        -:   20:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   21:void MPIR_SUM (
        -:   22:    void *invec,
        -:   23:    void *inoutvec,
        -:   24:    int *Len,
        -:   25:    MPI_Datatype *type )
  1134183:   26:{
  1134183:   27:    int i, len = *Len;
        -:   28:
  1134183:   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_LSUM)
        -:   32:        /* no semicolons by necessity */
  1099475:   33:        MPIR_OP_TYPE_GROUP(C_INTEGER)
      125:   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 */
        3:   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 addition is slightly different than scalar addition */
        -:   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:            const c_type_ * restrict b = (c_type_ *)invec; \
        -:   47:            for ( i=0; i<len; i++ ) {                      \
        -:   48:                a[i].re = MPIR_LSUM(a[i].re ,b[i].re);     \
        -:   49:                a[i].im = MPIR_LSUM(a[i].im ,b[i].im);     \
        -:   50:            }                                              \
        -:   51:            break;                                         \
        -:   52:        }
        -:   53:        /* C complex types are just simple sums */
        -:   54:#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
        -:   55:#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_) MPIR_OP_TYPE_REDUCE_CASE(mpi_type_,c_type_,MPIR_LSUM)
    #####:   56:        MPIR_OP_TYPE_GROUP(COMPLEX)
        3:   57:        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
        -:   58:        /* put things back where we found them */
        -:   59:#undef MPIR_OP_TYPE_MACRO
        -:   60:#undef MPIR_OP_C_COMPLEX_TYPE_MACRO
        -:   61:#define MPIR_OP_C_COMPLEX_TYPE_MACRO(mpi_type_,c_type_) MPIR_OP_TYPE_MACRO(mpi_type_,c_type_)
        -:   62:        /* --BEGIN ERROR HANDLING-- */
        -:   63:        default: {
    #####:   64:            MPIU_THREADPRIV_DECL;
    #####:   65:            MPIU_THREADPRIV_GET;
    #####:   66:            MPIU_THREADPRIV_FIELD(op_errno) = MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_SUM" );
        -:   67:            break;
        -:   68:        }
        -:   69:        /* --END ERROR HANDLING-- */
        -:   70:    }
  1134183:   71:}
        -:   72:
        -:   73:
        -:   74:#undef FUNCNAME
        -:   75:#define FUNCNAME MPIR_SUM_check_dtype
        -:   76:#undef FCNAME
        -:   77:#define FCNAME MPIU_QUOTE(FUNCNAME)
        -:   78:int MPIR_SUM_check_dtype( MPI_Datatype type )
   112233:   79:{
   112233:   80:    switch (type) {
        -:   81:#undef MPIR_OP_TYPE_MACRO
        -:   82:#define MPIR_OP_TYPE_MACRO(mpi_type_, c_type_) case (mpi_type_):
        -:   83:        MPIR_OP_TYPE_GROUP(C_INTEGER)
        -:   84:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER)
        -:   85:        MPIR_OP_TYPE_GROUP(FLOATING_POINT)
        -:   86:        /* extra types that are not required to be supported by the MPI Standard */
        -:   87:        MPIR_OP_TYPE_GROUP(C_INTEGER_EXTRA)
        -:   88:        MPIR_OP_TYPE_GROUP(FORTRAN_INTEGER_EXTRA)
        -:   89:        MPIR_OP_TYPE_GROUP(FLOATING_POINT_EXTRA)
        -:   90:
        -:   91:        MPIR_OP_TYPE_GROUP(COMPLEX)
        -:   92:        MPIR_OP_TYPE_GROUP(COMPLEX_EXTRA)
        -:   93:#undef MPIR_OP_TYPE_MACRO
   112225:   94:            return MPI_SUCCESS;
        -:   95:        /* --BEGIN ERROR HANDLING-- */
        -:   96:        default:
        8:   97:            return MPIR_Err_create_code( MPI_SUCCESS, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OP, "**opundefined","**opundefined %s", "MPI_SUM" );
        -:   98:        /* --END ERROR HANDLING-- */
        -:   99:    }
        -:  100:}
        -:  101: