-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpi/coll/reduce_local.c
-: 0:Graph:reduce_local.gcno
-: 0:Data:reduce_local.gcda
-: 0:Runs:513
-: 0:Programs:138
-: 1:/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-: 2:/*
-: 3: *
-: 4: * (C) 2009 by Argonne National Laboratory.
-: 5: * See COPYRIGHT in top-level directory.
-: 6: */
-: 7:
-: 8:#include "mpiimpl.h"
-: 9:
-: 10:/* -- Begin Profiling Symbol Block for routine MPI_Reduce_local */
-: 11:#if defined(HAVE_PRAGMA_WEAK)
-: 12:#pragma weak MPI_Reduce_local = PMPI_Reduce_local
-: 13:#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-: 14:#pragma _HP_SECONDARY_DEF PMPI_Reduce_local MPI_Reduce_local
-: 15:#elif defined(HAVE_PRAGMA_CRI_DUP)
-: 16:#pragma _CRI duplicate MPI_Reduce_local as PMPI_Reduce_local
-: 17:#endif
-: 18:/* -- End Profiling Symbol Block */
-: 19:
-: 20:/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-: 21: the MPI routines */
-: 22:#ifndef MPICH_MPI_FROM_PMPI
-: 23:#undef MPI_Reduce_local
-: 24:#define MPI_Reduce_local PMPI_Reduce_local
-: 25:/* any utility functions should go here, usually prefixed with PMPI_LOCAL to
-: 26: * correctly handle weak symbols and the profiling interface */
-: 27:#endif
-: 28:
-: 29:#undef FUNCNAME
-: 30:#define FUNCNAME MPI_Reduce_local
-: 31:#undef FCNAME
-: 32:#define FCNAME MPIU_QUOTE(FUNCNAME)
-: 33:/*@
-: 34:MPI_Reduce_local - Applies a reduction operator to local arguments.
-: 35:
-: 36:Input Parameters:
-: 37:+ inbuf - address of the input buffer (choice)
-: 38:. count - number of elements in each buffer (integer)
-: 39:. datatype - data type of elements in the buffers (handle)
-: 40:- op - reduction operation (handle)
-: 41:
-: 42:Output Parameter:
-: 43:. inoutbuf - address of input-output buffer (choice)
-: 44:
-: 45:.N ThreadSafe
-: 46:
-: 47:.N Fortran
-: 48:
-: 49:.N collops
-: 50:
-: 51:.N Errors
-: 52:.N MPI_SUCCESS
-: 53:.N MPI_ERR_COUNT
-: 54:.N MPI_ERR_TYPE
-: 55:.N MPI_ERR_BUFFER
-: 56:.N MPI_ERR_BUFFER_ALIAS
-: 57:@*/
-: 58:int MPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datatype, MPI_Op op)
136: 59:{
136: 60: int mpi_errno = MPI_SUCCESS;
-: 61: MPI_User_function *uop;
-: 62: MPID_Op *op_ptr;
-: 63:#ifdef HAVE_CXX_BINDING
136: 64: int is_cxx_uop = 0;
-: 65:#endif
136: 66: MPIU_THREADPRIV_DECL;
-: 67: MPID_MPI_STATE_DECL(MPID_STATE_MPI_REDUCE_LOCAL);
-: 68:
136: 69: MPIR_ERRTEST_INITIALIZED_ORDIE();
-: 70:
136: 71: MPIU_THREAD_CS_ENTER(ALLFUNC,);
-: 72: MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_REDUCE_LOCAL);
-: 73:
-: 74: /* Validate parameters */
|
-: 75:# ifdef HAVE_ERROR_CHECKING
-: 76: {
-: 77: MPID_BEGIN_ERROR_CHECKS;
-: 78: {
136: 79: MPIR_ERRTEST_OP(op, mpi_errno);
136: 80: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-: 81:
136: 82: if (HANDLE_GET_KIND(op) != HANDLE_KIND_BUILTIN) {
68: 83: MPID_Op_get_ptr(op, op_ptr);
68: 84: MPID_Op_valid_ptr( op_ptr, mpi_errno );
-: 85: }
136: 86: if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
68: 87: mpi_errno = (*MPIR_Op_check_dtype_table[op%16 - 1])(datatype);
-: 88: }
136: 89: if (count != 0) {
128: 90: MPIR_ERRTEST_ALIAS_COLL(inbuf, inoutbuf, mpi_errno);
-: 91: }
136: 92: if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-: 93: }
-: 94: MPID_END_ERROR_CHECKS;
-: 95: }
-: 96:# endif /* HAVE_ERROR_CHECKING */
-: 97:
-: 98:
-: 99: /* ... body of routine ... */
-: 100:
|
136: 101: if (count == 0) goto fn_exit;
-: 102:
128: 103: MPIU_THREADPRIV_GET;
128: 104: MPIU_THREADPRIV_FIELD(op_errno) = MPI_SUCCESS;
-: 105:
128: 106: if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
-: 107: /* get the function by indexing into the op table */
64: 108: uop = MPIR_Op_table[op%16 - 1];
-: 109: }
-: 110: else {
64: 111: MPID_Op_get_ptr(op, op_ptr);
-: 112:
-: 113:#ifdef HAVE_CXX_BINDING
64: 114: if (op_ptr->language == MPID_LANG_CXX) {
|
#####: 115: uop = (MPI_User_function *) op_ptr->function.c_function;
#####: 116: is_cxx_uop = 1;
-: 117: }
-: 118: else
-: 119:#endif
-: 120: {
|
64: 121: if ((op_ptr->language == MPID_LANG_C))
64: 122: uop = (MPI_User_function *) op_ptr->function.c_function;
-: 123: else
|
#####: 124: uop = (MPI_User_function *) op_ptr->function.f77_function;
-: 125: }
-: 126: }
-: 127:
-: 128: /* actually perform the reduction */
-: 129:#ifdef HAVE_CXX_BINDING
|
128: 130: if (is_cxx_uop) {
|
#####: 131: (*MPIR_Process.cxx_call_op_fn)(inbuf, inoutbuf, count, datatype, uop);
-: 132: }
-: 133: else
-: 134:#endif
-: 135: {
|
128: 136: (*uop)(inbuf, inoutbuf, &count, &datatype);
-: 137: }
-: 138:
|
-: 139: /* --BEGIN ERROR HANDLING-- */
128: 140: if (MPIU_THREADPRIV_FIELD(op_errno))
#####: 141: mpi_errno = MPIU_THREADPRIV_FIELD(op_errno);
-: 142: /* --END ERROR HANDLING-- */
-: 143:
-: 144: /* ... end of body of routine ... */
-: 145:
|
136: 146: fn_exit:
|
-: 147: MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_REDUCE_LOCAL);
|
136: 148: MPIU_THREAD_CS_EXIT(ALLFUNC,);
136: 149: return mpi_errno;
-: 150:
|
#####: 151: fn_fail:
-: 152: /* --BEGIN ERROR HANDLING-- */
-: 153:# ifdef HAVE_ERROR_CHECKING
-: 154: {
#####: 155: mpi_errno = MPIR_Err_create_code(
-: 156: mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_reduce_local",
-: 157: "**mpi_reduce_local %p %p %d %D %O", inbuf, inoutbuf, count, datatype, op);
-: 158: }
-: 159:# endif
#####: 160: mpi_errno = MPIR_Err_return_comm( NULL, FCNAME, mpi_errno );
#####: 161: goto fn_exit;
-: 162: /* --END ERROR HANDLING-- */
-: 163:}
-: 164:
|