MATLAB: Parallel looped interp1 on GPU

gpuarrayinterp1parallel computing

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.

Best Answer

The best way to parallelize multiple 1D interpolations is to use 2D interpolation, and just set the Y interp point to (1:M)', i.e:
Vqs = interp2(x, Data, Xq+x, (1:100)', 'linear', 0);