0PricingLogin
CUDA Academy · Lesson

Anatomy of a Kernel

Signature, return type, and the void rule.

What a Kernel Is

A kernel is a single C++ function that runs on the GPU, executed at once by thousands of threads. You write it once, the hardware fans it out. 🚀

The __global__ Marker

You mark a kernel with the __global__ qualifier. It tells nvcc this function is called from the CPU but actually runs on the device.

__global__ void myKernel() {
    // runs on the GPU
}

All lessons in this course

  1. Anatomy of a Kernel
  2. The Triple-Angle-Bracket Launch
  3. printf Inside a Kernel
  4. cudaDeviceSynchronize Explained
← Back to CUDA Academy