Skip to content

Commit ed5167e

Browse files
committed
coll/base: only retain datatypes/op if the request has not yet completed
a non blocking collective might return ompi_request_null, so we should not retain anything in that case. Signed-off-by: Gilles Gouaillardet <[email protected]> (cherry picked from commit 63d3ccd)
1 parent cb3ed47 commit ed5167e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ompi/mca/coll/base/coll_base_util.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ int ompi_coll_base_retain_op( ompi_request_t *req, ompi_op_t *op,
139139
ompi_datatype_t *type) {
140140
ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req;
141141
bool retain = false;
142+
if (REQUEST_COMPLETE(req)) {
143+
return OMPI_SUCCESS;
144+
}
142145
if (!ompi_op_is_intrinsic(op)) {
143146
OBJ_RETAIN(op);
144147
request->data.op.op = op;
@@ -175,6 +178,9 @@ int ompi_coll_base_retain_datatypes( ompi_request_t *req, ompi_datatype_t *stype
175178
ompi_datatype_t *rtype) {
176179
ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req;
177180
bool retain = false;
181+
if (REQUEST_COMPLETE(req)) {
182+
return OMPI_SUCCESS;
183+
}
178184
if (NULL != stype && !ompi_datatype_is_predefined(stype)) {
179185
OBJ_RETAIN(stype);
180186
request->data.types.stype = stype;
@@ -246,6 +252,9 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
246252
bool retain = false;
247253
ompi_communicator_t *comm = request->super.req_mpi_object.comm;
248254
int scount, rcount;
255+
if (REQUEST_COMPLETE(req)) {
256+
return OMPI_SUCCESS;
257+
}
249258
if (OMPI_COMM_IS_TOPO(comm)) {
250259
(void)mca_topo_base_neighbor_count (comm, &rcount, &scount);
251260
} else {

0 commit comments

Comments
 (0)