From 7a76f08755199f0c419e3ab3d5b4ef45f01c9b91 Mon Sep 17 00:00:00 2001 From: Lucas Gandel Date: Fri, 6 Sep 2024 13:51:01 +0200 Subject: [PATCH] ENH: Expose flag to release GPU memory when dirty --- include/itkCudaDataManager.h | 5 +++++ src/itkCudaDataManager.cxx | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/include/itkCudaDataManager.h b/include/itkCudaDataManager.h index 2a666e2..ddef2c8 100644 --- a/include/itkCudaDataManager.h +++ b/include/itkCudaDataManager.h @@ -162,6 +162,11 @@ class CudaCommon_EXPORT CudaDataManager : public Object void SetGPUDirtyFlag(bool isDirty); + /** Controls whether GPU memory should be released when dirty. On by default. + * When turning it off, one must call Free() to release the GPU memory. */ + void + SetReleaseDirtyGPUBufferFlag(bool release); + /** Make GPU up-to-date and mark CPU as dirty. * Call this function when you want to modify CPU data */ void diff --git a/src/itkCudaDataManager.cxx b/src/itkCudaDataManager.cxx index 31c8ba8..9b7bf65 100644 --- a/src/itkCudaDataManager.cxx +++ b/src/itkCudaDataManager.cxx @@ -124,6 +124,12 @@ CudaDataManager::SetGPUDirtyFlag(bool isDirty) this->Free(); } +void +CudaDataManager::SetReleaseDirtyGPUBufferFlag(bool release) +{ + m_ReleaseDirtyGPUBuffer = release; +} + void CudaDataManager::SetGPUBufferDirty() {