This source file includes following definitions.
- MPI_Reduce_local
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 #include "ompi_config.h"
26 #include <stdio.h>
27
28 #include "ompi/mpi/c/bindings.h"
29 #include "ompi/runtime/params.h"
30 #include "ompi/communicator/communicator.h"
31 #include "ompi/errhandler/errhandler.h"
32 #include "ompi/datatype/ompi_datatype.h"
33 #include "ompi/op/op.h"
34 #include "ompi/memchecker.h"
35
36 #if OMPI_BUILD_MPI_PROFILING
37 #if OPAL_HAVE_WEAK_SYMBOLS
38 #pragma weak MPI_Reduce_local = PMPI_Reduce_local
39 #endif
40 #define MPI_Reduce_local PMPI_Reduce_local
41 #endif
42
43 static const char FUNC_NAME[] = "MPI_Reduce_local";
44
45
46 int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count,
47 MPI_Datatype datatype, MPI_Op op)
48 {
49 int err;
50
51 MEMCHECKER(
52 memchecker_datatype(datatype);
53 );
54
55 if (MPI_PARAM_CHECK) {
56 char *msg;
57 err = MPI_SUCCESS;
58 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
59
60 if (MPI_OP_NULL == op || NULL == op) {
61 err = MPI_ERR_OP;
62 } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
63 int ret = OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_OP, msg);
64 free(msg);
65 return ret;
66 } else {
67 OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
68 }
69 OMPI_ERRHANDLER_CHECK(err, MPI_COMM_WORLD, err, FUNC_NAME);
70 }
71
72
73 if (0 == count) {
74 return MPI_SUCCESS;
75 }
76
77 OPAL_CR_ENTER_LIBRARY();
78
79
80 OBJ_RETAIN(op);
81 OBJ_RETAIN(datatype);
82
83
84 ompi_communicator_t *comm = &ompi_mpi_comm_self.comm;
85 err = comm->c_coll->coll_reduce_local(inbuf, inoutbuf, count, datatype, op,
86 comm->c_coll->coll_reduce_local_module);
87 OBJ_RELEASE(datatype);
88 OBJ_RELEASE(op);
89
90 OMPI_ERRHANDLER_RETURN(err, MPI_COMM_WORLD, err, FUNC_NAME);
91 }