-
Notifications
You must be signed in to change notification settings - Fork 178
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
Confused Using scikits.cuda.cula #20
Comments
You can pass a_gpu.gpudata to the wrapper function; it gets cast to an integer that corresponds to the pointer value. |
still not working :
|
Can you please post the code that you are trying to run? The snippet in your initial posting is incomplete. |
This is what I'm trying to do: import pycuda.gpuarray as gpuarray Can you run that on your system? I'm using cula 12 full version. cula.culaInitialize() a=np.array([[1,2,3,4],[6,7,8,9],[7,2,3,5],[2,4,5,6]]) n=m=ida=ipiv=a.shape[0] a_gpu=gpuarray.to_gpu(a) result=cula.culaDeviceSgetrf(m, n, a_gpu.gpudata, ida, ipiv) print result cula.culaShutdown() |
Thanks. You are getting the data error because the array |
Thanks for your reply. Ok so for fixing the first problem I should make "a" like : a=np.array([[1,2,3,4],[6,7,8,9],[7,2,3,5],[2,4,5,6]], dtype=np.float32) but I dont know how to fix the ipiv. Actually I dont understand what is ipiv . can tell me more about it? |
|
I get "None" after that . this is my code(I think I allocate the empty array in wrong way ): a=np.array([[1,2,3,4],[6,7,8,9],[7,2,3,5],[2,4,5,6]], dtype=np.float32) when I define it like : I get: status = _libcula.culaDeviceSgetrf(m, n, int(a), lda, int(ipiv)) |
Your code is correct; the CULA reference manual indicates that |
yes It's working now.I expected the result to have the answer not status. Thanks alot! |
Hello all,
I want to use some of cula functionality like LU factorization or Matrix inverse but I have some problem regarding the pointer inputs. for example for doing LU factorization with scikits.cuda.cula.culaDeviceSgetrf(m, n, a, lda, ipiv) , one need to use pointer f "a" argument but there is no pointer in python explicitly(I know all variables in python are by ref) . So what should I do in this case? should I use ctype library to create python?
this is what I am trying to do:
import numpy as np
import scikits.cuda.cula as cula
import pycuda.gpuarray as gpuarray
cula.culaInitialize()
I create a square matrix for simplicity
a=np.array([[1,2,3,4],[6,7,8,9],[7,2,3,5],[2,4,5,6]])
n=b.shape[0]
ida=ipv=m
scikits.cuda.cula.culaDeviceSgetrf(m,n,a,n,n)
but I'm getting this error:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/scikits.cuda-0.042-py2.7.egg/scikits/cuda/cula.py", line 329, in culaDeviceSgetrf
status = _libcula.culaDeviceSgetrf(m, n, int(a), lda, int(ipiv))
TypeError: only length-1 arrays can be converted to Python scalars
and when I try
a_gpu = gpuarray.to_gpu(a)
scikits.cuda.cula.culaDeviceSgetrf(m,n,a_gpu,n,n) :
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/scikits.cuda-0.042-py2.7.egg/scikits/cuda/cula.py", line 329, in culaDeviceSgetrf
status = _libcula.culaDeviceSgetrf(m, n, int(a), lda, int(ipiv))
TypeError: int() argument must be a string or a number, not 'GPUArray'
any solution ?
Thanks ,
Mohsen
The text was updated successfully, but these errors were encountered: