Implement convert
between Array and CuArray like unsafe_wrap
#2434
Labels
cuda array
Stuff about CuArray.
enhancement
New feature or request
speculative
Not sure about this one yet.
I am not sure if this qualifies as a bug or a feature request, but I was wondering whether the constructor
CuArray{T,N,CUDA.HostMemory}(A::Array{T,N})
shouldunsafe_wrap(CuArray, A)
?The current general implementation at https://github.com/JuliaGPU/CUDA.jl/blob/master/src/array.jl#L404 will allocate new host memory and then copy the contents of
A
into this. Because of this, alsoconvert(CuArray{T,N,CUDA.HostMemory}, A::Array{T,N})
(over at GPUArrays.jl) and ultimatelyadapt(CuArray{T,N,CUDA.HostMemory}, A::Array{T,N})
will result in new host memory being allocated. Hence, the only way to actually reuseA
is viaunsafe_wrap(CuArray, A)
, but that does only work forA::Array
and not for any of the wrapper types that one could feed intoadapt
.The text was updated successfully, but these errors were encountered: