Skip to content

Commit

Permalink
gpu - clean up small leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylt committed Oct 10, 2024
1 parent 1a930f3 commit 5386b9d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions backends/cuda-ref/ceed-cuda-ref-qfunction.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static int CeedQFunctionDestroy_Cuda(CeedQFunction qf) {
CeedQFunction_Cuda *data;

CeedCallBackend(CeedQFunctionGetData(qf, &data));
CeedCallBackend(CeedFree(&data->qfunction_source));
if (data->module) CeedCallCuda(CeedQFunctionReturnCeed(qf), cuModuleUnload(data->module));
CeedCallBackend(CeedFree(&data));
return CEED_ERROR_SUCCESS;
Expand Down
4 changes: 4 additions & 0 deletions backends/cuda-ref/ceed-cuda-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ static inline int CeedElemRestrictionSetupCompile_Cuda(CeedElemRestriction rstr)
"USE_DETERMINISTIC", is_deterministic ? 1 : 0));
CeedCallBackend(CeedGetKernel_Cuda(ceed, impl->module, "OffsetNoTranspose", &impl->ApplyNoTranspose));
CeedCallBackend(CeedGetKernel_Cuda(ceed, impl->module, "AtPointsTranspose", &impl->ApplyTranspose));
// Cleanup
CeedCallBackend(CeedFree(&offset_kernel_path));
for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i]));
CeedCallBackend(CeedFree(&file_paths));
} break;
case CEED_RESTRICTION_STANDARD: {
CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/cuda/cuda-ref-restriction-offset.h", &restriction_kernel_path));
Expand Down
1 change: 1 addition & 0 deletions backends/hip-ref/ceed-hip-ref-qfunction.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static int CeedQFunctionDestroy_Hip(CeedQFunction qf) {
CeedQFunction_Hip *data;

CeedCallBackend(CeedQFunctionGetData(qf, &data));
CeedCallBackend(CeedFree(&data->qfunction_source));
if (data->module) CeedCallHip(CeedQFunctionReturnCeed(qf), hipModuleUnload(data->module));
CeedCallBackend(CeedFree(&data));
return CEED_ERROR_SUCCESS;
Expand Down
4 changes: 4 additions & 0 deletions backends/hip-ref/ceed-hip-ref-restriction.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ static inline int CeedElemRestrictionSetupCompile_Hip(CeedElemRestriction rstr)
"USE_DETERMINISTIC", is_deterministic ? 1 : 0));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "OffsetNoTranspose", &impl->ApplyNoTranspose));
CeedCallBackend(CeedGetKernel_Hip(ceed, impl->module, "AtPointsTranspose", &impl->ApplyTranspose));
// Cleanup
CeedCallBackend(CeedFree(&offset_kernel_path));
for (CeedInt i = 0; i < num_file_paths; i++) CeedCallBackend(CeedFree(&file_paths[i]));
CeedCallBackend(CeedFree(&file_paths));
} break;
case CEED_RESTRICTION_STANDARD: {
CeedCallBackend(CeedGetJitAbsolutePath(ceed, "ceed/jit-source/hip/hip-ref-restriction-offset.h", &restriction_kernel_path));
Expand Down

0 comments on commit 5386b9d

Please sign in to comment.