Hello Andreas,

Is there some way to change the shape of GPUArray object same as it
can be done with numpy.ndarray? The following naive code raises
exception on the last line:

import pycuda.autoinit
import pycuda.gpuarray as gpuarray
import numpy

arr = gpuarray.GPUArray((64, 64), numpy.float64)
arr.get()
arr.shape = (64 * 64,)
arr.get()

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    arr.get()
  File 
"/Library/Python/2.6/site-packages/pycuda-2011.1-py2.6-macosx-10.6-i386.egg/pycuda/gpuarray.py",
line 234, in get
    ary = _as_strided(ary, strides=self.strides)
  File 
"/Library/Python/2.6/site-packages/pycuda-2011.1-py2.6-macosx-10.6-i386.egg/pycuda/compyte/array.py",
line 116, in as_strided
    return np.asarray(_DummyArray(interface, base=x))
  File 
"/Library/Python/2.6/site-packages/numpy-2.0.0.dev_192ac74_20110629-py2.6-macosx-10.6-universal.egg/numpy/core/numeric.py",
line 235, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: mismatch in length of strides and shape

Best regards,
Bogdan

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

Reply via email to