stochasticHydroTools / libMobility

A collection of tools to compute hydrodynamic displacements.
MIT License
4 stars 0 forks source link

Supporting CPU implementations #20

Open rykerfish opened 4 months ago

rykerfish commented 4 months ago

Brennan and I were hoping to get Sophie set up with libMobility to start investigating a project with fluctuating membranes. To do this, it'd be great to be able to support CPU implementations since the GPU requirement is a bit tough for her group while she's in the development stage.

I know there was some talk about using PyTorch to make this happen and it'd be something I'd be happy to work on. @RaulPPelaez would you be around to set up a meeting with Brennan and I next week to discuss? We're available on 5/29 around 5pm your time, but feel free to shoot us a slack with other times that work for you.

RaulPPelaez commented 4 months ago

Implementing some of these is quite an undertaking. Some are trivial, like NBody, but PSE is tricky and easy to mess up. I believe if there is interest in backpropagation that should be supported, which requires writing the algorithms in pytorch or manually implementing backward operators for every supported platform.

If just forward CPU impl is needed, for now we could try to provide those through other implementations (which I am not sure exist and are open source). For DPStokes Sachins implementation can be recovered.

In any case the first step would be allowing the interface to take in/out arrays in any device (CPU or GPU memory), for that transforming inputs/outputs into pytorch tensors is the way to go, it also makes dtype handling easier.