The __global__ Function Qualifier
Marking a function as a GPU kernel.
Two Worlds, Two Compilers
Your CUDA file holds both CPU and GPU code. A tiny keyword tells the compiler which side a function belongs to. That keyword is the function qualifier. ⚡
Meet __global__
The __global__ qualifier marks a function as a GPU kernel: code the CPU launches but the GPU actually runs across many threads.
__global__ void myKernel() {
// runs on the GPU
}All lessons in this course
- The __global__ Function Qualifier
- __device__ and __host__ Functions
- Separate Address Spaces
- The Life of a CUDA Program