GPU Programming

In GPU programming such as CUDA, what is a "kernel"?

  1. AThe core of the GPU's operating system
  2. BA function that many threads execute simultaneously on the GPU
  3. CA component that cools the GPU chip
Show answer and explanation

Answer: B. A function that many threads execute simultaneously on the GPU

In GPU programming a kernel is a function launched from the CPU-side program in which many GPU threads execute the same code. Each thread uses its own index to choose which data element to handle. For array addition, for example, the kernel is written so that each thread adds one element, and as many threads are launched as there are elements. The word is the same as for an OS kernel, but the meaning differs.

  • A. It has a different meaning from an OS kernel.
  • B. Correct. It is launched from the CPU and runs in parallel on the GPU.
  • C. It is not a cooling component.
Practice this topic Back to topic

More GPU Programming questions

  1. Which correctly orders the CUDA thread hierarchy from largest to smallest?
  2. A CUDA kernel computes each thread's index i with the expression above. What is i for the thread with blockIdx.x = 2, blockDim.x = 256 and threadIdx.x = 5?
  3. To process a 1000-element array with one element per thread and 256 threads per block, how many blocks should be launched?
  4. Why does the CUDA kernel above include "if (i < n)"?
  5. On NVIDIA GPUs, what is the unit of 32 threads bundled together to execute the same instruction in lockstep called?