Commit e1b64c84 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Release cuda memory when possible

parent e51e11bf
Pipeline #26895 passed with stages
in 2 minutes and 45 seconds
......@@ -6,7 +6,7 @@ from ..preproc.sinogram_cuda import CudaSinoProcessing
from ..preproc.sinogram import SinoProcessing
from ..misc.unsharp_cuda import CudaUnsharpMask
from ..reconstruction.fbp import Backprojector
from ..cuda.utils import get_cuda_context, __has_pycuda__, __pycuda_error_msg__, copy_big_gpuarray
from ..cuda.utils import get_cuda_context, __has_pycuda__, __pycuda_error_msg__, copy_big_gpuarray, replace_array_memory
from .fullfield import FullFieldPipeline
if __has_pycuda__:
......@@ -201,6 +201,17 @@ class CudaFullFieldPipelineLimitedMemory(CudaFullFieldPipeline):
pass
def _process_finalize(self):
# release cuda memory
replace_array_memory(self._d_sinos, (1,))
self._d_sinos = None
replace_array_memory(self._d_recs, (1,))
self._d_recs = None
# re-allocate _d_radios for processing a new chunk
self.radios = self._h_radios
self._allocate_radios()
def _process_chunk_ccd(self):
"""
Perform the processing in the "CCD space" (on radios)
......@@ -224,6 +235,9 @@ class CudaFullFieldPipelineLimitedMemory(CudaFullFieldPipeline):
# Copy D2H
self._d_radios[:transfer_size, :, :].get(ary=self._h_radios[start_idx:end_idx])
self.logger.debug("End of processing steps on radios")
# release cuda memory
replace_array_memory(self._d_radios, (1,))
self._d_radios = None
def _process_chunk_sinos(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment