cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

scrape
Journeyman III

debug cpu program in linux using valgrind+gdb

Hello, I am currently attempting to figure out the best way to debug programs on the linux platform.  I do not run windows. 

I have made a simple hello world style program to learn opencl.  The program I wrote works when I do not run it in valgrind.  However when I run it in valgrind using the CPU device I get the following error:

==27365== Thread 3:

==27365== Use of uninitialised value of size 4

==27365==    at 0x42283CB: __OpenCL_square_stub (in /tmp/OCLMF7u76.so)

When I attach the gdb and run backtrace I get this call stack:

#0  0x04228357 in __OpenCL_square_stub () from /tmp/OCLUxi8EM.so

#1  0x04a75c89 in ?? () from /opt/AMDAPP/lib/x86/libamdocl32.so

#2  0x04a66894 in ?? () from /opt/AMDAPP/lib/x86/libamdocl32.so

Backtrace stopped: previous frame inner to this frame (corrupt stack?)

I am not sure how to debug this or how to remedy the situation, but it seems like the standard tools are unusable for a language that is very close to C using a cpu device. 

I have attached my hello world program and would like to figure out how to remedy this situation so that linux users can reliably create opencl software.

I have also tried gdebugger but it just crashes.  Even on the samples that come from AMD.

any help would be greatly appreciated.

0 Likes
2 Replies
nou
Exemplar

for me gdebugger crash every opengl program unless I export LD_LIBRARY_PATH=/usr/lib/fglrx

0 Likes
urishomroni
Staff

Hi scrape,

Unfortunately, gDEBugger does not currently support debugging of OpenCL kernels on CPU devices. This feature is in our want-list for future features.

The best solution currently available would be to port / run the kernel on an AMD Radeon HD 5xxx or newer GPU and debug it there, then port the changes back to the CPU.

0 Likes