robotpy / roborio-wheels

Builds Python wheels of non-RobotPy projects for RoboRIO
0 stars 6 forks source link

Add SciPy #2

Open virtuald opened 3 years ago

virtuald commented 3 years ago

cross-compiling scipy is technically possible, but I don't trust the result yet. Needs testing. Also, numpy + scipy need some cross-compiling adjustments, will have to work on those later.

Inspirol commented 7 months ago

Is this something I can make a PR/work on? My team is interested in using it in the 2024 season. Or would you say trying something else for now would be better?

virtuald commented 7 months ago

You're welcome to work on it and I'm happy to provide some basic support, but it's not a trivial task if you haven't done this sort of thing before.

scipy has also moved to meson-python I believe, and there are some issues with cross-compilation (see https://github.com/robotpy/roborio-wheels/issues/17). However, I believe the numpy project has overcome some of this and is cross-compiling in CI now, so that might be fine? You'd have to look into it.

A final thought is that if your team isn't on a RIO 2, I wouldn't really recommend going down this path. IIRC when I was able to get it to compile for the rio in 2020, it's really big, and takes up a lot of memory. I'm sure it's even bigger now.

Inspirol commented 7 months ago

Ah, I see. I indeed have not done this before, and I also do not have too much time on my hands, so I think I will have to pass on this for now. The only thing we needed it for is the initial value problem for multivariable calc, do you think any other libraries that do this could be ported easier than scipy, like the casADI library?

I think I will still look into this anyway for a little bit. Thanks for the info!

virtuald commented 7 months ago

I'm not a Math person, so I can't provide any useful guidance. I'll ping Tyler, I feel like they did something like that for WPILib already?

calcmogul commented 7 months ago

do you think any other libraries that do this could be ported easier than scipy, like the casADI library?

The only free configuration I'm aware of for CasADi uses Ipopt for the NLP solver and MUMPS for the linear system solver. All three are really annoying to cross-compile to the roboRIO; the folks at @SleipnirGroup have tried and failed to do that. CasADi's autodiff is also really slow, even on desktop.

SciPy can solve IVPs, but if that's not an option, you could try https://github.com/SleipnirGroup/Sleipnir/#python-library; it's a CasADi replacement that's faster and is easier to cross compile. The main C++ library easily cross compiles to the roboRIO, but I haven't tried building roboRIO wheels. Also fair warning that the Python bindings have a concerning open issue: https://github.com/SleipnirGroup/Sleipnir/issues/275.