Parallel looped interp1 on GPU
Mostrar comentarios más antiguos
I have a set of data where I am interpolating each row onto a different 2-D grid using interp1. I have been using gpuArray to run interp1 using a for loop (which gives me good speed), but since this is a series of independent parallel computations I was hoping for a way to parallelize the operation on the GPU.
I am including a minimum working example. The idea is to remove the for loop and run the interp1 calculations in parallel. Note that the actual datasets will be much larger, so yes the for loop would be great to toss.
%%InterpLoop MWE
Data = gpuArray(rand(100,1000));
x = 1:1000;
y = 1:100;
[X,Y] = meshgrid(x,y);
Xq = X-Y;
imagesc(Xq);
Vqs= cell(100,1);
x = gpuArray(x);
Xq = gpuArray(Xq);
for ii = 1:100
Vqs{ii} = interp1(x,Data(ii,:),Xq+x(ii),'linear',0);
end
Note also that storing the interpolated data in a cell array is also optional. The goal is parallel gpu loop over interp1 operations from 1-D to 2-D grid where the grid varies.
Side question, if somebody knows of an interp1 fast code that will do spline interpolation on the GPU I would love to know about it, interp1 only supports linear and nearest on gpuArray.
Respuesta aceptada
Más respuestas (1)
Jan
el 19 de Mzo. de 2016
1 voto
Categorías
Más información sobre GPU Computing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!