Add JACC.transfer!#357
Conversation
|
Test this please |
|
@nhz2 the above comment is only to trigger our local GPU runners. :) |
|
Test this please |
|
@nhz2 , I pushed to your branch, but feel free to update as you see fit. I added tests for 2D arrays to test strided views, and I think my updates should handle the relevant use-cases. See the issue here. Using a My addition here is an attempt to work around that. Hope that makes sense. Let me know what you think. |
|
@nhz2 , @williamfgc any further comments before I merge this? |
|
LGTM, thanks a lot to @nhz2 for the contribution. Please feel free to move it out of the "draft" stage. |
| - **`JACC.fill`**: create a new array on the device filled with a specified value. | ||
| - **`JACC.to_device`**: transfer an existing Julia array from host to device. | ||
| - **`JACC.to_host`**: transfer an existing JACC array from device to host. | ||
| - **`JACC.transfer!`**: in-place version of `to_device` or `to_host`. |
There was a problem hiding this comment.
Thanks for adding docs!
|
|
||
| See also [`copyto!`](@ref). | ||
| """ | ||
| function transfer!(dst::AbstractArray{T, N}, src::AbstractArray{ |
There was a problem hiding this comment.
Thanks for adding API docs
This PR adds a new function
transfer!as an in-place version ofto_hostorto_device. Fixes #356Unlike
copy!orcopyto!,transfer!checks that the source and destination arrays have the same axes and element type.The tests currently fail because
copyto!doesn't work with views when using CUDA.jl. I think it is important to be able to handle basic contiguous views of host and device arrays, especially since the function has strict axes checks. But should this be fixed in JACC.jl, CUDA.jl, or somewhere else?Also looking for feedback on the function name. I had originally thought of using
to_host!andto_device!, but it turns out a singletransfer!function can do both.