将c程序最简单的hello world用cuda编写在GPU上执行,以下为代码:
#include<iostream>using namespace std;__global__ void kernel(void)//__global__:cpu调用GPU执行{}int main(void){ kernel<<<1,1>>>();//启动1block 1thread cout<<"hello world!"<<endl; return 0;}