Skip to content

Commit

Permalink
TL/SHARP: fix ctx create epilog cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
samnordmann committed Aug 8, 2023
1 parent 4bbde2f commit e952fa1
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/components/tl/sharp/tl_sharp_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,24 +442,22 @@ ucc_status_t ucc_tl_sharp_context_create_epilog(ucc_base_context_t *context)
status = ucc_topo_init(set, core_ctx->topo, &topo);
if (UCC_OK != status) {
tl_error(sharp_ctx->super.super.lib, "failed to init topo");
return status;
goto err_topo_init;
}

status = ucc_tl_sharp_context_init(sharp_ctx, &sharp_ctx->sharp_context,
&sharp_ctx->oob_ctx, topo);
ucc_topo_cleanup(topo);
if (status != UCC_OK) {
ucc_topo_cleanup(topo);
return status;
goto err_sharp_ctx_init;
}

ucc_topo_cleanup(topo);

if (sharp_ctx->cfg.use_rcache) {
status = ucc_tl_sharp_rcache_create(sharp_ctx->sharp_context, &sharp_ctx->rcache);
if (status != UCC_OK) {
tl_error(sharp_ctx->super.super.lib, "failed to create rcache");
sharp_coll_finalize(sharp_ctx->sharp_context);
return UCC_ERR_NO_RESOURCE;
status = UCC_ERR_NO_RESOURCE;
goto err_sharp_ctx_init;
}
}

Expand All @@ -468,10 +466,20 @@ ucc_status_t ucc_tl_sharp_context_create_epilog(ucc_base_context_t *context)
sharp_ctx->sharp_context);
if (status != UCC_OK) {
tl_error(context->lib, "failed to register progress function");
return status;
goto err_sharp_progress_register;
}

return UCC_OK;

err_sharp_progress_register:
if (self->rcache != NULL) {
ucc_rcache_destroy(self->rcache);
}
err_sharp_ctx_init:
sharp_coll_finalize(sharp_ctx->sharp_context);
err_topo_init:
ucc_mpool_cleanup(&sharp_ctx->req_mp, 1);
return status;
}

UCC_CLASS_CLEANUP_FUNC(ucc_tl_sharp_context_t)
Expand Down

0 comments on commit e952fa1

Please sign in to comment.