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!