Tesla GPU compute interpolation optimisation

조회 수: 2 (최근 30일)
Tobias Reichold
Tobias Reichold 2017년 7월 17일
댓글: Joss Knight 2017년 7월 18일
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
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개)

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by