How to run a cuda program

cuda file:

#include <stdio.h>
__global__ void hello_from_gpu()
{
   printf("Hello World from the the GPU\n");
}
int main(void)
{
  hello_from_gpu<<<4, 4>>>();
  cudaDeviceSynchronize();
  return 0;
}

compile:
nvcc test.cu -o test

run:
image

posted @ 2024-05-25 15:20  PostMan_Zc  阅读(16)  评论(0)    收藏  举报