Coder Social home page Coder Social logo

Comments (10)

lebedov avatar lebedov commented on May 22, 2024

You can pass a_gpu.gpudata to the wrapper function; it gets cast to an integer that corresponds to the pointer value.

from scikit-cuda.

llvll0hsen avatar llvll0hsen commented on May 22, 2024

still not working :

cula.culaDeviceSgetrf(m,n,a_gpu.gpudata,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 330, in culaDeviceSgetrf
culaCheckStatus(status)
File "/usr/local/lib/python2.7/dist-packages/scikits.cuda-0.042-py2.7.egg/scikits/cuda/cula.py", line 210, in culaCheckStatus
raise culaExceptionsstatus
scikits.cuda.cula.culaDataError: 3

from scikit-cuda.

lebedov avatar lebedov commented on May 22, 2024

Can you please post the code that you are trying to run? The snippet in your initial posting is incomplete.

from scikit-cuda.

llvll0hsen avatar llvll0hsen commented on May 22, 2024

This is what I'm trying to do:

import pycuda.gpuarray as gpuarray
import pycuda.autoinit
import scikits.cuda.cula as cula

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()

from scikit-cuda.

lebedov avatar lebedov commented on May 22, 2024

Thanks. You are getting the data error because the array a doesn't contain single precision floats. Also, the ipiv parameter must be a pointer to an integer array, not a scalar.

from scikit-cuda.

llvll0hsen avatar llvll0hsen commented on May 22, 2024

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?

from scikit-cuda.

lebedov avatar lebedov commented on May 22, 2024

ipiv contains the 1-offset indices of the pivots determined during the decomposition. You don't need to set ipiv; just allocate an empty int32 array in GPU memory and pass its gpudata attribute to the function. See the GETRF entry in the CULA Reference manual for more information.

from scikit-cuda.

llvll0hsen avatar llvll0hsen commented on May 22, 2024

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)
n=m=ida=a.shape[0]
ipiv=np.empty(n,dtype=np.int32)
ipiv_gpu=gpuarray.to_gpu(ipiv)
a_gpu=gpuarray.to_gpu(a)
result=cula.culaDeviceSgetrf(m, n, a_gpu.gpudata, ida, ipiv_gpu.gpudata)
print result


when I define it like :
ipiv=np.array([],dtype=np.int32)

I get:

status = _libcula.culaDeviceSgetrf(m, n, int(a), lda, int(ipiv))
TypeError: int() argument must be a string or a number, not 'NoneType'

from scikit-cuda.

lebedov avatar lebedov commented on May 22, 2024

Your code is correct; the CULA reference manual indicates that ipiv should have length min(m,n). Note also that the returned value of the function is its execution status, not the result of the computation.

from scikit-cuda.

llvll0hsen avatar llvll0hsen commented on May 22, 2024

yes It's working now.I expected the result to have the answer not status. Thanks alot!

from scikit-cuda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.