mehta-lab / waveorder

Wave optical models and inverse algorithms for label-agnostic imaging of density & orientation.
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

Replace custom CuPy implementation of SciPy APIs #88

Open ziw-liu opened 1 year ago

ziw-liu commented 1 year ago

waveorder.util.uniform_filter_2D currently uses a custom set of numerical operations to reimplement scipy.ndimage.uniform_filter on GPU.

This should be replaced by calling the CuPy API directly.

mattersoflight commented 11 months ago

@ziw-liu @talonchandler This code is likely used in PTI reconstruction - we need to filter permittivity tensor components individually for averaging. It looks like all the scalar simulation and reconstruction algorithms are now implemented with pytorch. Let's touch base in person on the status of vector simulation/reconstruction code, and how to get to pytorch implementation.

ziw-liu commented 11 months ago

We would also need to make a plan for GPU support with torch. For now CuPy is still referenced in README on main but it only works for v1.0.0.

talonchandler commented 11 months ago

Thanks @ziw-liu @mattersoflight.

I'm going to keep this issue open, because I still think we should migrate from the custom waveorder.util.uniform_filter_2D to a scipy implementation. @mattersoflight is correct that this function is used by the PTI reconstruction, so this migration can happen alongside the PTI migration to torch, see #142.

I've also opened a new issue for discussion of GPU support #144. For now, the README on main is still accurate since there are still PTI parts of the code that utilize CuPy. I think we can remove CuPy (and update the README) when everything has moved to torch, see #143.