Search code examples
pythondebuggingsegmentation-faultopenclpyopencl

PyOpenCl: how to debug segmentation fault?


I have PyOpenCL code with OpenCL C kernel code. I catch segmentation fault error when I run my app. How to debug such error with some debugger or some other development tool? I don't know what exactly to do to find out the problem. I have in mind option with printf or something but I want use more powerful stuff.

I believe that error in kernel code, so I want to debug kernel code firstly.

UPD. I'm on linux (Arch Linux, 3.6.11), python 2 or 3, PyOpenCl 2012.1


Solution

  • Kernel debugging is an implementation-dependent affair. On Linux, the best I've found is to use AMD's CL implementation on the CPU, compile the kernel with -g, and use gdb. They've got instructions on this in their programming guide, here:

    AMD CL Documentation page