Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
Nabu
Commits
52007678
Commit
52007678
authored
Jun 10, 2020
by
Pierre Paleo
Browse files
Use _allocate_sinobuilder_output mechanism
parent
2331fe1a
Pipeline
#27059
passed with stages
in 2 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nabu/app/fullfield.py
View file @
52007678
...
...
@@ -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
):
...
...
nabu/app/fullfield_cuda.py
View file @
52007678
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment