OpenCL applications consist of two parts: application or host-side code, and OpenCL kernels.
- Application, or host-side code:
- Calls the OpenCL APIs.
- Compiles the OpenCL kernels.
- Allocates memory buffers to pass data into and out of the OpenCL kernels.
- Sets up command queues.
- Sets up dependencies between the tasks.
- Sets up the N-Dimensional Range (NDRanges) that the kernels execute over.
- OpenCL kernels
- Written in OpenCL C language.
- Perform the parallel processing.
- Run on compute devices such as application processors or GPU shader cores.
You must write both of these parts correctly to get the best performance.