Open
Description
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})
should unsafe_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, also convert(CuArray{T,N,CUDA.HostMemory}, A::Array{T,N})
(over at GPUArrays.jl) and ultimately adapt(CuArray{T,N,CUDA.HostMemory}, A::Array{T,N})
will result in new host memory being allocated. Hence, the only way to actually reuse A
is via unsafe_wrap(CuArray, A)
, but that does only work for A::Array
and not for any of the wrapper types that one could feed into adapt
.