Hi all, I have been having quite a few issues creating sub-buffers in my code.
The first (minor) issue relates to the convention of buf[start:end] inheriting the flags of buf when creating the sub buffer. This is problematic when buf was created with the COPY_HOST_PTR flag. Such a flag is not meaningful when creating sub buffers and so results in an exception. It would therefore be nice if this flag could be masked out. Secondly, the __getitem__ handler seems to adopt a non-standard convention for the slice range of buf[start:size] rather than buf[start:end] this causes the following snippet to fail on AMD hardware (which is strict about buffer lengths): import pyopencl as cl ctx = cl.create_some_context() buf = cl.Buffer(ctx, cl.mem_flags.READ_WRITE, 55296000) bufslc = buf[36864000:] See line 1728 of wrap_cl.hpp which calls get_sub_region(start, end, my_flags); but on line 1686 we have a prototype of: size_t origin, size_t size, cl_mem_flags flags), hence the issue. Given the above two issues I decided to switch to calling get_sub_region directly. So: buf[a:a + sz] => buf.get_sub_region(a, sz) While my code now functions on all platforms I now get a segfault when my application terminates: Signal: Segmentation fault (11) Signal code: Address not mapped (1) Failing at address: 0x8 [ 0] /lib64/libpthread.so.0(+0x102b0) [0x7fa8cf9b92b0] [ 1] /usr/lib64/libnvidia-opencl.so.1(+0x24f270) [0x7fa8c0e5e270] [ 2] /usr/lib64/libnvidia-opencl.so.1(+0x136650) [0x7fa8c0d45650] [ 3] /usr/lib64/libnvidia-opencl.so.1(+0x128da5) [0x7fa8c0d37da5] [ 4] /usr/lib64/libnvidia-opencl.so.1(+0x12926b) [0x7fa8c0d3826b] [ 5] /usr/lib64/libnvidia-opencl.so.1(+0x1345ab) [0x7fa8c0d435ab] [ 6] /usr/lib64/python2.7/site-packages/pyopenc./_cl.so(_ZN8pyopencl13memory_object7releaseEv+0x25) [0x7fa8c2079b95] [ 7] /usr/lib64/python2.7/site-packages/pyopencl/_cl.so(_ZN8pyopencl6bufferD0Ev+0x55) [0x7fa8c2079d35] [ 8] /usr/lib64/python2.7/site-packages/pyopencl/_cl.so(_ZN5boost6python7objects14pointer_holderISt8auto_ptrIN8pyopencl6bufferEES5_ED1Ev+0x2e) [0x7fa8c20751ce] [ 9] /usr/lib64/libboost_python-2.7.so.1.53.0(+0x265ac) [0x7fa8c1db15ac] [SNIP] with the only difference being the above change. (I am stumped here!) Regards, Freddie.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
