An OpenCL application can execute a function in parallel on a device using the kernel objects. There may be more than one kernel functions, which run in parallel in an application based on the hardware you have. An application can create multiple program objects each for a different context. Each of these program objects can have more than one kernel object. Each kernel in a program source string is identified by a __kernel
qualifier. Let us first create a cl_program
object.
The OpenCL kernel programs needs to be built and linked at runtime. In OpenCL a program object can be created using the functions, clCreateProgramWithSource
or clCreateProgramWithBinary
. A program object is created once for a context in execution. Input to these functions is a source text string in ASCII or in binary format respectively. The program object is created for the devices associated with the OpenCL context. The clCreateProgramWithSource
function...