Efficient self-referential loop using GPU
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have lots of problems using for in GPU computing becuse it take a huge amount of time (as u know). My kind of loop is particular because the step n depends from n-1 n-2 .... n-m. Here is the code which gives the idea of problem:
len_1=100000;
len_2=8;
X=zeros([1,len_1]);
X(1)= 1;
for k=1:len_1
for p=0:min(k-1,len_2)
X(k+1)=X(k+1)+j(p+1)*X(k-p)
end
end
For CPU is all ok but if I put
X=gpuArray(X);
I have trouble with time. I tried using arrayfun but thre is no way to realize the "previous-steps-dependence". So please help me.
0 comentarios
Respuestas (1)
Chandani Madnani
el 27 de Feb. de 2018
What is 'j' in this line X(k+1)=X(k+1)+j(p+1)*X(k-p) ? What is the exact code that you have tried ? Any error messages while using gpuArray ?
1 comentario
Ver también
Categorías
Más información sobre GPU Computing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!