CLBLAS.jl
CLBLAS.jl copied to clipboard
Unable to use Dgemm
I'm trying to use GEMM with double-precision floats, but that doesn't seem supported? I tried a straight-forward adaptation of the clblasSgemm_future.jl
and clblasSgemmRandomBufferFuture.jl
examples to use Float64
/cl.cl_double
, but I get the following errors.
$ julia clblasDgemm_future.jl
WARNING: float64(x::AbstractArray) is deprecated, use map(Float64,x) instead.
in depwarn at deprecated.jl:73
in float64 at deprecated.jl:50
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/nstiurca/.julia/v0.4/CLBLAS/examples/clblasDgemm_future.jl, in expression starting on line 9
WARNING: float64(x::AbstractArray) is deprecated, use map(Float64,x) instead.
in depwarn at deprecated.jl:73
in float64 at deprecated.jl:50
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/nstiurca/.julia/v0.4/CLBLAS/examples/clblasDgemm_future.jl, in expression starting on line 10
ERROR: LoadError: MethodError: `clblasDgemm` has no method matching clblasDgemm(::UInt32, ::UInt32, ::Float64, ::Array{Float64,2}, ::Array{Float64,2}, ::Float64, ::Array{Float64,2})
Closest candidates are:
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Array{OpenCL.CmdQueue,1})
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Array{OpenCL.CmdQueue,1}, !Matched::Union{Array{Ptr{Void},1},Void})
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any)
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/nstiurca/.julia/v0.4/CLBLAS/examples/clblasDgemm_future.jl, in expression starting on line 15
and
$ julia clblasDgemmRandomBufferFuture.jl
ERROR: LoadError: MethodError: `clblasDgemm` has no method matching clblasDgemm(::UInt32, ::UInt32, ::Float64, ::OpenCL.Buffer{Float64}, ::OpenCL.Buffer{Float64}, ::Float64, ::OpenCL.Buffer{Float64})
Closest candidates are:
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Array{OpenCL.CmdQueue,1})
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Array{OpenCL.CmdQueue,1}, !Matched::Union{Array{Ptr{Void},1},Void})
clblasDgemm(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any)
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in process_options at ./client.jl:308
in _start at ./client.jl:411
while loading /home/nstiurca/.julia/v0.4/CLBLAS/examples/clblasDgemmRandomBufferFuture.jl, in expression starting on line 26
I am using Linux Mint 17.2 (essentially Ubuntu 14.04), clBLAS v2.6, Julia v0.4, latest CLBLAS.jl master (currently 1555379).
Here is the code I used: https://gist.github.com/nstiurca/6b91103ad31a4d9b5c09
@nstiurca can you try again now that #11 is merged?
It's pretty possible that you will still get an error, because clblasSgemm
uses a type trick, replacing enum
parameter with UInt
, and newer API controls argument types much more strictly.
Note, that I'm currently working on a high-level interface for CLBLAS.jl based on CLArray
s. So if futures aren't essential for your work, you can just wait for a couple of days and get all "GEMM" functions out of the box.
Thank you guys. I haven't gotten my code working yet, but that is largely because I was working on a patch to address the issues with enum
/UInt
and the very strict new API. My approach is that if the C type is a specific thing like size_t
, then the corresponding Julia function should accept any Number
, and do the conversion as necessary when actually invoking ccall
. That would allow passing in 0
instead of UInt(0)
, etc.
By the way, I think enum
s should map to Cint
rather than UInt
, which I think would be the correct signed-ness and bit-size.
And I look forward to the CLArray
implementation.
See PR #13 for my aforementioned patch.