필터 지우기
필터 지우기

rdivide and minus operation runs faster on GPU than rdivide alone.

조회 수: 1 (최근 30일)
Laszlo Kormoczi
Laszlo Kormoczi 2018년 7월 27일
편집: Laszlo Kormoczi 2018년 7월 27일
I am experimenting with GPU and the runtime is interesting for two test functions.
Input in both cases:
d = rand(1,100000000,'single','gpuArray');
b = rand(1,1,'single','gpuArray');
First function:
function d = gputest1(d,b)
tic
for i=1:10000
d=d./(d-b);
end
wait(gpuDevice)
toc
end
Second:
function d = gputest2(d,b)
tic
for i=1:10000
d=d./b;
end
wait(gpuDevice)
toc
end
I expect longer runtime for gputest1 because it has to do two operations in one iteration, but the measured runtime is 12 s for gputest1, and 27 s for gputest2. Does anyone have an explanation for this?
Tests are performed on a GTX 1060 6GB (CPU: i7-7700, RAM: 32 GB).
  댓글 수: 3
Prabhakar
Prabhakar 2018년 7월 27일
Which version of MATLAB are you running?

댓글을 달려면 로그인하십시오.

답변 (1개)

Prabhakar
Prabhakar 2018년 7월 27일
Try varying the size of the inputs. Reducing the size of the input from 1e8 to 1e5 shows expected behavior. (ie gpuTest2 being faster than gpuTest1.)
Performance is probably being dictated by the amount of memory being fetched vs the amount of work being carried out in each kernel.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by