Package: python-pyopencl
Version: 2015.2.4-1
Severity: important

Dear Maintainer,


copying a host buffer to a 2D device image will fail. The
problem can be reproduced by the minimal example below.
A further code example will be shown that does not throw
an error yet still won't actually copy.

The problem seems to be related to the recent switch of pyopencl
from boost to cffi and can be fixed by upgrading to the latest
upstream release of pyopencl (verfied by "pip install pyopencl")

The problem also affects python3-pyopencl and is as well solved
by using the latest pyopencl release through pip3.

This might also solve bug #819448.


kind regards,
Jonas


### CODE EXAMPLE: ###


from numpy import zeros, ones_like, float32
import pyopencl as cl
mf = cl.mem_flags

host_buffer  = zeros((128, 128), dtype=float32)
device_image = cl.Image(ctx, mf.READ_WRITE,
                        cl.ImageFormat(cl.channel_order.INTENSITY,
                                       cl.channel_type.FLOAT),
                        shape=(128, 128))
cl.enqueue_copy(que, device_image, host_buffer, origin=(0, 0), region=(128,
128))



---------------------------------------------------------------------------
LogicError                                Traceback (most recent call last)
<ipython-input-11-075d353c4950> in <module>()
----> 1 cl.enqueue_copy(que, imageD, imageH, origin=(0, 0), region=(512, 256))

/usr/lib/python2.7/dist-packages/pyopencl/__init__.pyc in enqueue_copy(queue,
dest, src, **kwargs)
   1526
   1527                 return _cl._enqueue_write_image(
-> 1528                         queue, dest, origin, region, src, **kwargs)
   1529         else:
   1530             raise ValueError("invalid dest mem object type")

/usr/lib/python2.7/dist-packages/pyopencl/cffi_cl.pyc in
_enqueue_write_image(queue, mem, origin, region, hostbuf, row_pitch,
slice_pitch, wait_for, is_blocking)
   1515         _event, queue.ptr, mem.ptr, origin, origin_l, region, region_l,
   1516         c_buf, row_pitch, slice_pitch, c_wait_for, num_wait_for,
-> 1517         bool(is_blocking), NannyEvent._handle(hostbuf, c_ref)))
   1518     return NannyEvent._create(_event[0])
   1519

/usr/lib/python2.7/dist-packages/pyopencl/cffi_cl.pyc in _handle_error(error)
    547     _lib.free_pointer(error.msg)
    548     _lib.free_pointer(error)
--> 549     raise e
    550
    551 # }}}

LogicError: clenqueuereadimage failed: INVALID_VALUE



by adding a third dimension to origin and region, the command will execute
without error:

cl.enqueue_copy(que, device_image, host_buffer, origin=(0, 0, 0), region=(128,
128, 1))

yet no data will be actually copied, which can be verfied by attempting to copy
the data
back from the device to the host:

host_buffer_2 = ones_like(host_buffer)
cl.enqueue_copy(que, host_buffer_2, device_image, origin=(0, 0, 0),
region=(128, 128, 1))

host_buffer_2 should now have equal contents as host_buffer, yet it doesn't.




-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.5.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages python-pyopencl depends on:
ii  amd-opencl-icd [opencl-icd]       1:15.9-4~deb8u2
ii  libc6                             2.22-9
ii  libgcc1                           1:6.1.1-4
ii  libstdc++6                        6.1.1-4
ii  nvidia-opencl-icd [opencl-icd]    352.79-7
ii  ocl-icd-libopencl1 [libopencl1]   2.2.9-1
ii  pocl-opencl-icd [opencl-icd]      0.12-2
ii  python                            2.7.11-1
ii  python-appdirs                    1.4.0-2
ii  python-cffi                       1.6.0-1
pn  python-cffi-backend-api-9729      <none>
ii  python-decorator                  4.0.6-1
ii  python-numpy [python-numpy-abi9]  1:1.11.0-1
ii  python-pkg-resources              20.10.1-1
ii  python-pytools                    2016.1-1
ii  python-six                        1.10.0-3
pn  python:any                        <none>

Versions of packages python-pyopencl recommends:
ii  python-mako          1.0.4+ds1-1
ii  python-opengl        3.1.0+dfsg-1
ii  python-pyopencl-doc  2015.2.4-1

Versions of packages python-pyopencl suggests:
pn  python-imaging-tk    <none>
ii  python-matplotlib    1.5.1-1+b2
pn  python-pyopencl-dbg  <none>
pn  python-pytest        <none>

-- no debconf information

Reply via email to