__global__ marks a CUDA function as a kernel: it is typically called from the host and executes on the device. A regular function runs once per call; a kernel runs the same instructions across its launched threads. section 2.3
#include <stdio.h>
#include <cuda_runtime.h>
__global__ void helloKernel() { #A
printf("Hello, Parallel World!\n"); #B
}
int main() {
helloKernel<<<1, 8>>>(); #C
cudaDeviceSynchronize(); #D
return 0;
}See the qualifier on helloKernel and the launch that runs it with eight threads; each thread prints the same message. section 2.1
