Here's the code:
import pycuda.autoinit
import pycuda.gpuarray as gpuarray
import pycuda.driver as drv
import numpy as np
import scikits.cuda.linalg as culinalg
import scikits.cuda.misc as cumisc
culinalg.init()
ag = gpuarray.to_gpu(np.random.rand(1000,1000))
bg = gpuarray.to_gpu(np.zeros((1000,1000))
bg[:,:] = ag
I got the following error:
TypeError: 'GPUArray' object does not support item assignment
So any way to assign a matrix to another existing matrix in pycuda/ scikits.cuda ?
Ok, this is not an elegant way, but a solution: Use the ElementwiseKernel of pycuda: