This is the complete traceback:

Traceback (most recent call last):
  File "/home/jadidi/python-workespace/kernel/linear
regression/kernel-invers-direct.py", line 85, in <module>
    gpu_compute(Y,K)
  File "/home/jadidi/python-workespace/kernel/linear
regression/kernel-invers-direct.py", line 46, in gpu_compute
    k_inv=la.pinv(k_gpu)
  File
"/usr/local/lib/python2.7/dist-packages/scikits.cuda-0.042-py2.7.egg/scikits/cuda/linalg.py",
line 1049, in pinv
    return dot(vh_gpu, dot_diag(s_gpu, u_gpu, 't'), 'c', 'c')
  File
"/usr/local/lib/python2.7/dist-packages/scikits.cuda-0.042-py2.7.egg/scikits/cuda/linalg.py",
line 323, in dot
    c_gpu = gpuarray.empty((n, ldc), x_gpu.dtype)
  File
"/usr/local/lib/python2.7/dist-packages/pycuda-2011.2.2-py2.7-linux-x86_64.egg/pycuda/gpuarray.py",
line 182, in __init__
    self.gpudata = self.allocator(self.size * self.dtype.itemsize)
pycuda._driver.MemoryError: cuMemAlloc failed: out of memory

On Wed, Sep 5, 2012 at 1:13 PM, mohsen jadidi <[email protected]>wrote:

>
> Hello all,
>
> I am trying to run some test on both gpu and cpu to get the feeling about
> their speed! I implemented regularized least square regression using both
> cpu and gpu.In this algorithm one needs to calculate the inverse if kernel
> matrix(k^-1) and then multiply it to corresponding target values achieve
> the coefficient(c).C=(K^-1)*Y/     the problem comes up when I increase the
> number of samples from 5000 to 6000. I don't know whether this is the
> reasonable error because I'm using a lot of example or there is way to fix
> this !
> this is my code:
>
>
> import numpy as np
> from sklearn.datasets.samples_generator import make_regression
> from numpy import linalg as LA
>
> import pycuda.gpuarray as gpuarray
> import pycuda.autoinit
> import scikits.cuda.linalg as la
> la.init()
>
>
> def cpu_compute(y,k):
>
>     c = np.dot(LA.inv(k), y)
>     print c
>
>
>     return
> def gpu_compute(y,k):
>
>     y_gpu=gpuarray.to_gpu(y)
>     k_gpu=gpuarray.to_gpu(K)
>     k_inv=la.pinv(k_gpu)
>     c = la.dot(k_inv, y_gpu,transb='T')
>     print c
>     return
> X, Y = make_regression(n_samples=6000, n_features=4, n_informative=1,
> random_state=0, noise=35)
>
>
>
> n=X.shape[1]
> l=len(X)
>
>
> K=np.dot(X, np.transpose(X))
> K=K+np.identity(l)*n*7
>
>
> ########### doing statistics############3
> import cProfile
> import pstats
>
> cProfile.run('cpu_compute(Y,K)','cpu_profile.txt')
> p=pstats.Stats('cpu_profile.txt')
> p.sort_stats('time').print_stats(10)
> print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
>
>
> cProfile.run('gpu_compute(Y,K)','gpu_profile.txt')
> p=pstats.Stats('gpu_profile.txt')
> p.sort_stats('time').print_stats(10)
>
>
>
>
>
> Thanks in advance for any help
>  --
> Mohsen
>
>


-- 
Mohsen Jadidi
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to