Shared Code
main.cu
123456789101112131415161718192021222324
#include <stdio.h> __global__ void hello_from_gpu() { int thread_id = threadIdx.x; int block_id = blockIdx.x; printf("Hello from GPU Thread %d inside Block %d!\n", thread_id, block_id); } int main() { printf("Master CPU: Preparing to launch GPU Kernel...\n"); hello_from_gpu<<<2,5>>>(); cudaDeviceSynchronize(); printf("Master CPU: GPU execution finished.\n"); return 0; }
Comments (0)
to post comments and vote
No comments yet. Be the first to share your thoughts!