Tesla GPU compute interpolation optimisation
2 次查看(过去 30 天)
显示 更早的评论
Good day all,
I have a piece of code from a image processing algorithm which runs the interp2 command as its main function. To speed up the evaluation of interp2 I have written the code that its inputs are all gpu arrays. This allows interp2 to execute as a gpu optimised function. There are a total of 2500 images to be analysed and even though 'gpuArray' has sped up the process, it is still a bit too slow. I have noticed that the code still evaluates each image one by one rather than a large portion in parallel which should be the beauty behind gpu compute. Is there a way to evaluate all 2500 images in parallel aka in one big batch? I have a Tesla K20c with 2496 CUDA cores. Any help would be very appreciated.
Here is the code:
%%%if true %%%
function [Ii,Ii1d, xaxisi, yaxisi] = speclet_GUI_v2(I, X, Y, x_axis_interp, y_min, y_max, ysize, method)
if (y_max-y_min)<1
[xi, yi] = gpuArray(meshgrid(x_axis_interp, (y_max+y_min)/2));
else
dy = abs(y_max - y_min)/(ysize-1);
[xi, yi] = meshgrid(x_axis_interp, y_min:dy:y_max);
end
% I = gpuArray(I);
% X = gpuArray(X);
% Y = gpuArray(Y);
% interpolate
Ii = interp2(X,Y,I,xi,yi,'linear');
% extract 1d data averaging along columns
Ii1d = mean(Ii,1);
xaxisi = xi(1,:);
yaxisi = yi(:,1)'; %both are row vectors
end
3 个评论
Joss Knight
2017-7-18
It'll do as much as you can fit into memory. Yes, interpn supports gpuArray inputs.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!