IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 2 replies
  • Latest Post - ‏2011-04-25T21:59:19Z by mrekucci
mrekucci
mrekucci
2 Posts

Pinned topic printf function doesn work in kernel

‏2011-04-25T19:30:56Z |
Hi I trying to debug OpenCL kernel code. Here is the code:

 #pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable

int offset() {
return 'A' - 'a';
}
__kernel void tKernel(__global unsigned char *in, __global unsigned char *out) {
size_t i;
printf(“var”);
for (i = 0; i < 10; i++)
out[i] = in[i] + offset();
}

In IBM OpenCL_guide.pdf in section 4.3.3 on page 18, there are describe debugging kernel with printf method.
So I add the printf function to my kernel and trying test it. But OpenCL compile gave me this error:

"IBM_OpenCL_kernel.cl", line 9.15: 1506-766 (S) The universal character name "?" is not in the allowable range for an identifier.

I also have exported LD_LIBRARY_PATH variable. Can anyone have this problem?
Updated on 2011-04-25T21:59:19Z at 2011-04-25T21:59:19Z by mrekucci
  • SystemAdmin
    SystemAdmin
    131 Posts

    Re: printf function doesn work in kernel

    ‏2011-04-25T19:58:35Z  
    i cut and pasted your source and got the same error, but when i typed it in by hand, it worked. are you creating this source in windows or somewhere else? it looks like the quote " character isn't correct and is causing the problem.
    .bri.
  • mrekucci
    mrekucci
    2 Posts

    Re: printf function doesn work in kernel

    ‏2011-04-25T21:59:19Z  
    i cut and pasted your source and got the same error, but when i typed it in by hand, it worked. are you creating this source in windows or somewhere else? it looks like the quote " character isn't correct and is causing the problem.
    .bri.
    Thanks, I using Vim, I copied this printf from pdf file, I deleted it and write new one and now it's OK.