How to execute fft's with gpu,cuda in parallel (spmd)?

I have IxJxL single type data volume. I want to execute 1-D fft's of L length IxJ times.
Win7-64,GFX670,MatlabR2012a
data_device = gpuArray(data);
Nested 'for' loop on GPU works slower than on CPU.
for ii = 1:I
for jj = 1:J
data_device(ii,jj,:) = fft(data_device(ii,jj,:));
end
end
'Parfor' works even slower than simple 'for' loop.
1 Is there a way to use spmd method on GPU alike its done on CPU? How?
2 What is the optimal size of data to be send to GPU, considering params gpuDevice() function retuns?

 Accepted Answer

MATLAB's FFT function can operate along any single dimension. So you can simply do:
data_device = fft(data_device, [], 3);
rather than having a loop. See the FFT reference page for more.

3 Comments

Greg
Greg on 12 Jun 2013
Edited: Greg on 12 Jun 2013
Very true, indeed, thank you!
Still, Edric, GFX670 has 7 cores, so I thought, I could split data_device matrix into 7 smaller matrices, so each core would work on its own fft(data_device_(1/7)_part, [], 3); in parallel... Is that possible?
Hi Greg, assuming you mean a GTX670, it actually has 1344 cores (7 processors, each with 192 cores). However, you cannot address a core individually. Infact you can't even address a processor individually. You need to send the GPU one big operation to perform and let it work out how to split it over the heirarchy of symmetric multi-processors and the cores they contain.
Our recommendation is always to send as much work (and data) in a single command as you can.
Ben, thanks a lot.

Sign in to comment.

More Answers (0)

Categories

Find more on Parallel Computing in Help Center and File Exchange

Asked:

on 12 Jun 2013

Community Treasure Hunt

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

Start Hunting!