gpuArray takes more time than CPU - imrotate
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Anand
on 18 Feb 2014
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 Comments
Anand
on 18 Feb 2014
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.
See Also
Categories
Find more on GPU Computing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!