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

Use _allocate_sinobuilder_output mechanism

parent 2331fe1a
Pipeline #27059 passed with stages
in 2 minutes and 22 seconds
......@@ -264,9 +264,12 @@ class FullFieldPipeline:
self.sinos = None
else:
self._sinobuilder_copy = True
self.sinos = self._allocate_array(self.sino_builder.output_shape, "f", name="sinos")
self.sinos = self._allocate_sinobuilder_output()
self._sinobuilder_output = self.sinos
def _allocate_sinobuilder_output(self):
return self._allocate_array(self.sino_builder.output_shape, "f", name="sinos")
@use_options("reconstruction", "reconstruction")
def _prepare_reconstruction(self):
......
......@@ -205,6 +205,13 @@ class CudaFullFieldPipelineLimitedMemory(CudaFullFieldPipeline):
self.radios = self._d_radios # (radios_group_size, delta_z, width) (fits in GPU mem)
def _allocate_sinobuilder_output(self):
self._allocate_array(self.sino_builder.output_shape, "f", name="sinos")
self._h_sinos = np.zeros(self._d_sinos.shape, "f")
self._sinobuilder_output = self._h_sinos # patch self.sino_builder
return self._h_sinos
def _register_callbacks(self):
# No callbacks are registered for this subclass
pass
......@@ -338,10 +345,12 @@ class CudaFullFieldPipelineLimitedMemory(CudaFullFieldPipeline):
# Copy H2D
# pycuda does not support copy where "order" is not the same
# (self.sinos might be a view on self.radios)
if not self.sinos.flags["C_CONTIGUOUS"]:
self.sinos = np.ascontiguousarray(self.sinos)
if not(self._sinobuilder_copy) and self.sinos.flags["C_CONTIGUOUS"]:
sinos = np.ascontiguousarray(self.sinos)
else:
sinos = self._h_sinos
#
self._d_sinos[:, :, :] = self.sinos[:, :, :]
self._d_sinos[:, :, :] = sinos[:, :, :]
# Process stack of sinograms (chunk_size, n_angles, width)
self._reconstruct(sinos=self._d_sinos)
# Copy D2H
......
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