-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array Ecosystem Interoperability #113
Comments
Regarding the conversion to numpy you can have a look at pyo3-numpy which provides functionality for interfacing python-numpy with rust-ndarray. |
We are already doing some numpy interop here: https://github.com/ilan-gold/zarrs-python. This package slots nicely into the Python ecosystem - users can continue to use
@ilan-gold did look into using DLPack with
@pbower , how would you envision using DLPack, would you want to stay entirely in Python land? I am hesitant to expose more of |
Hi just to chime in, despite the theoretical niceties of DLPack, in practice it's probably easier to just use existing APIs i.e., return a numpy array from rust to python and then just use numpy's dlpack functionality. I'm not sure I see the added benefit of doing it in rust. I am considering even closing that issue in zarr-python because I tried implementing it, and having a defined API instead of just a DLPack struct is actually quite helpful (outweighing the benefit of dlpack under the hood in zarr-python) but I'll need to look back over it to be sure. |
Hey @LDeakin and @ilan-gold , Thanks for the prompt and thorough response. It’s much appreciated. also @niklasmueboe , thanks for the helpful link. Firstly, regarding this ‘ Alternatively, it would probably be straightforward to add DLPack support to zarrs on the Rust side and leave Python interop to the zarrs consumer.’. Yes, this would be the most helpful. To share some context, this is to support application use cases where the main data objects are stored in rust, but call outs are made to python to help leverage that ecosystem (with various concurrency optimisations). There are a few reasons that I view this as useful:
Appreciating these requirements may be viewed as niche, I’d therefore find it valuable to have DLpack pluggability on the rust side of this framework. Then there’s ‘chunk-based n-dimensional arrays’ available in the global array interchange format in what’s arguably the fastest/modern programming language, easily then pluggable with python / user facing ecosystem. A comparable application back-end is https://tiledb.com/ , which seems aligned with the ice chunking approach in this framework. Acknowledging though, it’s work on your side so if it’s not achievable at this time there’s no issues! Thanks for considering it. Regards, |
@pbower Some more questions:
Does this mean you are calling out to python from inside rust on the objects in rust? I assume (although that's the extent of my knowledge) that using
I am actually curious about this. Do you have any experience with performance hits? We had dlpack for a bit and crudely speaking, we didn't see any performance hit from switching away from dlpack to using Lastly, the dlpack-rust support is a bit minimal ATM. I tried out https://github.com/SunDoge/dlpark but it took me a non-trivial amount of time to get it working. I'm happy to share my experience. |
Hey,
Awesome library Lachlan. Great to see another aussie getting into it.
Hey, I've got a quick around planned interoperability betwen Zarr Rs and other array frameworks, essentially for hooking them into the wider ecosystem.
Wondering if you have any plans for compatibility with the DL Pack protocol, or otherwise conversion to Numpy, this type of thing ?
Otherwise, is the memory layout pretty much the same and if pushed through to Python (e.g. via FFI, or PY03) will it essentially translate ?
Asking as the lazy loading chunked storage thing is really powerful, but so are the functions with that ecosystem. So, finding the line between the best of both worlds.
Thanks heaps,
Pete
The text was updated successfully, but these errors were encountered: