-
Notifications
You must be signed in to change notification settings - Fork 908
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
Construct pylibcudf
columns from objects supporting __cuda_array_interface__
#15615
Construct pylibcudf
columns from objects supporting __cuda_array_interface__
#15615
Conversation
data = gpumemoryview(obj) | ||
iface = data.__cuda_array_interface__() | ||
data_type = _data_type_from_iface(iface) | ||
size = iface['shape'][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Someone needs to check that the object being described is one-dimensional and contiguous. So we should probably:
size = iface['shape'][0] | |
(size,) = iface['shape'] |
And also assert that strides are appropriate (either None
or (1,)
I think?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We implemented something similar for buffer here, but it's in the cuDF python namespace. Would it be overkill to move the impl to a cython utility we can consume from both places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because we need to check here too, otherwise we're potentially producing a nonsense result.
Co-authored-by: Lawrence Mitchell <[email protected]>
Some failing tests locally seem to be because our datetime column supports |
Not sure if it's intended but appears like an oversight. The interface for numeric and datetime columns are exactly the same, so I suppose timedelta should have support since it's a supported type code |
…15622) Column types that support CAI already have custom `NotImplementedError`s, and since the implementation is the same for datetime and numeric columns, moving their implementation to `ColumnBase` Should help address timedelta support in #15615 cc @brandon-b-miller Authors: - Matthew Roeschke (https://github.com/mroeschke) Approvers: - GALI PREM SAGAR (https://github.com/galipremsagar) URL: #15622
Timedelta columns should work now with #15622 in |
Thanks @mroeschke tests pass locally for me now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @brandon-b-miller!
/merge |
This PR allows zero copy construction of
pylibcudf
columns from device arrays via thegpumemoryview
class. cc @mroeschke