This source file includes following definitions.
- MPIX_Reduce_init
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 
  25 
  26 #include "ompi_config.h"
  27 #include <stdio.h>
  28 
  29 #include "ompi/mpi/c/bindings.h"
  30 #include "ompi/runtime/params.h"
  31 #include "ompi/communicator/communicator.h"
  32 #include "ompi/errhandler/errhandler.h"
  33 #include "ompi/datatype/ompi_datatype.h"
  34 #include "ompi/op/op.h"
  35 #include "ompi/memchecker.h"
  36 #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h"
  37 #include "ompi/runtime/ompi_spc.h"
  38 
  39 #if OMPI_BUILD_MPI_PROFILING
  40 #if OPAL_HAVE_WEAK_SYMBOLS
  41 #pragma weak MPIX_Reduce_init = PMPIX_Reduce_init
  42 #endif
  43 #define MPIX_Reduce_init PMPIX_Reduce_init
  44 #endif
  45 
  46 static const char FUNC_NAME[] = "MPIX_Reduce_init";
  47 
  48 
  49 int MPIX_Reduce_init(const void *sendbuf, void *recvbuf, int count,
  50                      MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm,
  51                      MPI_Info info, MPI_Request *request)
  52 {
  53     int err;
  54 
  55     SPC_RECORD(OMPI_SPC_REDUCE_INIT, 1);
  56 
  57     MEMCHECKER(
  58         memchecker_datatype(datatype);
  59         memchecker_comm(comm);
  60 
  61         if(OMPI_COMM_IS_INTRA(comm)) {
  62             if(ompi_comm_rank(comm) == root) {
  63                 
  64                 if (MPI_IN_PLACE == sendbuf) {
  65                     memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
  66                 } else {
  67                     memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  68                 }
  69 
  70                 
  71                 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, count, datatype);
  72             } else {
  73                 
  74                 memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  75             }
  76         } else {
  77             if (MPI_ROOT == root) {
  78                 
  79                 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, count, datatype);
  80             } else if (MPI_PROC_NULL != root) {
  81                 
  82                 memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  83             }
  84         }
  85     );
  86 
  87     if (MPI_PARAM_CHECK) {
  88         char *msg;
  89         err = MPI_SUCCESS;
  90         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  91         if (ompi_comm_invalid(comm)) {
  92             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  93                                           FUNC_NAME);
  94         }
  95 
  96         
  97 
  98         else if (MPI_OP_NULL == op || NULL == op) {
  99             err = MPI_ERR_OP;
 100         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
 101             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
 102             free(msg);
 103             return ret;
 104         } else if ((ompi_comm_rank(comm) != root && MPI_IN_PLACE == sendbuf) ||
 105                    (ompi_comm_rank(comm) == root && ((MPI_IN_PLACE == recvbuf) || (sendbuf == recvbuf)))) {
 106             err = MPI_ERR_ARG;
 107         } else {
 108             OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
 109         }
 110         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
 111 
 112         
 113 
 114         if (!OMPI_COMM_IS_INTRA(comm)) {
 115             if (! ((root >= 0 && root < ompi_comm_remote_size(comm)) ||
 116                    MPI_ROOT == root || MPI_PROC_NULL == root)) {
 117                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
 118             }
 119         }
 120 
 121         
 122 
 123         else {
 124             if (root < 0 || root >= ompi_comm_size(comm)) {
 125                 return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ROOT, FUNC_NAME);
 126             }
 127         }
 128     }
 129 
 130     
 131 
 132 
 133 
 134     if (0 == count) {
 135         err = ompi_request_persistent_noop_create(request);
 136         OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 137     }
 138 
 139     OPAL_CR_ENTER_LIBRARY();
 140 
 141     
 142     OBJ_RETAIN(op);
 143     err = comm->c_coll->coll_reduce_init(sendbuf, recvbuf, count,
 144                                          datatype, op, root, comm, info, request,
 145                                          comm->c_coll->coll_reduce_init_module);
 146     OBJ_RELEASE(op);
 147     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 148 }