CUBLAS.jl icon indicating copy to clipboard operation
CUBLAS.jl copied to clipboard

importall BLAS for generic code

Open denizyuret opened this issue 10 years ago • 5 comments

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

denizyuret avatar Feb 22 '15 10:02 denizyuret

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

lucasb-eyer avatar Oct 24 '15 11:10 lucasb-eyer

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

lucasb-eyer avatar Oct 24 '15 12:10 lucasb-eyer

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"

dpo avatar Dec 04 '15 02:12 dpo

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 [email protected] 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 avatar Dec 04 '15 04:12 denizyuret

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

denizyuret avatar Dec 04 '15 21:12 denizyuret