cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

Debugging OpenCL program ?

Hi,

I'm trying to find a way to debug the OpenCL code... with any "trace" and no "debugger" it is really a pain once the algorithm is a little bit complex.

I only work with CPU (for development) and under XP....

I have find the following article about OpenCL debugging...

http://samritmaity.wordpress.com/2009/11/20/debugging-opencl-program-with-gdb

But my application crash once I set the "-g" parameter during the Build !

Does someone has find a way ?

Thanks

0 Likes
9 Replies

viewon01,
make sure that you do not select the GPU as the GPU backend does not have any support for debug builds.
0 Likes

Hi,

There is no GPU on this machine, it is an Intel CPU and an Intel graphic card.

What can I do to debug ?

0 Likes

Hi,

you can send data back to host and output there.

 

 

0 Likes

Thanks, but how ?

I have create a 'char buffer' that I send to the OpenCL kernel...

But how can I concat string into this buffer ?

(And how can I convert an int to a string) ?

 

Thx

0 Likes

You can use

to get a const char* to the first char of the string use stringname.c_str().

use a loop and  char in=pointer to copy the const char pointer to the cl_buffer.

 

To get an int to a string use stirng s=""+intname;

 

0 Likes

Thanks,

Ar you sure the it is "KERNEL code" ?

But it tells that 'string' is undefined !!

Here is my pseudo-code :

char * output;

output = "hello world";

output = output + " test ";

integerValue = 5;
output = output + integerValue;

Do you know how I can do this in the OpenCL kernel ?

Thanks

0 Likes

Hi,

you cannot you variable array length.

So you have to write this in a new array: output = output + " test " is not posiible.

you have to create a second char array to do this.

 

MFG Sheeep

 

0 Likes

 

I am trying to replicate sheep's suggestions and getting similiar error...

 

eg for the kernel code :

 

__kernel void test(__global char * debug)

{

    string s = "" + d;

    debug = s.c_str();

}



 

I receive that 'string' is undefined :

 

C:\Users\jfranta\AppData\Local\Temp\OCL6467.tmp.cl(116): error: identifier

          "string" is undefined

      string s = "" + d;

      ^

 

C:\Users\jfranta\AppData\Local\Temp\OCL6467.tmp.cl(108): warning: parameter

          "debug" was set but never used

                               __global char * debug)



0 Likes

OpenCL does not support C++ classes and data types, only data types specified in the CL spec.
0 Likes