Code covered by the BSD License  

Highlights from
FFTmt

4.83333

4.8 | 6 ratings Rate this file 2 Downloads (last 30 days) File Size: 5.53 KB File ID: #12038

FFTmt

by Jerome Genest

 

23 Aug 2006

Performs vectorized FFT on multiple processors using pthreads

| Watch this File

File Information
Description

This mex file implements vectorized FFTs on multiple threads. When a matrix is passed to FFTmt, it is divided in "numCPU" and each fraction of the problem is executed in a separate thread

Example: if numCPU = 2 and the matrix has 256x2^14 elements, 128 FFTs are performed in each thread, allowing the OS to distribute the load on 2 processors.

A single FFT will not be accelerated by this code.
The FFTw library already provides provision for that but the is not currently used by Matlab, see www.fftw.org for details.

The same FFT library than Matlab uses is employed so that we don't even have to link against the FFTw lib.

Developed with pthreads, so UNIX only, not for Windows,

Acknowledgements
This submission has inspired the following:
FFTmtX
MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
25 Aug 2006 igor scardanzan

super idea

28 Aug 2006 Ulrich Wirleitner

PRETTY COOL!
just tried to compile it on WINDOWS XP:
using pthread for win32 from http://sources.redhat.com/pthreads-win32/ V2.7.0
I also had to download fftw3 from http://www.fftw.org/install/windows.html (don't know how to link to the matlab internal fftw3)
I used VC 7.1 to create the fftw3-lib's (read fftw for windows installation).
Don't forget to tell mex where to find the lib's.

RESULT: it worked!
And it is faster in every case: (Factor 1.07 up to 1.46)

BUT the best is: I don't even tried it on a multicore CPU, just a Pentium-M 1.5 GHz Dothan 2MB Cache. Probably this is because of the newer FFTW library and not the thread advantage. Can sombody try it with a multicore CPU?

30 Aug 2006 abady abd  
05 Sep 2006 Ulrich Wirleitner

Update for Win-XP-Version:

I could try it now on a AMD X2 DualCore CPU:
Speed up factor is about 1.6 up to 2.2. (using included test file).

Using 2D-FFT on 1MPix random images I could reach a factor of about 2.6, compiled version about 2.8 (!) compared to MATLAB R2006a internal fft. Could not try R2006b yet.

There is also a small numeric difference (or error?) between both FFT's which probably result from two different FFTW-Versions?

Hopefully FFTW's Multi-Core Support will be included in future MATLAB releases...

24 Oct 2006 jeff fessler

I compiled it on a quad dual-core opteron box
with ncpu=8 and got only 1.8 to 2.5x speedup.
maybe the test routine doesn't have a big
enough example to illustrate the benefits of
so many cores. what i really want is to
speed up a single FFT.

05 Jan 2007 John Iversen

Great! I've been using it on 4core intel Mac Pro for several months now, with up to ~3x speed gains. Gain increases with matrix size of course. Empirically, I've found for matrices with < 2^15 elements, the builtin matlab fft is faster.

I've also adapted a single-precision version, which has even larger speed gains. I will post this at some point, but email me now if you'd like it.

16 Sep 2008 fritz däumler

Great... but have problems with 64bit windows compile... someone has an working pthread-win32 compile for 64 bit windows?

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
dsp Jerome Genest 22 Oct 2008 08:35:34
fft multiple processors threads Jerome Genest 22 Oct 2008 08:35:34

Contact us at files@mathworks.com