JuliaGPU / CUDA.jl

CUDA programming in Julia.
https://juliagpu.org/cuda/
Other
1.21k stars 222 forks source link

copyto! ambiguous #2477

Closed jeremypparker closed 2 months ago

jeremypparker commented 2 months ago

I'm getting the following error while trying to copy an array into GPU memory. It's fairly self-explanatory and seems like a bug to me

MethodError: copyto!(::CuArray{Float64, 1, CUDA.DeviceMemory}, ::CartesianIndices{1, Tuple{UnitRange{Int64}}}, ::Vector{Float64}, ::CartesianIndices{1, Tuple{UnitRange{Int64}}}) is ambiguous.

    Candidates:
      copyto!(dst::GPUArraysCore.AbstractGPUArray{T, N}, dstrange::CartesianIndices{N, R} where R<:Tuple{Vararg{OrdinalRange{Int64, Int64}, N}}, src::Array{T, N}, srcrange::CartesianIndices{N, R} where R<:Tuple{Vararg{OrdinalRange{Int64, Int64}, N}}) where {T, N}
        @ GPUArrays ~/.julia/packages/GPUArrays/8Y80U/src/host/abstractarray.jl:272
      copyto!(dest::GPUArraysCore.AnyGPUArray, d_range::CartesianIndices{1, R} where R<:Tuple{OrdinalRange{Int64, Int64}}, src::Array, s_range::CartesianIndices{1, R} where R<:Tuple{OrdinalRange{Int64, Int64}})
        @ GPUArrays ~/.julia/packages/GPUArrays/8Y80U/src/host/abstractarray.jl:159

    Possible fix, define
      copyto!(::GPUArraysCore.AbstractGPUVector{T}, ::CartesianIndices{1, R} where R<:Tuple{OrdinalRange{Int64, Int64}}, ::Vector{T}, ::CartesianIndices{1, R} where R<:Tuple{OrdinalRange{Int64, Int64}}) where T

Edit: obviously I should have raised this on the GPUArrays repository... https://github.com/JuliaGPU/GPUArrays.jl/issues/554

maleadt commented 2 months ago

Closing in favor of https://github.com/JuliaGPU/GPUArrays.jl/issues/554