-
Notifications
You must be signed in to change notification settings - Fork 14
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
Interop with Dask #22
Comments
There is an issue with this: Dask casts to a NumPy array by default in |
I think we need to write a dask.xnd that mirrors dask.array but uses xnd.
Also, we should look at porting NumPyWren to XNDWren
Travis
…On Mon, Oct 29, 2018, 11:57 AM Hameer Abbasi ***@***.***> wrote:
There is an issue with this: Dask casts to a NumPy array by default in
da.from_array
<https://docs.dask.org/en/latest/array-api.html#dask.array.from_array>
unless you pass the asarray=False kwarg. So internally, all calculations
are happening as a NumPy array.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPjoCM-2LCHAthrNupW5qd_PdV9chUMks5upyVYgaJpZM4VKDdp>
.
|
I've implemented I'm not sure if @saulshanabrook's example works now if By "works", I mean that So it is only |
I think I can try the |
Can you try looking at __array_function__ now (your xnd.array should also
implement that).
…-Travis
On Tue, Mar 26, 2019 at 11:08 AM Stefan Krah ***@***.***> wrote:
I think I can try the __array_interface__ though that seems like a lot of
code just for the typestring.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPjoA-cED_S_ggdpZELI8oXmcxQ2ksaks5vakXygaJpZM4VKDdp>
.
--
*Travis Oliphant*
CEO
512 826 7480
<https://www.quansight.com/>
|
Yes, I've added EDIT: deleted the CuPy example, which was wrong. |
cc @pentschev for visibility. He has been doing the Dask+CuPy work and might have suggestions for you all |
Thanks @mrocklin @pentschev for suggestions. For The following results in from xnd import array
import dask.array as da
x = array([1,2,3,4,5], dtype="float32")
d = da.from_array(x, chunks=(5,), asarray=False)
ans = d.sum().compute()
print(ans, type(ans)) This gives from xnd import array
import dask.array as da
x = array([1,2,3,4,5], dtype="float32")
d = da.from_array(x, chunks=(2,), asarray=False)
ans = d.sum().compute()
print(ans, type(ans)) So the question is essentially if conversion to |
Here are hopefully correct examples from the website. For
|
For I don't see any issues with your |
Ah, sorry, you're also gonna need Dask master. Release 1.1.4 doesn't yet include |
The |
@pentschev The issue for
If
One way for unregistered backends would be to try to call |
Ah, right. I think in a post- @mrocklin correct me if I'm wrong, but I think once |
Yes, that's probably correct, at least when the user has a modern version
of NumPy. We maintain support for NumPy going back a few versions, so we
probably won't be able to drop these completely for a little while.
…On Fri, Mar 29, 2019 at 2:08 PM Peter Andreas Entschev < ***@***.***> wrote:
Ah, right. I think in a post-__array_function__ world, calling
numpy.concatenate is the preferred/expected way.
@mrocklin <https://github.com/mrocklin> correct me if I'm wrong, but I
think once __array_function__ is consolidated, we want to get rid of
these lookups, right?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASszJFvkpRUcXjuxstz3LRcVVvU8pFoks5vboDGgaJpZM4VKDdp>
.
|
Can we add a fallback to |
If I understand what you're suggesting @hameerabbasi, I think we had a long discussion about this in numpy/numpy#12974, but no clear solution yet. |
I'm suggesting something different... Where some chunk types have |
Thanks for clarifying @hameerabbasi. That would probably work, I don't know if that's something that Dask would be ok with doing though. @skrah would you mind opening an issue on Dask's GitHub repository, perhaps also add @hameerabbasi's suggestion so we can involve and get suggestions from other Dask developers as well? |
@pentschev Thanks, done in dask/dask#4662. If that approach looks good, I can also open a real PR. |
I am opening this issue to track how xnd/gumath could work with Dask based on talking with @mrocklin.
We can use the
dask.array.from_array
on an xnd object, to have Dask chunk up that array and execute operations in parallel. The requirements dask has for an array like object are listed here.We were going back and forth on whether the numpy-ish API should be implemented on the
xnd
object directly or if we should create a wrapper class, like this, that adds numpy methods.The most basic requirement is to have
shape
anddtype
attributes on the object. We can forward those from thetype
attribute:We could also implement
__array_ufunc__
so that when we callnp.sin
on an xnd array, we could get back an xnd array by using thegumath.sin
function. This is how cupy implements it.We can also create a
concat
and register it withdask.array.core.concatenate_lookup
. I don't think a concat gufunc exists yet.The text was updated successfully, but these errors were encountered: