Bruce Labitt <bdlab...@gmail.com> writes:
> I'm trying to port an FDTD code to pycuda and have run into a problem.  The
> error occurs when using slices.
>
> Known error?
>
> All variables are gpuarray.  Fails in main time loop.
>
> In [4]: run fdtd_pycuda.py
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call last)
> /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in
> execfile(fname, *where)
>     202             else:
>     203                 filename = fname
> --> 204             __builtin__.execfile(filename, *where)
>
> /home/bruce/FDTD/fdtd_pycuda.py in <module>()
>     554
>     555         bx[1:ie_tot,:,:] = D1hx[1:ie_tot,:,:] * bx[1:ie_tot,:,:] -
> D2hx[1:ie_tot,:,:] * \
> --> 556             ( ( ez[1:ie_tot, 1:jh_tot, :] - ez[1:ie_tot, 0:je_tot,
> :]) - ( ey[1:ie_tot,:,1:kh_tot] - ey[1:ie_tot,:,0:ke_tot] ) ) / delta
>     557         """
>     558         above line generates RunTimeError: only contiguous arrays
> may be used as arguments to this operation
>
> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.pyc
> in __sub__(self, other)
>     425         if isinstance(other, GPUArray):
>     426             result = self._new_like_me(_get_common_dtype(self,
> other))
> --> 427             return self._axpbyz(1, other, -1, result)
>     428         else:
>     429             if other == 0:
>
> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.pyc
> in _axpbyz(self, selffac, other, otherfac, out, add_timer, stream)
>     308         assert self.shape == other.shape
>     309         if not self.flags.forc or not other.flags.forc:
> --> 310             raise RuntimeError("only contiguous arrays may "
>     311                     "be used as arguments to this operation")
>     312
>
> RuntimeError: only contiguous arrays may be used as arguments to this
> operation
>
>
> Evaluating the following generates the RuntimeError.
>
> In [17]: ( ey[1:ie_tot,:,1:kh_tot] - ey[1:ie_tot,:,0:ke_tot] )
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call last)
> <ipython-input-17-1c6dfb98d933> in <module>()
> ----> 1 ( ey[1:ie_tot,:,1:kh_tot] - ey[1:ie_tot,:,0:ke_tot] )
>
> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.pyc
> in __sub__(self, other)
>     425         if isinstance(other, GPUArray):
>     426             result = self._new_like_me(_get_common_dtype(self,
> other))
> --> 427             return self._axpbyz(1, other, -1, result)
>     428         else:
>     429             if other == 0:
>
> /usr/local/lib/python2.7/dist-packages/pycuda-2014.1-py2.7-linux-x86_64.egg/pycuda/gpuarray.pyc
> in _axpbyz(self, selffac, other, otherfac, out, add_timer, stream)
>     308         assert self.shape == other.shape
>     309         if not self.flags.forc or not other.flags.forc:
> --> 310             raise RuntimeError("only contiguous arrays may "
>     311                     "be used as arguments to this operation")
>     312
>
> RuntimeError: only contiguous arrays may be used as arguments to this
> operation
>
> ey.shape = (111, 110, 111)
> kh_tot = 111
> ke_tot = 110
>
> Shapes are appropriate.
>
> Work arounds for slices?  Straight numpy implementation works fine.

None yet. I'd appreciate patches, but for now the linear algebra
functionality in PyCUDA only works on contiguous arrays.

Andreas

Attachment: pgpr4m2PwF_QD.pgp
Description: PGP signature

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to