JuliaAttic / CUBLAS.jl

Julia interface to CUBLAS
Other
26 stars 19 forks source link

importall BLAS for generic code #1

Open denizyuret opened 9 years ago

denizyuret commented 9 years ago

Hi Nick,

Currently CUBLAS does not export or modify any existing functions, but provides separate CUBLAS versions like CUBLAS.axpy! etc. (If I understand things correctly). If you add the line:

importall Base.LinAlg.BLAS

to the beginning of CUBLAS.jl, (see module usage), then it will be possible for the users to write generic code that works whether the inputs are Arrays or CudaArrays.

best, deniz

lucasb-eyer commented 9 years ago

:+1: what's the status of this?

lucasb-eyer commented 9 years ago

Nevermind, I just saw you did this in 217c8d7, so close this issue?

dpo commented 8 years ago

Does this really work?

julia> using CUDArt
julia> using CUBLAS
julia> x = rand(10); y = rand(10);
julia> d_x = CudaArray(x); d_y = CudaArray(y);
julia> dot(d_x, d_y)
ERROR: MethodError: `dot` has no method matching dot(::CUDArt.CudaArray{Float64,1}, ::CUDArt.CudaArray{Float64,1})
julia> VERSION
v"0.4.1"
denizyuret commented 8 years ago

I think dot is in Base.LinAlg rather than Base.LinAlg.BLAS. We should probably importall that as well. I'll test this.

On Thu, Dec 3, 2015 at 6:18 PM Dominique notifications@github.com wrote:

Does this really work?

julia> using CUDArt julia> using CUBLAS julia> x = rand(10); y = rand(10); julia> d_x = CudaArray(x); d_y = CudaArray(y); julia> dot(d_x, d_y) ERROR: MethodError: dot has no method matching dot(::CUDArt.CudaArray{Float64,1}, ::CUDArt.CudaArray{Float64,1}) julia> VERSIONv"0.4.1"

— Reply to this email directly or view it on GitHub https://github.com/JuliaGPU/CUBLAS.jl/issues/1#issuecomment-161851863.

denizyuret commented 8 years ago

Hmm, it seems a bit more complicated. Base.LinAlg and Base.LinAlg.BLAS each export a different version of dot, so it is not clear which we should extend. I submitted an issue about this: https://github.com/JuliaLang/julia/issues/14268