Segfault in clEnqueueReadBuffer

Hi everybody,

I got a segfault in clEnqueueReadBuffer reading the result of a kernel. I run my kernel a first time w/o problems and then I exchange the variables and run it again where it crashes with a segfault. But the behavior is not ‘perfectly reliable’. Sometimes it works in debug mode but not in normal mode, but most of the time it does not work at all. So I assume it is a memory issue. I checked all the variables that go in and out of clEnqueueReadBuffer regarding their sizes, but I could not find an error. Where else could the error hide? How would you debug this error?

Thank you very much!

i+d

example code:

[codebox]_err = clEnqueueReadBuffer(GPUCommandQueue, z_cl, CL_TRUE, 0,sizeof(float)*nclasses,h_c3, 0, NULL, NULL);[/codebox]

Hello,
I’m a novice programmer myself, but I thought I’d throw out a few things I’ve learned:
Make sure that the Kernel itself is operating correctly. Is it returning an error? I had an issue reading back memory that had been corrupted in the Kernel, and it didn’t show up until I tried to read it back.
What are the sizes that work? What sizes don’t work? Have you checked the maximum sizes you are allowed on your device?
Hope this is a starting point, and perhaps someone who is a better programmer than I am can come along and help out more!

-Kevin

Hello,
I’m a novice programmer myself, but I thought I’d throw out a few things I’ve learned:
Make sure that the Kernel itself is operating correctly. Is it returning an error? I had an issue reading back memory that had been corrupted in the Kernel, and it didn’t show up until I tried to read it back.
What are the sizes that work? What sizes don’t work? Have you checked the maximum sizes you are allowed on your device?
Hope this is a starting point, and perhaps someone who is a better programmer than I am can come along and help out more!

-Kevin

Hello Kevin

thanks for the starting points. I try to work it out.

All the best to you
i+d

Hello Kevin

thanks for the starting points. I try to work it out.

All the best to you
i+d