py4dstem / py4DSTEM

GNU General Public License v3.0
199 stars 135 forks source link

Device switch from initialization to reconstruct #643

Open erh3cq opened 5 months ago

erh3cq commented 5 months ago

Problem: There are issues with cupy's/numba's JIT compilers. They simply are not robust and there are issues with version matching. When initializing a phase object with device='gpu' a JIT compile error can occur (e.g. in py4DSTEM.process.phase.Parallax(...). If the initialization is done with device='cpu' to avoid the error, then the later reconstruction step (e.g. parallax_recon.reconstruct(...)) also need to be run in device='cpu' as currently implemented.

Solution Allow for device transfer...or figure out a way to handle the cupy shenanigans. @gvarnavi suggested the first one as cupy is ultimately out of our hands.