5 ms·
To be fair to Nim, only Python has the huge ML ecosystem of numpy, scipy, pandas, opencv, pytorch, tensorflow, keres... Doing ML/AI style work in anything but p
by treeform 3y ago
To be fair to Nim, only Python has the huge ML ecosystem of numpy, scipy, pandas, opencv, pytorch, tensorflow, keres... Doing ML/AI style work in anything but python is really hard!
That said Nim does have the nimpy library that allows for pretty seamless interop with python. Which means you can just import PyTorch, or scipy, or opencv and use them in Nim.
- pzo 3y agofor me (mobile developer) interop with python is not enough because of really poor python story on mobile devices (iOS / android) when using native modules. I think if Nim had a seamless interop with Rust or even Zig it could piggyback on those communities to get some libraries for free.
- Xeamek 3y agoDunno about rust, but since both Nim and Zig compile to C as interim, it should be fairly easy to get them working together, no?
- pzo 3y agoThings might changed but last time I checked you could easily call C function but you had to kind of export each single C function, structs etc. You couldn't just import single header file and be ready to call any function in the library. There is some pending project [0] futhark but not sure how mature it is and that still only for C libraries (instead of C++ or Rust) but maybe easy adopt for Zig - would be great nonetheless. [0] https://github.com/PMunch/futhark https://github.com/PMunch/futhark
- ElegantBeef 3y agoFor Rust at least one can use https://github.com/arnetheduck/nbindgen https://github.com/arnetheduck/nbindgen
- pzo 3y agothat looks interesting, thanks! Did you try it if it delivers on promises? There was not any new commit since 2020 so not sure if the project is stale by now.
- ElegantBeef 3y agoI do not use Rust, so sadly I have not.
- cb321 3y agoAs a 2-step approach, you could also probably use https://github.com/mozilla/cbindgen https://github.com/mozilla/cbindgen and then Nim's native C FFI.
- snthpy 3y agoThat looks interesting. Unfortunately it looks like it hasn't been updated in a while? Is that because it's complete or a lack of interest? For example, the approach mentioned at the bottom of the README of integrating via nlvm (https://github.com/arnetheduck/nlvm https://github.com/arnetheduck/nlvm) sounded great but appears to be unpursued.
- elcritch 3y agoMost of those libraries are written in C++ or C, which Nim has excellent support for. I've used opencv c++ library with Nim. It's just that opencv is so massive it'd take a lot of work to wrap well, so I haven't yet. Some folks are working on a pure Nim pandas lib too.
- snthpy 3y agoI found the following article about Nim and Rust interop: https://dev.to/dumblepytech1/the-way-integrate-rust-into-nim-40p3 https://dev.to/dumblepytech1/the-way-integrate-rust-into-nim... Haven't read it yet but it looks promising.