To create a kernel object, use the function
cl_kernel clCreateKernel( cl_program program, const char* kernel_name, cl_int* errcode_ret);
program is a program object with a successfully built executable.
kernel_name is a function name in the program declared with the
errcode_ret will return an appropriate error code. If errcode_ret is
NULL, no error code is returned.
clCreateKernel returns a valid non-zero kernel object and errcode_ret is
CL_SUCCESS if the kernel object is created successfully.
Otherwise, it returns a
NULL value with one of the following error values
returned in errcode_ret:
CL_INVALID_PROGRAMif program is not a valid program object.
CL_INVALID_PROGRAM_EXECUTABLEif there is no successfully built executable for program.
CL_INVALID_KERNEL_NAMEif kernel_name is not found in program.
CL_INVALID_KERNEL_DEFINITIONif the function definition for
__kernelfunction given by kernel_name such as the number of arguments, the argument types are not the same for all devices for which the program executable has been built.
CL_INVALID_VALUEif kernel_name is
CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.
CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.
Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.