|
37 | 37 | #include "ompi/runtime/ompi_spc.h" |
38 | 38 |
|
39 | 39 |
|
40 | | -struct ompi_isendrecv_context_t { |
41 | | - opal_object_t super; |
42 | | - int nreqs; |
43 | | - int source; |
44 | | - ompi_request_t *subreq[2]; |
45 | | -}; |
46 | | - |
47 | | -typedef struct ompi_isendrecv_context_t ompi_isendrecv_context_t; |
48 | | -#if OMPI_BUILD_MPI_PROFILING |
49 | | -OBJ_CLASS_INSTANCE(ompi_isendrecv_context_t, opal_object_t, NULL, NULL); |
50 | | -#else |
51 | | -OBJ_CLASS_DECLARATION(ompi_isendrecv_context_t); |
52 | | -#endif /* OMPI_BUILD_MPI_PROFILING */ |
53 | | - |
54 | | -static int ompi_isendrecv_complete_func (ompi_comm_request_t *request) |
55 | | -{ |
56 | | - ompi_isendrecv_context_t *context = |
57 | | - (ompi_isendrecv_context_t *) request->context; |
58 | | - |
59 | | - /* |
60 | | - * Copy the status from the receive side of the sendrecv request? |
61 | | - * But what if the send failed? |
62 | | - * |
63 | | - * Probably need to bring up in the MPI forum. |
64 | | - */ |
65 | | - |
66 | | - if (MPI_PROC_NULL != context->source) { |
67 | | - OMPI_COPY_STATUS(&request->super.req_status, |
68 | | - context->subreq[0]->req_status, false); |
69 | | - } else { |
70 | | - OMPI_COPY_STATUS(&request->super.req_status, |
71 | | - ompi_request_empty.req_status, false); |
72 | | - } |
73 | | - |
74 | | - if(NULL != context->subreq[0]) { |
75 | | - ompi_request_free(&context->subreq[0]); |
76 | | - } |
77 | | - if(NULL != context->subreq[1]) { |
78 | | - ompi_request_free(&context->subreq[1]); |
79 | | - } |
80 | | - |
81 | | - return OMPI_SUCCESS; |
82 | | -} |
83 | | - |
84 | 40 | PROTOTYPE ERROR_CLASS isendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendtype, |
85 | 41 | INT dest, INT sendtag, BUFFER_OUT recvbuf, COUNT recvcount, |
86 | 42 | DATATYPE recvtype, INT source, INT recvtag, |
87 | 43 | COMM comm, REQUEST_INOUT request) |
88 | 44 | { |
89 | | - ompi_isendrecv_context_t *context = NULL; |
90 | | - ompi_comm_request_t *crequest; |
91 | 45 | int rc = MPI_SUCCESS; |
92 | | - int nreqs = 0; |
93 | | - uint32_t flags; |
94 | 46 |
|
95 | 47 | SPC_RECORD(OMPI_SPC_ISENDRECV, 1); |
96 | 48 |
|
@@ -125,64 +77,9 @@ PROTOTYPE ERROR_CLASS isendrecv(BUFFER sendbuf, COUNT sendcount, DATATYPE sendty |
125 | 77 | OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); |
126 | 78 | } |
127 | 79 |
|
128 | | - crequest = ompi_comm_request_get (); |
129 | | - if (NULL == crequest) { |
130 | | - return OMPI_ERR_OUT_OF_RESOURCE; |
131 | | - } |
132 | | - |
133 | | - context = OBJ_NEW(ompi_isendrecv_context_t); |
134 | | - if (NULL == context) { |
135 | | - ompi_comm_request_return (crequest); |
136 | | - return OMPI_ERR_OUT_OF_RESOURCE; |
137 | | - } |
138 | | - |
139 | | - crequest->context = &context->super; |
140 | | - context->subreq[0] = MPI_REQUEST_NULL; |
141 | | - context->subreq[1] = MPI_REQUEST_NULL; |
142 | | - context->source = source; |
143 | | - |
144 | | - if (source != MPI_PROC_NULL) { /* post recv */ |
145 | | - rc = MCA_PML_CALL(irecv(recvbuf, recvcount, recvtype, |
146 | | - source, recvtag, comm, &context->subreq[nreqs++])); |
147 | | - if (MPI_SUCCESS != rc) { |
148 | | - OBJ_RELEASE(context); |
149 | | - ompi_comm_request_return (crequest); |
150 | | - } |
151 | | - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); |
152 | | - } |
153 | | - |
154 | | - if (dest != MPI_PROC_NULL) { /* send */ |
155 | | - rc = MCA_PML_CALL(isend(sendbuf, sendcount, sendtype, dest, |
156 | | - sendtag, MCA_PML_BASE_SEND_STANDARD, comm, &context->subreq[nreqs++])); |
157 | | - if (MPI_SUCCESS != rc) { |
158 | | - OBJ_RELEASE(context); |
159 | | - ompi_comm_request_return (crequest); |
160 | | - } |
161 | | - OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); |
162 | | - } |
163 | | - |
164 | | - /* |
165 | | - * schedule the operation |
166 | | - */ |
167 | | - |
168 | | - context->nreqs = nreqs; |
169 | | - assert(nreqs <= 2); |
170 | | - |
171 | | - flags = OMPI_COMM_REQ_FLAG_RETAIN_SUBREQ; |
172 | | - |
173 | | - rc = ompi_comm_request_schedule_append_w_flags(crequest, ompi_isendrecv_complete_func, |
174 | | - context->subreq, nreqs, flags); |
175 | | - if (MPI_SUCCESS != rc) { |
176 | | - OBJ_RELEASE(context); |
177 | | - ompi_comm_request_return (crequest); |
178 | | - } |
| 80 | + rc = ompi_isendrecv(sendbuf, sendcount, sendtype, dest, sendtag, recvbuf, recvcount, recvtype, source, recvtag, comm, request); |
179 | 81 |
|
180 | 82 | OMPI_ERRHANDLER_CHECK(rc, comm, rc, FUNC_NAME); |
181 | 83 |
|
182 | | - /* kick off the request */ |
183 | | - |
184 | | - ompi_comm_request_start (crequest); |
185 | | - *request = &crequest->super; |
186 | | - |
187 | 84 | return rc; |
188 | 85 | } |
0 commit comments