cuda 编程 (一) helloworld
#include <stdio.h>
__global__ void hello_from_gpu()
{
printf("Hello World from the GPU!\n");
}
int main(void)
{
hello_from_gpu<<<2, 4>>>();
cudaDeviceSynchronize();
return 0;
}
nvcc hello3.cu -o hello3
./hello3
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!
Hello World from the GPU!

浙公网安备 33010602011771号