2014年3月30日

GPGPU OpenCL/CUDA 高性能编程的10大注意事项

摘要: 1.展开循环 如果提前知道了循环的次数,可以进行循环展开,这样省去了循环条件的比较次数。但是同时也不能使得kernel代码太大。 循环展开代码例子: 1 #include 2 using namespace std; 3 4 int main(){ 5 int sum=0; 6 for(int i=1;i2 int main()3 {4 int a=SIZE;5 printf("a=%d, SIZE=%d\n",a,SIZE);6 return 0;7 }View Code 编译: g++ -DSIZE=128 -o A Dmacro.cpp4... 阅读全文

posted @ 2014-03-30 21:24 旭东的博客 阅读(9880) 评论(1) 推荐(1) 编辑

导航