Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between kernel and program object?

Tags:

gpgpu

gpu

opencl

I've been through several resources: the OpenCL Khronos book, GATech tutorial, NYU tutorial, and I could go through more. But I still don't understand fully. What is the difference between a kernel and a program object?

So far the best explanation is this for me, but this is not enough for me to fully understand: PROGRAM OBJECT: A program object encapsulates some source code (with potentially several kernel functions) and its last successful build. KERNEL: A kernel object encapsulates the values of the kernel’s arguments used when the kernel is executed.

Maybe a program object is the code? And the kernel is the compiled executable? Is that it? Because I could understand something like that.

Thanks in advance!

like image 701
Luis B Avatar asked Aug 24 '16 16:08

Luis B


1 Answers

A program is a collection of one or more kernels plus optionally supporting functions. A program could be created from source or from several types of binaries (e.g. SPIR, SPIR-V, native). Some program objects (created from source or from intermediate binaries) need to be built for one or more devices (with clBuildProgram or clCompileProgram and clLinkProgram) prior to selecting kernels from them. The easiest way to think about programs is that they are like DLLs and export kernels for use by the programmer.

Kernel is an executable entity (not necessarily compiled, since you can have built-in kernels that represent piece of hardware (e.g. Video Motion Estimation kernels on Intel hardware)), you can bind its arguments and submit them to various queues for execution.

like image 162
Robert Ioffe Avatar answered Sep 17 '22 20:09

Robert Ioffe