1
1
/*
2
2
* Copyright (C) Mellanox Technologies Ltd. 2001-2015. ALL RIGHTS RESERVED.
3
- * Copyright (c) 2016 The University of Tennessee and The University
3
+ * Copyright (c) 2016-2021 The University of Tennessee and The University
4
4
* of Tennessee Research Foundation. All rights
5
5
* reserved.
6
6
* $COPYRIGHT$
@@ -149,6 +149,12 @@ static inline void mca_pml_ucx_request_reset(ompi_request_t *req)
149
149
req -> req_complete = REQUEST_PENDING ;
150
150
}
151
151
152
+ /* Use when setting a request's status field.
153
+ * Note that a new function 'mca_mpl_ucx_set_send_status_public' shall
154
+ * be created and used instead if updating a publicly visible status becomes
155
+ * necessary (i.e., the status argument in an user-visible procedure), see the
156
+ * recv_status case below for rationale.
157
+ */
152
158
__opal_attribute_always_inline__
153
159
static inline void mca_pml_ucx_set_send_status (ompi_status_public_t * mpi_status ,
154
160
ucs_status_t status )
@@ -163,6 +169,11 @@ static inline void mca_pml_ucx_set_send_status(ompi_status_public_t* mpi_status,
163
169
}
164
170
}
165
171
172
+ /* Use when setting a request's status field.
173
+ * Note that the next function 'mca_mpl_ucx_set_recv_status_public' shall
174
+ * be used instead when updating a publicly visible status (i.e., the
175
+ * status argument in an user-visible procedure).
176
+ */
166
177
static inline int mca_pml_ucx_set_recv_status (ompi_status_public_t * mpi_status ,
167
178
ucs_status_t ucp_status ,
168
179
const ucp_tag_recv_info_t * info )
@@ -178,6 +189,10 @@ static inline int mca_pml_ucx_set_recv_status(ompi_status_public_t* mpi_status,
178
189
mpi_status -> _ucount = info -> length ;
179
190
} else if (ucp_status == UCS_ERR_MESSAGE_TRUNCATED ) {
180
191
mpi_status -> MPI_ERROR = MPI_ERR_TRUNCATE ;
192
+ mpi_status -> MPI_SOURCE = PML_UCX_TAG_GET_SOURCE (tag );
193
+ mpi_status -> MPI_TAG = PML_UCX_TAG_GET_MPI_TAG (tag );
194
+ mpi_status -> _cancelled = false;
195
+ mpi_status -> _ucount = info -> length ;
181
196
} else if (ucp_status == UCS_ERR_CANCELED ) {
182
197
mpi_status -> MPI_ERROR = MPI_SUCCESS ;
183
198
mpi_status -> _cancelled = true;
@@ -188,16 +203,41 @@ static inline int mca_pml_ucx_set_recv_status(ompi_status_public_t* mpi_status,
188
203
return mpi_status -> MPI_ERROR ;
189
204
}
190
205
191
- static inline int mca_pml_ucx_set_recv_status_safe (ompi_status_public_t * mpi_status ,
206
+ /* Use when setting a publicly visible status (i.e., the status argument in an
207
+ * user-visible procedure).
208
+ * Except in procedures that return MPI_ERR_IN_STATUS, the MPI_ERROR
209
+ * field of a status object shall never be modified
210
+ * See MPI-1.1 doc, sec 3.2.5, p.22
211
+ */
212
+ static inline int mca_pml_ucx_set_recv_status_public (ompi_status_public_t * mpi_status ,
192
213
ucs_status_t ucp_status ,
193
214
const ucp_tag_recv_info_t * info )
194
215
{
195
216
if (mpi_status != MPI_STATUS_IGNORE ) {
196
- return mca_pml_ucx_set_recv_status (mpi_status , ucp_status , info );
197
- } else if (OPAL_LIKELY (ucp_status == UCS_OK ) || (ucp_status == UCS_ERR_CANCELED )) {
198
- return UCS_OK ;
217
+ if (OPAL_LIKELY (ucp_status == UCS_OK )) {
218
+ uint64_t tag = info -> sender_tag ;
219
+ mpi_status -> MPI_SOURCE = PML_UCX_TAG_GET_SOURCE (tag );
220
+ mpi_status -> MPI_TAG = PML_UCX_TAG_GET_MPI_TAG (tag );
221
+ mpi_status -> _cancelled = false;
222
+ mpi_status -> _ucount = info -> length ;
223
+ return MPI_SUCCESS ;
224
+ } else if (ucp_status == UCS_ERR_MESSAGE_TRUNCATED ) {
225
+ uint64_t tag = info -> sender_tag ;
226
+ mpi_status -> MPI_SOURCE = PML_UCX_TAG_GET_SOURCE (tag );
227
+ mpi_status -> MPI_TAG = PML_UCX_TAG_GET_MPI_TAG (tag );
228
+ mpi_status -> _cancelled = false;
229
+ mpi_status -> _ucount = info -> length ;
230
+ return MPI_ERR_TRUNCATE ;
231
+ } else if (ucp_status == UCS_ERR_CANCELED ) {
232
+ mpi_status -> _cancelled = true;
233
+ return MPI_SUCCESS ;
234
+ } else {
235
+ return MPI_ERR_INTERN ;
236
+ }
199
237
} else if (ucp_status == UCS_ERR_MESSAGE_TRUNCATED ) {
200
238
return MPI_ERR_TRUNCATE ;
239
+ } else if (OPAL_LIKELY (ucp_status == UCS_OK ) || (ucp_status == UCS_ERR_CANCELED )) {
240
+ return MPI_SUCCESS ;
201
241
}
202
242
203
243
return MPI_ERR_INTERN ;
0 commit comments