@@ -170,7 +170,7 @@ def _calc_memory_bytes_LPRec(
170170 out_slice_size = np .prod (output_dims ) * dtype .itemsize
171171
172172 # interpolation kernels
173- # grid_size = np.prod(DetectorsLengthH * DetectorsLengthH) * np.float32().nbytes
173+ # grid_size = np.prod(DetectorsLengthH * DetectorsLengthH) * np.float32().itemsize
174174 # phi = grid_size
175175
176176 eps = 1e-4 # accuracy of usfft
@@ -191,34 +191,32 @@ def _calc_memory_bytes_LPRec(
191191 oversampling_level = 2
192192 tmp_oversample_size = (
193193 np .prod (angles_tot * oversampling_level * DetectorsLengthH )
194- * np .float32 ().nbytes
194+ * np .float32 ().itemsize
195195 )
196196 data_c_size = np .prod (0.5 * angles_tot * DetectorsLengthH ) * np .complex64 ().itemsize
197197
198198 # Oersampling freed during the calculation
199- max_memory_sampling = tmp_oversample_size + data_c_size
199+ max_memory_sampling = 2 * tmp_oversample_size + data_c_size
200200
201201 fde_size = (
202202 0.5 * (2 * m + 2 * DetectorsLengthH ) * (2 * m + 2 * DetectorsLengthH )
203203 ) * np .complex64 ().itemsize
204204
205205 c1dfftshift_size = (
206- DetectorsLengthH * np .int8 ().nbytes
206+ DetectorsLengthH * np .int8 ().itemsize
207207 )
208208
209209 c2dfftshift_slice_size = (
210- np .prod (4 * DetectorsLengthH * DetectorsLengthH ) * np .int8 ().nbytes
210+ np .prod (4 * DetectorsLengthH * DetectorsLengthH ) * np .int8 ().itemsize
211211 )
212212
213+ theta_size = angles_tot * np .float32 ().itemsize
213214 filter_size = (DetectorsLengthH // 2 + 1 ) * np .float32 ().itemsize
214215 freq_slice = angles_tot * (DetectorsLengthH + 1 ) * np .complex64 ().itemsize
215216 fftplan_size = freq_slice * 2
216217
217- max_memory_per_slice = max (max_memory_sampling + fde_size , 2 * fde_size )
218+ max_memory_per_slice = max (max_memory_sampling + 2 * fde_size , 3 * fde_size )
218219
219- # Add treshold
220- max_memory_per_slice *= 1.2
221-
222220 tot_memory_bytes = int (
223221 in_slice_size
224222 + out_slice_size
@@ -227,14 +225,15 @@ def _calc_memory_bytes_LPRec(
227225
228226 fixed_amount = int (
229227 fde_size
228+ + theta_size
230229 + fftplan_size
231230 + filter_size
232231 + c1dfftshift_size
233232 + c2dfftshift_slice_size
234233 + freq_slice
235234 )
236235
237- return (tot_memory_bytes , fixed_amount )
236+ return (1.4 * tot_memory_bytes , fixed_amount )
238237
239238
240239
0 commit comments