CPU下的计时与GPU计时对比
2017-07-31 17:47
519 查看
1.CPU下:使用clock_t统计时间
GPU下:使用cudaEventCreate统计时间
clock_t start; clock_t end; start=clock(); filter2D (outimage,B,-1,fx);//这是要统计时间的函数 end=clock(); double time=(double)(end-start)/CLOCKS_PER_SEC; printf("\n"); cout<<"原函数 filter2D 的执行时间 is: "<<time*1000<<"ms"<<endl;
GPU下:使用cudaEventCreate统计时间
cudaEventCreate(&start); cudaEventCreate(&stop); cudaEventRecord(start,0); kernel_filter2D<<<grid, block>>>(width,height,byteCount,d_src_imgbuf,d_filter2D_imgbuf); cudaEventRecord(stop, 0); cudaEventSynchronize(start); cudaEventSynchronize(stop); cudaEventElapsedTime(&time,start,stop); cudaEventDestroy(start); cudaEventDestroy(stop); printf("GPU下 filter2D 的执行时间:%f(ms)\n",time);
相关文章推荐
- CPU与GPU的内存带宽对比(CPU vs CUDA GPU memory bandwidth)
- GPU与CPU版本的矩阵乘法对比
- 常规波束形成的CPU和GPU的运行时间对比测试
- GPU与CPU对比测试
- tensorflow对比AlexNet的CPU和GPU运算效率
- 常见CPU和GPU转码技术对比
- GTX1080 LetNet-5 CPU GPU cuDNN5.1 时间对比
- ND4J求多元线性回归以及GPU和CPU计算性能对比
- GPU与CPU版本的矩阵乘法对比
- caffe:单CPU(E2650)下--单GPU和双GPU(GTX 1080ti)下执行LeNet-5的mnist运行时间对比
- 在Faster R-CNN 中DEMO 的CPU(i5)和GPU(GTX1060 )时间对比
- Julia曲线绘制-——CPU版本与GPU版本对比
- Keras+Theano后端,CPU、GPU、cuDNN加速对比(Dogs vs. Cats和mnist)
- 收藏他人的博客-----GPU和CPU的对比
- 基于opencv的gpu与cpu对比程序,代码来自opencv的文档中
- GPU和CPU对比
- 基于opencv的gpu与cpu对比程序,代码来自opencv的文档中
- CPU和GPU性能对比
- 基于opencv的gpu与cpu对比程序,代码来自opencv的文档中
- 浅谈多节点CPU+GPU协同计算负载均衡性设计