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
}