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