This source file includes following definitions.
- MPIX_Reduce_scatter_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_scatter_init = PMPIX_Reduce_scatter_init
42 #endif
43 #define MPIX_Reduce_scatter_init PMPIX_Reduce_scatter_init
44 #endif
45
46 static const char FUNC_NAME[] = "MPIX_Reduce_scatter_init";
47
48
49 int MPIX_Reduce_scatter_init(const void *sendbuf, void *recvbuf, const int recvcounts[],
50 MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Info info, MPI_Request *request)
51 {
52 int i, err, size, count;
53
54 SPC_RECORD(OMPI_SPC_REDUCE_SCATTER_INIT, 1);
55
56 MEMCHECKER(
57 int rank;
58 int count;
59
60 size = ompi_comm_size(comm);
61 rank = ompi_comm_rank(comm);
62 for (count = i = 0; i < size; ++i) {
63 if (0 == recvcounts[i]) {
64 count += recvcounts[i];
65 }
66 }
67
68 memchecker_comm(comm);
69 memchecker_datatype(datatype);
70
71
72 memchecker_call(&opal_memchecker_base_isaddressable, recvbuf,
73 recvcounts[rank], datatype);
74
75
76 if(MPI_IN_PLACE == sendbuf) {
77 memchecker_call(&opal_memchecker_base_isdefined, recvbuf, count, datatype);
78 } else {
79 memchecker_call(&opal_memchecker_base_isdefined, sendbuf, count, datatype);
80
81 }
82 );
83
84 if (MPI_PARAM_CHECK) {
85 char *msg;
86 err = MPI_SUCCESS;
87 OMPI_ERR_INIT_FINALIZE(FUNC_NAME);
88 if (ompi_comm_invalid(comm)) {
89 return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM,
90 FUNC_NAME);
91 }
92
93
94
95
96 else if (MPI_OP_NULL == op || NULL == op) {
97 err = MPI_ERR_OP;
98 } else if (!ompi_op_is_valid(op, datatype, &msg, FUNC_NAME)) {
99 int ret = OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_OP, msg);
100 free(msg);
101 return ret;
102 } else if (NULL == recvcounts) {
103 err = MPI_ERR_COUNT;
104 } else if (MPI_IN_PLACE == recvbuf) {
105 err = MPI_ERR_ARG;
106 }
107 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
108
109
110
111
112 size = ompi_comm_size(comm);
113 for (i = 0; i < size; ++i) {
114 OMPI_CHECK_DATATYPE_FOR_SEND(err, datatype, recvcounts[i]);
115 OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME);
116 }
117 }
118
119
120
121
122
123 size = ompi_comm_size(comm);
124 for (count = i = 0; i < size; ++i) {
125 if (0 == recvcounts[i]) {
126 ++count;
127 }
128 }
129 if (size == count) {
130 err = ompi_request_persistent_noop_create(request);
131 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
132 }
133
134 OPAL_CR_ENTER_LIBRARY();
135
136
137
138 OBJ_RETAIN(op);
139 err = comm->c_coll->coll_reduce_scatter_init(sendbuf, recvbuf, recvcounts,
140 datatype, op, comm, info, request,
141 comm->c_coll->coll_reduce_scatter_init_module);
142 OBJ_RELEASE(op);
143 OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME);
144 }