Tesla GPU compute interpolation optimisation

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
Joss Knight 2017 年 7 月 18 日
Have you tried just concatenating the images along dim 3 and calling interpn?
Tobias Reichold
Tobias Reichold 2017 年 7 月 18 日
Hi Mr Knight,
I have not considered that option yet. Will this run all 2500 images in parallel? Is interpn also GPU compatible?
Joss Knight
Joss Knight 2017 年 7 月 18 日
It'll do as much as you can fit into memory. Yes, interpn supports gpuArray inputs.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGPU Computing についてさらに検索

質問済み:

2017 年 7 月 17 日

コメント済み:

2017 年 7 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by