Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clblas/clblast #50

Open
dpblnt opened this issue Jan 16, 2024 · 0 comments
Open

clblas/clblast #50

dpblnt opened this issue Jan 16, 2024 · 0 comments

Comments

@dpblnt
Copy link

dpblnt commented Jan 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant