gpuArray performance on 'xcorr' function
Ältere Kommentare anzeigen
Hi,
I am tring to improve a performance on my script, which is using 'xcorr' function heavily.
I found that 'xcorr' function supports gpuArray and I tried it. However, it seems the performance is not good.
I did three simple examples
t = 0:0.001:10-0.001;
x = cos(2*pi*10*t) + randn(size(t));
X = gpuArray(x);
tic
[r,lags] = xcorr(X,X,'normalized');
r = gather(r);
toc
% Elapsed time is 0.017178 seconds.
t = 0:0.001:10-0.001;
x = cos(2*pi*10*t) + randn(size(t));
tic
[r,lags] = xcorr(x,x,'normalized');
r = gather(r);
toc
% Elapsed time is 0.004627 seconds.
t = 0:0.001:10-0.001;
x = cos(2*pi*10*t) + randn(size(t));
X = gpuArray(single(x));
tic
[r,lags] = xcorr(X,X,'normalized');
r = gather(r);
toc
% Elapsed time is 0.015555 seconds.
just normal array is much faster than gpuArray.

For 'single' type data, GPU is much faster!
What should I do to increase the performance on 'xcorr' function?
(I have several thousond of array and each array has 10k elements.)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Correlation and Convolution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!