JuliaGPU / CLArrays.jl

OpenCL-backed GPU Arrays
Other
62 stars 12 forks source link

CLArray{Float32,2}(10,10) throws ambiguity error #27

Open dlfivefifty opened 6 years ago

dlfivefifty commented 6 years ago
julia> CLArray{Float32,2}(10,10)
ERROR: MethodError: CLArrays.CLArray{Float32,2}(::Int64, ::Int64) is ambiguous. Candidates:
  (::Type{CLArrays.CLArray{T,N}})(size, ptr) where {T, N} in CLArrays at /Users/solver/.julia/v0.6/CLArrays/src/array.jl:12
  (T::Type{#s9} where #s9<:GPUArrays.GPUArray)(dims::Integer...) in GPUArrays at /Users/solver/.julia/v0.6/GPUArrays/src/construction.jl:37
Possible fix, define
  (::Type{CLArrays.CLArray{T,N}})(::Integer, ::Integer)
davidbp commented 6 years ago

What are you trying to do?

The following works fine

CLArray{Float32,2}(rand(5,4))

As well as

CLArray{Float32,2}((10,10))

I agree though, for "consitency" if both of the following ways generate a new array

Array{Float32,2}((10,10))
Array{Float32,2}(10,10)

We would expect the same to happen with a CLArray

dlfivefifty commented 6 years ago

The above should be a synonym for those (as is the case for Matrix )