Jayanth Channagiri <cv.jaya...@hotmail.com> writes: > Dear all > > I am having problems with slicing a 3D array into 2D array and then sending > it to GPU. > For example, > > array1 = ones((128,128,128)) > array1_gpu = gpuarray.to_gpu(array1) #no problem in sending it to GPU > > But if I convert it to a 2D array like, > > array1_slice = array1[:,:,1] > array1_gpu = gpuarray.to_gpu(array1_slice) > > It gives me the following error: > > > array1_gpu = gpuarray.to_gpu(array1_slice) > File "/usr/lib/python2.7/dist-packages/pycuda/gpuarray.py", line 841, in > to_gpu > result.set(ary) > File "/usr/lib/python2.7/dist-packages/pycuda/gpuarray.py", line 219, in set > assert self.flags.forc > AssertionError > > I am unable to understand the error. Can anyone please explain me why is it > not possible this way and a solution?
Copy the array before transferring. You can't copy sliced arrays. (yet, patch welcome) Andreas
pgpGTd2Rfot6h.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda