#include <stdio.h>
// __global__ indicates this function runs on the GPU and is called by the CPU
__global__ void cudaHello() {
printf("Hello from the GPU!\n");
}
int main() {
// Launch the kernel with 1 block and 1 thread
cudaHello<<<1, 1>>>();
// Wait for the GPU to finish before exiting the program
cudaDeviceSynchronize();
printf("Hello from the CPU!\n");
return 0;
}
on console
Running in FUNCTIONAL mode...
Compiling...
Executing...
Hello from the GPU!
Hello from the CPU!
Exit status: 0
కామెంట్లు లేవు:
కామెంట్ను పోస్ట్ చేయండి