This source file includes following definitions.
- MPI_Iallreduce
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 #include "ompi/runtime/ompi_spc.h"
36
37 #if OMPI_BUILD_MPI_PROFILING
38 #if OPAL_HAVE_WEAK_SYMBOLS
39 #pragma weak MPI_Iallreduce = PMPI_Iallreduce
40 #endif
41 #define MPI_Iallreduce PMPI_Iallreduce
42 #endif
43
44 static const char FUNC_NAME[] = "MPI_Iallreduce";
45
46
47 int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
48 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request)
49 {
50 int err;
51
52 SPC_RECORD(OMPI_SPC_IALLREDUCE, 1);
53
54 MEMCHECKER(
55 memchecker_datatype(datatype);
56 memchecker_comm(comm);
57
58
59 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf, count, datatype);
60
61
62 if (MPI_IN_PLACE == sendbuf) {
63 memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
64 } else {
65 memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
66 }
67 );
68
69 if (MPI_PARAM_CHECK) {
70 char *msg;
71
72
73
74
75 err = MPI_SUCCESS;
76 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
77 if (ompi_comm_invalid(comm)) {
78 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
79 FUNC_NAME);
80 } else if (MPI_OP_NULL == op) {
81 err = MPI_ERR_OP;
82 } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
83 int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
84 free(msg);
85 return ret;
86 } else if ((MPI_IN_PLACE == sendbuf && OMPI_COMM_IS_INTER(comm)) ||
87 MPI_IN_PLACE == recvbuf ) {
88 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_BUFFER,
89 FUNC_NAME);
90 } else if( (sendbuf == recvbuf) &&
91 (MPI_BOTTOM != sendbuf) &&
92 (count > 1) ) {
93 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_BUFFER,
94 FUNC_NAME);
95 } else {
96 OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, count);
97 }
98 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
99 }
100
101
102
103
104
105
106 if (0 == count) {
107 *request = &ompi_request_empty;
108 return MPI_SUCCESS;
109 }
110
111 OPAL_CR_ENTER_LIBRARY();
112
113
114
115 OBJ_RETAIN(op);
116 err = comm->c_coll->coll_iallreduce(sendbuf, recvbuf, count, datatype,
117 op, comm, request, comm->c_coll->coll_iallreduce_module);
118 OBJ_RELEASE(op);
119 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
120 }
121