필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Is there a way to speed up gpuarray loop?

조회 수: 1 (최근 30일)
Mantas Vaitonis
Mantas Vaitonis 2018년 6월 18일
마감: Mantas Vaitonis 2018년 7월 5일
Dear All,
I am stuck in the folowing function. I would like to speed up this calculation for GPU, unfortunately now it is very slow.
clear;
p1=[1 2 2 5 4];
idx2=[1 3 4]
idx1=gpuArray(idx2);
p=gpuArray(p1);
tic
for k1=1:1000
cc=p(p);
for i=1:5
k=any(p(i)==idx1);
k1=any(cc(i)==idx1);
k3=idx1(cc(i)==idx1);
%[idxx]=arrayfun(@testas,k,k1,k3,bb(i));
idx1(cc(i)==idx1)=i;
end
end
toc
cc=p(p) is inside the loop, because in my algorithm it would change during every iteration.
  댓글 수: 2
KSSV
KSSV 2018년 6월 18일
You need to check whether using gpu array is necessary? Computations on GPU will be faster if your data is huge. For less data, GPU simulations tend to be slower than CPU. First check the same with CPU and compare times with GPU.
Mantas Vaitonis
Mantas Vaitonis 2018년 6월 18일
The data needed to compute is quite big, for example matrix of size 5000000x100. Thus k1 is the size of 5000000 and i =100. I am trying to move speed sensitive functions to GPU in order to speed up whole algorithm.

채택된 답변

Mantas Vaitonis
Mantas Vaitonis 2018년 6월 19일
Did find a sollution using cellfun.

추가 답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by