-
Notifications
You must be signed in to change notification settings - Fork 209
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] Method to copy device_buffer
to host
#216
Comments
The biggest impediment to this would be what would this return?
|
Well, the expedient thing would be to add a method like:
It's a kind of halfway-between-C-and-C++ solution that basically is just a wrapper around cudaMemcpy. The user is responsible for allocating and owning |
If it's non-trivial to add in the C++ layer, we can workaround its absence in the Python layer. Just would be nice to have a plan for alignment so they don't get too far apart. |
Look, I'm OK with adding my suggested API (which is trivial) because it is congruent with the constructor that takes a void pointer (as you mentioned in the initial request, @jakirkham ). But I want to give @jrhemstad the opportunity to oppose that approach if he has a strong opinion. |
I have no problem with a free function that looks like: void to_host(rmm::device_buffer const& b, void * host_buffer); It would be a pretty minimal wrapper around |
That would be great. Would it be possible for it to perform error handling as well? |
Yes, it can throw an exception if |
@jakirkham how about submitting a PR? :) |
Happy to. Submitted PR ( #219 ) to start the conversation. Am a bit rusty on my C++, so advice welcome there. In particular could use some help on figuring out where tests should go. |
Is your feature request related to a problem? Please describe.
Currently
device_buffer
is able to construct itself using memory on the host. It would be useful to do the opposite. Namely have a method to copy data back to the host in some buffer.Describe the solution you'd like
A method like
copy_to_host
that returns something (maybestd::string
?) that has a copy of the data from thedevice_buffer
now on the host.Describe alternatives you've considered
Users could probably do this themselves using
device_buffer
directly.Additional context
This would be helpful not only at the C++ level, but also in Python where we would want an analogous feature (maybe
tobytes
?).cc @kkraus14 @shwina
The text was updated successfully, but these errors were encountered: