Merge pull request #20 from microsoft/chhwang/dealloc

Dealloc more resources
This commit is contained in:
Saeed Maleki
2023-03-22 14:48:57 -07:00
committed by GitHub
2 changed files with 27 additions and 0 deletions

View File

@@ -142,6 +142,8 @@ mscclppResult_t mscclppIbContextDestroy(struct mscclppIbContext *ctx)
}
ibv_destroy_cq(ctx->qps[i].cq);
free(ctx->qps[i].wcs);
free(ctx->qps[i].sges);
free(ctx->qps[i].wrs);
}
if (ctx->pd != NULL) {
ibv_dealloc_pd(ctx->pd);

View File

@@ -179,6 +179,31 @@ mscclppResult_t mscclppCommDestroy(mscclppComm_t comm){
if (comm == NULL)
return mscclppSuccess;
for (int i = 0; i < comm->nConns; ++i) {
struct mscclppConn *conn = &comm->conns[i];
if (conn->cpuProxyFlagGdrDesc) {
// IB
MSCCLPPCHECK(mscclppGdrCudaFree(conn->cpuProxyFlagGdrDesc));
} else if (conn->devConn->proxyFlag) {
// P2P
MSCCLPPCHECK(mscclppCudaFree(conn->devConn->proxyFlag));
}
}
for (int i = 0; i < MSCCLPP_PROXY_MAX_NUM; ++i) {
struct mscclppProxyState *proxyState = comm->proxyState[i];
if (proxyState) {
MSCCLPPCHECK(mscclppGdrCudaFree(proxyState->triggerFifo.desc));
MSCCLPPCHECK(mscclppGdrCudaFree(proxyState->fifoHead.desc));
MSCCLPPCHECK(mscclppGdrCudaFree(proxyState->fifoTail.desc));
free(proxyState);
}
}
if (comm->stream != NULL) {
CUDACHECK(cudaStreamDestroy(comm->stream));
}
for (int i = 0; i < MSCCLPP_IB_MAX_DEVS; ++i) {
if (comm->ibContext[i]) {
MSCCLPPCHECK(mscclppIbContextDestroy(comm->ibContext[i]));