Skip to content

Commit 63d3ccd

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]>
1 parent 0862c40 commit 63d3ccd

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
@@ -141,6 +141,9 @@ int ompi_coll_base_retain_op( ompi_request_t *req, ompi_op_t *op,
141141
ompi_datatype_t *type) {
142142
ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req;
143143
bool retain = false;
144+
if (REQUEST_COMPLETE(req)) {
145+
return OMPI_SUCCESS;
146+
}
144147
if (!ompi_op_is_intrinsic(op)) {
145148
OBJ_RETAIN(op);
146149
request->data.op.op = op;
@@ -177,6 +180,9 @@ int ompi_coll_base_retain_datatypes( ompi_request_t *req, ompi_datatype_t *stype
177180
ompi_datatype_t *rtype) {
178181
ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req;
179182
bool retain = false;
183+
if (REQUEST_COMPLETE(req)) {
184+
return OMPI_SUCCESS;
185+
}
180186
if (NULL != stype && !ompi_datatype_is_predefined(stype)) {
181187
OBJ_RETAIN(stype);
182188
request->data.types.stype = stype;
@@ -254,6 +260,9 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
254260
bool retain = false;
255261
ompi_communicator_t *comm = request->super.req_mpi_object.comm;
256262
int scount, rcount;
263+
if (REQUEST_COMPLETE(req)) {
264+
return OMPI_SUCCESS;
265+
}
257266
if (OMPI_COMM_IS_TOPO(comm)) {
258267
(void)mca_topo_base_neighbor_count (comm, &rcount, &scount);
259268
} else {

0 commit comments

Comments
 (0)