Results 1 to 2 of 2

Thread: Format restrictions on OpenCL kernel

  1. #1
    Junior Member
    Join Date
    Dec 2013

    Format restrictions on OpenCL kernel

    Dear all,

    I'm trying the example from the 'OpenCL in Action' book in Chapter 5. I'm using Windows 7 64-bit and NVIDIA Tesla GPU. The code is compiled from command line using the
    'VS2012 x64 cross tools command prompt' with the command 'cl -o mad_test.exe -I"C:\Program files\NVIDIA GPU computing toolkit\CUDA\v5.5\include" mad_test.c "C:\Program files\NVIDIA
    GPU computing toolkit\CUDA\v5.5\lib\x64\OpenCL.lib". The program compiles fine. However, I find that the kernel only compiles correctly in the following form (it is in a separate file called

    __kernel void mad_test(__global uint *resul)
    uint a = 0x123456;
    uint b = 0x112233;
    uint c = 0x111111;

    resul[0] = mad24(a, b, c);
    resul[1] = mad_hi(a, b, c);

    If the variable name 'resul' is made longer, e.g. 'result1' kernel compilation fails with the following error log:
    :9:2: error: expected identifier or '('

    I'm a bit new to OpenCL and don't know where I should look at '9:2:' in the kernel. Is this a line number?

    Are there any known restrictions on the formatting of OpenCL kernels? Some maximum of characters per line that should not be exceeded?

    Many thanks!

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Right, "9:2" is line and column. Compile message formatting is not specified by the OpenCL specification but this is a common way of indicating where the error is.

    There aren't restrictions on formatting of OpenCL kernels and no maximum characters per line.

    I'd check the code that load the file and passes it to the OpenCL API to make sure it's picking up everything. Maybe your editor changed something about the file (such as line ending characters or Unicode or whatever).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts