【发布时间】:2014-08-15 03:48:01
【问题描述】:
我在两个 GPU 上测试 convn:Quadro 6000 和 Titan 都比 cpu 花费更长的时间。
可以在matlab中进行快速测试:
maxloop=1000;
for i=1:maxloop
output2= convn(rand(320,1), rand([6,1,300]),'full');
end
for i=1:maxloop
goutput2= convn(gpuArray.rand(320,1),gpuArray.rand([6,1,300]), 'full');
end
CPU 需要 0.52 秒,Quadro 6000 需要 7 秒,Titan 需要 15 秒以上。
我测试过的内容:
1) 如果将 rand 输入更改为固定的预定义值并不会带来任何改进。
2) 预定义 GPU 输出 (goutput2) 并没有太大帮助。
四驱
泰坦
我确实运行了与第一个答案相同的测试:
当 m=1000 时得到相同的结果; n=100; k=5;
经过的时间是 2.367453 秒。 %%%%GPU
经过的时间是 27.502952 秒。 %%%%CPU
我的问题是什么以及为什么我自己的测试代码在 GPU 上运行速度较慢?
【问题讨论】:
-
阅读您链接到的答案,您相对较小的数据大小在 GPU 上无法很好地工作(可能是由于每次运行的设置成本)。
-
您能否尝试使用this solution. 和此处-Measure and Improve GPU Performance. 中讨论的更可靠的基准测试技术