gpuArray takes more time than CPU - imrotate
2 次查看(过去 30 天)
显示 更早的评论
Hi.. This is my first experiment with gpuArray on image processing. When I tried to compare the time taken to execute 'imrotate' between CPU array and GPU array, it is seen that GPUarray takes more time. I hope the command imrotate is supported on GPU. Any help would be appreciated. Thanks in advance.
0 个评论
回答(1 个)
Anand
2014-2-18
A couple of questions in helping you answer the question:
1. Which graphics card do you have? GPU performance is highly dependent on how good a graphics card you have. You can use the following command to find out:
>> gpuDevice
2. How big is the image and what data type is it?
3. Could you add the following line of code on line 9 and report back?
>> wait(gpuDevice)
2 个评论
Anand
2014-2-18
As I mentioned before, GPU performance is highly dependent on the GPU card you have. I tried an image of the same size and datatype on my machine and got a 10x speedup over the CPU.
Also, there is usually a start up cost for the first time you execute a GPU function. So, you will find that the first call to a function is considerably slower than the rest. I'm guessing your second run of the script is faster.
Look at some of the pointers regarding performance at the end of this post:
GPU functions tend to execute asynchronously from the CPU in that a command is sent to the GPU and MATLAB execution moves forward without waiting. The wait function waits till the GPU returns before moving ahead. Hence for performance measurements, this is important for GPU code.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!