Matlab Convolution using gpu

倖福魔咒の 提交于 2019-12-02 10:16:18

The GPU performance is limited by the data array size [100x100x10] and [5x5] in your test case.

The actual performance also depends on the GPU and CPU module type. For your data size (test case 2 of the following code), I can get a performance improvement (2.75x) on GPU Tesla M2090 and CPU Xeon E5-2609.

For the following matlab test code

m=1000;
n=100;
k=5;

gc=convn(gpuArray.rand(m,m,10,'single'),gpuArray.rand(k,'single'));

tic;
for i=1:n
    gc=convn(gpuArray.rand(m,m,10,'single'),gpuArray.rand(k,'single'));
end
toc

c=convn(rand(m,m,10,'single'),rand(k,'single'));
tic;
for i=1:n
    c=convn(rand(m,m,10,'single'),rand(k,'single'));
end
toc

When m=1000; n=100; k=5; I got very good performance improvement (11.6x) on GPU.

Elapsed time is 2.367453 seconds.
Elapsed time is 27.502952 seconds.

But when m=100; n=1000; k=5; I got only 2.75x

Elapsed time is 1.206053 seconds.
Elapsed time is 3.330559 seconds.

When m=100; n=1000; k=14;, it becomes better (4.84x).

Elapsed time is 2.804957 seconds.
Elapsed time is 13.585698 seconds.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!