This source file includes following definitions.
- MPI_Scan
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 
  20 
  21 
  22 
  23 
  24 #include "ompi_config.h"
  25 #include <stdio.h>
  26 
  27 #include "ompi/mpi/c/bindings.h"
  28 #include "ompi/runtime/params.h"
  29 #include "ompi/communicator/communicator.h"
  30 #include "ompi/errhandler/errhandler.h"
  31 #include "ompi/datatype/ompi_datatype.h"
  32 #include "ompi/op/op.h"
  33 #include "ompi/memchecker.h"
  34 #include "ompi/runtime/ompi_spc.h"
  35 
  36 #if OMPI_BUILD_MPI_PROFILING
  37 #if OPAL_HAVE_WEAK_SYMBOLS
  38 #pragma weak MPI_Scan = PMPI_Scan
  39 #endif
  40 #define MPI_Scan PMPI_Scan
  41 #endif
  42 
  43 static const char FUNC_NAME[] = "MPI_Scan";
  44 
  45 
  46 int MPI_Scan(const void *sendbuf, void *recvbuf, int count,
  47              MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
  48 {
  49     int err;
  50 
  51     SPC_RECORD(OMPI_SPC_SCAN, 1);
  52 
  53     MEMCHECKER(
  54         memchecker_datatype(datatype);
  55         memchecker_comm(comm);
  56         if (MPI_IN_PLACE != sendbuf) {
  57             memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
  58         } else {
  59             memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
  60         }
  61     );
  62 
  63     if (MPI_PARAM_CHECK) {
  64         char *msg;
  65         err = MPI_SUCCESS;
  66         OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
  67         if (ompi_comm_invalid(comm)) {
  68             return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
  69                                           FUNC_NAME);
  70         }
  71 
  72         
  73 
  74 
  75         else if (OMPI_COMM_IS_INTER(comm)) {
  76           err = MPI_ERR_COMM;
  77         }
  78 
  79         
  80 
  81         else if (MPI_OP_NULL == op || NULL == op) {
  82           err = MPI_ERR_OP;
  83         } else if (MPI_IN_PLACE == recvbuf) {
  84           err = MPI_ERR_ARG;
  85         } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
  86             int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
  87             free(msg);
  88             return ret;
  89         } else {
  90           OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
  91         }
  92         OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
  93     }
  94 
  95     
  96 
  97 
  98 
  99     if (0 == count) {
 100         return MPI_SUCCESS;
 101     }
 102 
 103     OPAL_CR_ENTER_LIBRARY();
 104 
 105     
 106 
 107     OBJ_RETAIN(op);
 108     err = comm->c_coll->coll_scan(sendbuf, recvbuf, count,
 109                                  datatype, op, comm,
 110                                  comm->c_coll->coll_scan_module);
 111     OBJ_RELEASE(op);
 112     OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
 113 }