-
Notifications
You must be signed in to change notification settings - Fork 939
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
[FEA] Accelerate cupy array creation from DataFrame.values #16483
Comments
Yes, this is probably the right way. We ought to do host-side type-dispatch to determine which kernel to call, and device-side type-dispatch to handle casting the various input column types. |
We might be able to shortcut this and just accelerate the "easy" path where all types are the same, to start out. |
xref #11648 |
Also xref #12928 - I don't think this is a duplicate issue, since that one focuses on transpose-related issues and this one offers concrete proposals for implementation. I think this might solve the same problem, but it may depend on the implementation choices. |
Sharing some notes from a related offline discussion:
|
Is your feature request related to a problem? Please describe.
Users with large numerical datasets (such as a dataframe with thousands of time-series columns) would like to be able to convert from a cuDF dataframe to a cupy array as quickly as possible. Currently we have a raw loop in Python that does casting and assignment for each column.
cudf/python/cudf/cudf/core/frame.py
Lines 458 to 463 in a8a3670
It should be possible to lower this into libcudf, and use a kernel that calls a batched memcpy from CCCL CUB to copy the same-type input columns into the matrix directly. Some columns may require casting, and that work could be launched in separate streams.
Describe the solution you'd like
Describe alternatives you've considered
We might be able to use(I was wrong, this is not what I want.) I think the best performing solution would do casting of any compatible input type to the target type as it copies.cudf::contiguous_copy_column_device_views
, but that requires all the types to be the same.We could also make the API take a
void *
and acudf::data_type output_dtype
? I'm not sure. I think it is important for this to have an output parameter and let the data be allocated by cupy withmatrix = cupy.empty(shape=(len(self), ncol), dtype=dtype, order="F")
like we already do here.The text was updated successfully, but these errors were encountered: