//hellocuda.cu
#include <iostream>
#include "stdio.h"
__global__ void kernel(void){
printf("hello, cvudakernel\n");
}
int main(void){
kernel<<<1,5>>>();
cudaDeviceReset();
return 0 ;
}
在命令行执行
$nvcc hellocuda.cu -o hellocuda
$./hellocuda
输出结果:
hello, cvudakernel
hello, cvudakernel
hello, cvudakernel
hello, cvudakernel
hello, cvudakernel