MVP python BLAS example #8
-
|
Hi guys, I'm trying to put together a simple MVP BLAS example for a C-ordered array, according to https://docs.nvidia.com/cuda/nvmath-python/latest/bindings/index.html This example doesn't return result in C and crashes in Can you help me to straighten this out? How can I make C keep the result and run multiple times? Configuration:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
Hello @akochepasov ! Thank you for your interest in nvmath-python. The problem that I see in your code is that cuBLAS expect the matrices to be on the GPU, and passing host-side pointers might result in undefined behaviour. I guess the error you are seeing might be caused by that. Can you please try to convert your CuPy has And to get the pointers to CuPy, you can use One more thing is that you should only destroy cublas handle after synchronizing with the GPU. Currently, you're destroying it right after the operation is scheduled, but you should wait for the GPU to finish. Please let me know if the changes above help with the On our long-term roadmap, we have the introduction a Pythonic API that will cover |
Beta Was this translation helpful? Give feedback.
Hello @akochepasov ! Thank you for your interest in nvmath-python.
The problem that I see in your code is that cuBLAS expect the matrices to be on the GPU, and passing host-side pointers might result in undefined behaviour. I guess the error you are seeing might be caused by that. Can you please try to convert your
AandCnumpy arrays to CuPy arrays and check if this fixes the error?CuPy has
.randomand.zeros, so you just need to changenptocpwhen creating the arrays:And to get the pointers to CuPy, you can use
.data.ptrinstead ofctypes.data: