httomo-backends 0.9.0__py3-none-any.whl → 0.9.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml +2 -2
- httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/phase.py +11 -84
- httomo_backends/methods_database/query.py +10 -0
- httomo_backends/scripts/yaml_templates_generator.py +1 -0
- {httomo_backends-0.9.0.dist-info → httomo_backends-0.9.1.dist-info}/METADATA +1 -1
- {httomo_backends-0.9.0.dist-info → httomo_backends-0.9.1.dist-info}/RECORD +9 -9
- {httomo_backends-0.9.0.dist-info → httomo_backends-0.9.1.dist-info}/WHEEL +0 -0
- {httomo_backends-0.9.0.dist-info → httomo_backends-0.9.1.dist-info}/licenses/LICENSE +0 -0
- {httomo_backends-0.9.0.dist-info → httomo_backends-0.9.1.dist-info}/top_level.txt +0 -0
|
@@ -105,7 +105,7 @@ prep:
|
|
|
105
105
|
padding: False
|
|
106
106
|
memory_gpu:
|
|
107
107
|
multiplier: None
|
|
108
|
-
method:
|
|
108
|
+
method: iterative
|
|
109
109
|
paganin_filter_savu_legacy:
|
|
110
110
|
pattern: projection
|
|
111
111
|
output_dims_change: False
|
|
@@ -114,7 +114,7 @@ prep:
|
|
|
114
114
|
padding: False
|
|
115
115
|
memory_gpu:
|
|
116
116
|
multiplier: None
|
|
117
|
-
method:
|
|
117
|
+
method: iterative
|
|
118
118
|
alignment:
|
|
119
119
|
distortion_correction_proj_discorpy:
|
|
120
120
|
pattern: projection
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/phase.py
CHANGED
|
@@ -23,98 +23,25 @@
|
|
|
23
23
|
from typing import Tuple
|
|
24
24
|
import numpy as np
|
|
25
25
|
|
|
26
|
-
from
|
|
26
|
+
from httomolibgpu.prep.phase import paganin_filter, paganin_filter_savu_legacy
|
|
27
27
|
|
|
28
28
|
__all__ = [
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"_calc_memory_bytes_for_slices_paganin_filter",
|
|
30
|
+
"_calc_memory_bytes_for_slices_paganin_filter_savu_legacy",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
|
|
34
|
+
def _calc_memory_bytes_for_slices_paganin_filter(
|
|
35
|
+
dims_shape: Tuple[int, int, int],
|
|
36
36
|
dtype: np.dtype,
|
|
37
37
|
**kwargs,
|
|
38
|
-
) ->
|
|
39
|
-
return
|
|
38
|
+
) -> int:
|
|
39
|
+
return paganin_filter(dims_shape, calc_peak_gpu_mem=True, **kwargs)
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
def
|
|
43
|
-
|
|
42
|
+
def _calc_memory_bytes_for_slices_paganin_filter_savu_legacy(
|
|
43
|
+
dims_shape: Tuple[int, int, int],
|
|
44
44
|
dtype: np.dtype,
|
|
45
45
|
**kwargs,
|
|
46
|
-
) ->
|
|
47
|
-
|
|
48
|
-
# Input (unpadded)
|
|
49
|
-
unpadded_in_slice_size = np.prod(non_slice_dims_shape) * dtype.itemsize
|
|
50
|
-
|
|
51
|
-
# estimate padding size here based on non_slice dimensions
|
|
52
|
-
pad_tup = []
|
|
53
|
-
for dim_len in non_slice_dims_shape:
|
|
54
|
-
diff = __shift_bit_length(dim_len + 1) - dim_len
|
|
55
|
-
if dim_len % 2 == 0:
|
|
56
|
-
pad_width = diff // 2
|
|
57
|
-
pad_width = (pad_width, pad_width)
|
|
58
|
-
else:
|
|
59
|
-
# need an uneven padding for odd-number lengths
|
|
60
|
-
left_pad = diff // 2
|
|
61
|
-
right_pad = diff - left_pad
|
|
62
|
-
pad_width = (left_pad, right_pad)
|
|
63
|
-
pad_tup.append(pad_width)
|
|
64
|
-
|
|
65
|
-
# Padded input
|
|
66
|
-
padded_in_slice_size = (
|
|
67
|
-
(non_slice_dims_shape[0] + pad_tup[0][0] + pad_tup[0][1])
|
|
68
|
-
* (non_slice_dims_shape[1] + pad_tup[1][0] + pad_tup[1][1])
|
|
69
|
-
* dtype.itemsize
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
# Padded input cast to `complex64`
|
|
73
|
-
complex_slice = padded_in_slice_size / dtype.itemsize * np.complex64().nbytes
|
|
74
|
-
|
|
75
|
-
# Plan size for 2D FFT
|
|
76
|
-
ny = non_slice_dims_shape[0] + pad_tup[0][0] + pad_tup[0][1]
|
|
77
|
-
nx = non_slice_dims_shape[1] + pad_tup[1][0] + pad_tup[1][1]
|
|
78
|
-
fftplan_slice_size = cufft_estimate_2d(
|
|
79
|
-
nx=nx,
|
|
80
|
-
ny=ny,
|
|
81
|
-
fft_type=CufftType.CUFFT_C2C,
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
# Size of "reciprocal grid" generated, based on padded projections shape
|
|
85
|
-
grid_size = np.prod((ny, nx)) * np.float32().nbytes
|
|
86
|
-
filter_size = grid_size
|
|
87
|
-
|
|
88
|
-
# Size of cropped/unpadded + cast to float32 result of 2D IFFT
|
|
89
|
-
cropped_float32_res_slice = np.prod(non_slice_dims_shape) * np.float32().nbytes
|
|
90
|
-
|
|
91
|
-
# Size of negative log of cropped float32 result of 2D IFFT
|
|
92
|
-
negative_log_slice = cropped_float32_res_slice
|
|
93
|
-
|
|
94
|
-
# If the FFT plan size is negligible for some reason, this changes where the peak GPU
|
|
95
|
-
# memory usage occurs. Hence, the if/else branching below for calculating the total bytes.
|
|
96
|
-
NEGLIGIBLE_FFT_PLAN_SIZE = 16
|
|
97
|
-
if fftplan_slice_size < NEGLIGIBLE_FFT_PLAN_SIZE:
|
|
98
|
-
tot_memory_bytes = int(
|
|
99
|
-
unpadded_in_slice_size + padded_in_slice_size + complex_slice
|
|
100
|
-
)
|
|
101
|
-
else:
|
|
102
|
-
tot_memory_bytes = int(
|
|
103
|
-
unpadded_in_slice_size
|
|
104
|
-
+ padded_in_slice_size
|
|
105
|
-
+ complex_slice
|
|
106
|
-
# The padded float32 array is deallocated when a copy is made when casting to complex64
|
|
107
|
-
# and the variable `padded_tomo` is reassigned to the complex64 version
|
|
108
|
-
- padded_in_slice_size
|
|
109
|
-
+ fftplan_slice_size
|
|
110
|
-
+ cropped_float32_res_slice
|
|
111
|
-
+ negative_log_slice
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
subtract_bytes = int(filter_size + grid_size)
|
|
115
|
-
|
|
116
|
-
return (tot_memory_bytes, subtract_bytes)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def __shift_bit_length(x: int) -> int:
|
|
120
|
-
return 1 << (x - 1).bit_length()
|
|
46
|
+
) -> int:
|
|
47
|
+
return paganin_filter_savu_legacy(dims_shape, calc_peak_gpu_mem=True, **kwargs)
|
|
@@ -143,6 +143,16 @@ class MethodsDatabaseQuery:
|
|
|
143
143
|
)
|
|
144
144
|
return memory_bytes
|
|
145
145
|
|
|
146
|
+
def calculate_memory_bytes_for_slices(
|
|
147
|
+
self, dims_shape: Tuple[int, int, int], dtype: np.dtype, **kwargs
|
|
148
|
+
) -> int:
|
|
149
|
+
smodule = self._import_supporting_funcs_module()
|
|
150
|
+
module_mem: Callable = getattr(
|
|
151
|
+
smodule, "_calc_memory_bytes_for_slices_" + self.method_name
|
|
152
|
+
)
|
|
153
|
+
memory_bytes: int = module_mem(dims_shape, dtype, **kwargs)
|
|
154
|
+
return memory_bytes
|
|
155
|
+
|
|
146
156
|
def calculate_output_dims(
|
|
147
157
|
self, non_slice_dims_shape: Tuple[int, int], **kwargs
|
|
148
158
|
) -> Tuple[int, int]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: httomo-backends
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: Supplementary files for HTTomo backends.
|
|
5
5
|
Author: Garry ODonnell, Jacob Williamson
|
|
6
6
|
Author-email: Daniil Kazantsev <daniil.kazantsev@diamond.ac.uk>, Yousef Moazzam <yousef.moazzam@diamond.ac.uk>, Jessica Verschoyle <jessica.verschoyle@diamond.ac.uk>, Naman Gera <naman.gera@diamond.ac.uk>, scientificsoftware@diamond.ac.uk
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
httomo_backends/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
httomo_backends/cufft.py,sha256=mhxI6NeaEdX6-bFEHdQ2RZmf9Iu7LzVQZsJP6OLCjwQ,3283
|
|
3
3
|
httomo_backends/methods_database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
httomo_backends/methods_database/query.py,sha256=
|
|
4
|
+
httomo_backends/methods_database/query.py,sha256=kjWuhkGhs7Sdqm4yUpHutVHxjWTq0abGVi-FEXesFzA,6298
|
|
5
5
|
httomo_backends/methods_database/packages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
httomo_backends/methods_database/packages/httomo.yaml,sha256=tI3D-7IJcdu4EbKwjsje5MVKihOr3oswHzOrxtpBYBQ,535
|
|
7
7
|
httomo_backends/methods_database/packages/backends/httomolib/httomolib.yaml,sha256=JMi2qB1HAYN9yjoS9M_qjcVERIGN6Ok7oVsERfY7syE,1119
|
|
8
8
|
httomo_backends/methods_database/packages/backends/httomolib/httomolib_modules.yaml,sha256=LnjKM2EnAhmC7L_yXi_Mg5hhSWc35sGFhlH1PP1FI-8,140
|
|
9
9
|
httomo_backends/methods_database/packages/backends/httomolibgpu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml,sha256=
|
|
10
|
+
httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu.yaml,sha256=aURnvUvHB7dfrUsUi9QJyHKhAbDnzFaIEbhsnLaDhzo,6061
|
|
11
11
|
httomo_backends/methods_database/packages/backends/httomolibgpu/httomolibgpu_modules.yaml,sha256=i58Fb01apGyJQxc3_xxDtvHuzcQAB7AdXkHPs_0q85E,308
|
|
12
12
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -17,7 +17,7 @@ httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs
|
|
|
17
17
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/misc/rescale.py,sha256=iFE8X-GR9zjuFLbBE_glQL8wMoXOjkzcaleflm8VVzA,574
|
|
18
18
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/normalize.py,sha256=EdUrUZ1TWKUzKAFwoml_A7v6nchrRbAnElUGbA5xwHQ,679
|
|
20
|
-
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/phase.py,sha256=
|
|
20
|
+
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/phase.py,sha256=LCj4iNuZjtrDwvL21ilfWGem4uXm2bUPEk30cZEyuN4,1759
|
|
21
21
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/prep/stripe.py,sha256=KnS8IpcXaLeiIWr4qAKwOrcK1vS9zrU6u5gOITZ159k,4623
|
|
22
22
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/algorithm.py,sha256=76Fl19BNMm2mo1gciAe_08QWSe5xmU5R2cpTFjelha0,21931
|
|
@@ -48,7 +48,7 @@ httomo_backends/pipelines_full/tomopy_gridrec_directive.yaml,sha256=NlrX-mqyzjJv
|
|
|
48
48
|
httomo_backends/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
49
49
|
httomo_backends/scripts/json_pipelines_generator.py,sha256=iWTsYr1i0Ei77Imaml5HXWvZUUeX-tkU1WRIdxskV3M,8322
|
|
50
50
|
httomo_backends/scripts/yaml_pipelines_generator.py,sha256=ZwJSOIgZksrEcQUD4lvvXG6LiWfsDp6qe9ew5AI1xI4,17285
|
|
51
|
-
httomo_backends/scripts/yaml_templates_generator.py,sha256=
|
|
51
|
+
httomo_backends/scripts/yaml_templates_generator.py,sha256=Bb6qOPYRGiSZujMk65A59zCzuLZqSPkbZL3B-ypxX4k,8690
|
|
52
52
|
httomo_backends/scripts/yaml_unsupported_tomopy_remove.py,sha256=R3ZAfFgpVsBWS7zBjLlU83-66nawo7EBegFsIAHBWmQ,3715
|
|
53
53
|
httomo_backends/yaml_templates/httomo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
httomo_backends/yaml_templates/httomo/httomo.data.hdf.loaders/standard_tomo.yaml,sha256=mFGaYZZrE_dft7FE9Ngm-vXsd3dTftgwwjmLUCUkEZM,568
|
|
@@ -148,8 +148,8 @@ httomo_backends/yaml_templates/tomopy/tomopy.sim.project/add_zingers.yaml,sha256
|
|
|
148
148
|
httomo_backends/yaml_templates/tomopy/tomopy.sim.project/project.yaml,sha256=XBVhW5ZxT9C89tHcwDG7OOgcWNdNtQq97mqlBEoiMnU,202
|
|
149
149
|
httomo_backends/yaml_templates/tomopy/tomopy.sim.project/project2.yaml,sha256=5raeQ-w9nS9mbAzn2ZqhPjdcyfLOkkJflKNStdEnYRA,238
|
|
150
150
|
httomo_backends/yaml_templates/tomopy/tomopy.sim.project/project3.yaml,sha256=oyofKSMi-_dSpfjrKVMNDqoBhBCCSYbEVRz2Lsc8uTI,257
|
|
151
|
-
httomo_backends-0.9.
|
|
152
|
-
httomo_backends-0.9.
|
|
153
|
-
httomo_backends-0.9.
|
|
154
|
-
httomo_backends-0.9.
|
|
155
|
-
httomo_backends-0.9.
|
|
151
|
+
httomo_backends-0.9.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
152
|
+
httomo_backends-0.9.1.dist-info/METADATA,sha256=OlXNJspw7aBRdZ3L4yC_-_q4yFhuKpg0we2tjMiQAXo,2272
|
|
153
|
+
httomo_backends-0.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
154
|
+
httomo_backends-0.9.1.dist-info/top_level.txt,sha256=v4x8d4CeEyMwo8QoqIvL_p-WoXAVD1bVnASPIrLjSTg,16
|
|
155
|
+
httomo_backends-0.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|