Home > front end >  Enqueue kernel from kernel leads to a misunderstood build error
Enqueue kernel from kernel leads to a misunderstood build error

Time:02-26

I need to launch a kernel from another kernel so I read the OpenCL specs and did exactly as mentioned but I got a CL_BUILD_PROGRAM_FAILURE. Maybe my opencl version is less than 2.0 but I have downloaded OpenCL with CUDA so normally the version is upper than 2.0 right?

Here is my kernel code :

__kernel void funcB(__global int* a)
{
    //blabla
}

__kernel void funcA(__global int* a, const size_t n)
{
    //blabla

    void (^funcB)(void) = ^{funcB(a);};

    enqueue_kernel(get_default_queue(), CLK_ENQUEUE_FLAGS_WAIT_KERNEL, 
    ndrange_1d(n), funcB);
}

Do I also need to create a 'cl_kernel funcB' object in the host code ?? Or maybe import a header other than <CL/cl.h> ?

Thanks for the help.

CodePudding user response:

You can't use OpenCL 2.0/2.1/2.2 features on OpenCL 1.1/1.2/3.0 devices.

Nvidia GPUs only support the OpenCL C 1.2 language standard (you can query this with cl_device.getInfo<CL_DEVICE_OPENCL_C_VERSION>()). Nvidia recently "upgraded" to OpenCL version 3.0, but this is just a new name for version 1.2. OpenCL 2.0/2.1/2.2 features are still not supported.

  • Related