clblas/clblast
dpblnt opened this issue · 0 comments
dpblnt commented
I wonder if clblas could be used instead of openblas for ruby-dnn
require "numo/linalg"
Numo::Linalg::Blas.dlopen("/usr/lib64/libclBLAS.so")
p Numo::Linalg::Loader.libs
...
i get
["libopenblas.so.0"]
Epoch 1/20000
/usr/local/lib64/ruby/gems/3.1.0/gems/numo-linalg-0.1.7/lib/numo/linalg/function.rb:26:in `sgemm': unknown symbol "cblas_sgemm" (RuntimeError)
from /usr/local/lib64/ruby/gems/3.1.0/gems/numo-linalg-0.1.7/lib/numo/linalg/function.rb:26:in `call'
from /usr/local/lib64/ruby/gems/3.1.0/gems/numo-linalg-0.1.7/lib/numo/linalg/function.rb:157:in `dot'
from /usr/local/lib64/ruby/gems/3.1.0/gems/numo-narray-0.9.2.1/lib/numo/narray/extra.rb:1105:in `dot'
from /usr/local/lib64/ruby/gems/3.1.0/gems/ruby-dnn-2.0.0/lib/dnn/core/functions/basic.rb:142:in `forward'
...
With clblast
require "numo/linalg"
Numo::Linalg::Blas.dlopen("/usr/lib64/libclblast.so")
p Numo::Linalg::Loader.libs
I get
["libopenblas.so.0"]
Epoch 1/20000
[========================================] 4/4 loss: -0.0000, accuracy: 0.7500
Epoch 2/20000
[========================================] 4/4 loss: -0.0000, accuracy: 0.2500
Epoch 3/20000
[========================================] 4/4 loss: -0.0000, accuracy: 0.2500
Epoch 4/20000
[========================================] 4/4 loss: -0.0000, accuracy: 0.0000
Epoch 5/20000
terminate called after throwing an instance of 'clblast::CLCudaAPIError'
what(): OpenCL error: clCreateContext: -6
Aborted
In this case my GPU 2G memory usage goes from 0 to to about 75% increasingly, then drops to 0 after the error.