-
Notifications
You must be signed in to change notification settings - Fork 29
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
Remove "cpu" device #86
Comments
we aren't using it in SciPy at least - we now just use the test infra from the libraries we are testing with to remain on the same device. |
+1 for slow deprecation in favor of the more explicit cross-device / namespace API provided by |
I have a deprecation for using "cpu" in |
Agreed, it seems too early to merge that. |
BTW, is there an issue/PR to track implementation of the dlpack itself has been released (in RC) with an updated spec that says:
but then >>> import array_api_compat.torch as xp_torch
>>> import array_api_compat.numpy as xp_np
>>> xp_np.from_dlpack(xp_torch.ones(3, device="mps"))
Traceback (most recent call last):
Cell In[40], line 1
xp_np.from_dlpack(xp_torch.ones(3, device="mps"))
File ~/miniforge3/envs/dev/lib/python3.11/site-packages/torch/_tensor.py:1450 in __dlpack__
return torch.to_dlpack(self)
RuntimeError: Cannot pack tensors on mps:0 Similarly with >>> import array_api_strict as xp_strict
>>> xp_strict.from_dlpack(xp_torch.ones(3, device="mps"))
Traceback (most recent call last):
Cell In[42], line 1
xp_strict.from_dlpack(xp_torch.ones(3, device="mps"))
File ~/miniforge3/envs/dev/lib/python3.11/site-packages/array_api_strict/_creation_functions.py:185 in from_dlpack
return Array._new(np.from_dlpack(x))
File ~/miniforge3/envs/dev/lib/python3.11/site-packages/torch/_tensor.py:1450 in __dlpack__
return torch.to_dlpack(self)
RuntimeError: Cannot pack tensors on mps:0 I think the "cpu" device should not be deprecated while it's not possible to use |
I'm definitely not going to deprecate "cpu" until this gets implemented upstream. Is it possible to implement wrapping support for this in this library? My understanding was that we would need to just wait for upstream support. Keep in mind that array-api-compat should consist of pure Python wrappers only. By the way, the "cpu" device that is being deprecated here only refers to using CuPy with the |
Indeed there is nothing to do in For |
There was some discussion at the meeting Thursday that there were some things that could be done here, but I don't know if I completely followed it. I will need to rewatch the recording. There was a reference to data-apis/array-api#741 (comment). |
Maybe we can revisit if this can be done now, or at least deprecated. |
Right now we have and support "cpu" as a device for all supported libraries in the to_device() helper. In particular, we allow
to_device(cupy_array, "cpu")
to convert a CuPy array to a NumPy array.This was implemented as a way to portably move an array to the host device, as per data-apis/array-api#626. However, it looks like that issue is going to be resolved in a different way, by adding a
device
keyword tofrom_dlpack
data-apis/array-api#741.So I propose we remove this behavior, as it extends things in a way that isn't specified by the standard. Since I'm not sure who is using this, we may want to issue a deprecation warning first.
CC @tylerjereddy @leofang
The text was updated successfully, but these errors were encountered: