AdvancedPhotonSource / tike

Repository for ptychography software
http://tike.readthedocs.io
Other
29 stars 15 forks source link

REF: Remove padding and upadding operations from usfft #84

Closed carterbox closed 4 years ago

carterbox commented 4 years ago

Purpose

Reduce the memory footprint of USFFT operations. Closes #66

Approach

Padding and unpadding operations in the usfft were using "wrap" mode that were associated with the scatter gather operations. These padding operations were equivalent to using modular arithmetic to wrap the indices of these operations. By using special indexing instead of padding and unpadding we remove additional memory usage that would grow with the desired accuracy of the transform.

Benchmark with the Laminography adjoint operator test: n=224, ntheta=224, tilt=np.pi/3 where "used memory" is the volume of all arrays allocated during the test and "aquired memory" is the maximum size of the memory pool at any time.

Before: eps used memory acquired memory
1e-2 8.70GB 3.40GB
1e-4 8.78GB 4.95GB
1e-6 8.86GB 5.01GB
After: eps used memory acquired memory
1e-2 7.24GB 2.01GB
1e-4 7.24GB 2.01GB
1e-6 7.24GB 2.01GB
1e-9 7.24GB 2.01GB

It seems that the change in memory footprint due to changing the accuracy of the transform is now negligible.

Pre-Merge Checklists

Submitter

Reviewer

pep8speaks commented 4 years ago

Hello @carterbox! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 139:81: E501 line too long (83 > 80 characters) Line 162:21: E131 continuation line unaligned for hanging indent Line 163:21: E131 continuation line unaligned for hanging indent