gpuArray performance on 'xcorr' function
Mostrar comentarios más antiguos
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.)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Correlation and Convolution en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!