This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Keystone II get Core ID in OpenCL Application

Other Parts Discussed in Thread: 66AK2H12, SYSBIOS

Hello everybody,

I bought an EVMK2H (w/ 66AK2H12 board) and I am "playing a bit" with the OpenCL examples provided (more specifically, "Mandelbrot Set computation").

I need to find a way to get the exact ID of the core the code is running on, but it seems that the "DNUM" register is not accessible, so when the code dynamically compiles the ocl kernel, I got this error:

DEVICE LIST:
TI K2H DSP (8x C66)


undefined first referenced
symbol    in file
---------    ----------------
DNUM    /tmp/opencl8dNnwX.obj

I took a look at several posts in SYSBIOS and Keystone II forums, but none of the techniques/proposed APIs works.

Can anyone help me please?

Ciao

Paolo

  • DNUM is a compiler defined variable and not a register.  Have you included the file c6x.h and specified the target type in your build. Also, check if the -mv option is specified.


    If everything check out try to see if your build has the following code

    extern volatile unsigned int cregister DNUM;

    Regards,

    Rahul

    PS: If you have MCSDK 3.1, you can take a look at the main.c in  mpm example under directory mcsdk_bios_3_x/examples/mpm/mpmsrv_keystone2_example for implementation details.

  • Dear Rahul,

    thanks for your help. Actually, my problem is a bit more complex, as I am tying to read DNUM directly from the .cl code. I am modifying the 

    ${mcsdk-hpc-examples}/opencl/mandelbrot/mandelbrot.cl

    file, which is dynamically compiled from within the

    ${mcsdk-hpc-examples}/opencl/mandelbrot/main.cpp

    file, and I actually don't know how to pass any parameter to the compiler (-I$path_to_c6x.h -mv) because the call to clBuildProgram (which lets me specify parameters) is wrapper inside a Program::build() method and hence not directly reachable. Do you have any suggestion on how to do it?

    Best

    Paolo

  • Hi Paolo,

    Moved this thread to correct forum for faster response.

    Thank you.

  •  

    From OpenCL C, you can use on of our extended set of built-in functions.

    __core_num()  will return the DSP id.