[SciPy-dev] threaded fftw + blitz + weave

M Trumpis mtrumpis@berkeley....
Thu Jul 16 19:23:08 CDT 2009


I just finished reworking some code I wrote a while ago that drives
FFTW in parallel for repeated transforms. My original code only
operated in a restrictive manner, but I finally got around to letting
it run in arbitrarily strided arrays. The idea is to plan an FFT of a
certain structure on one thread, and then split the data up and apply
the plan on multiple threads. (Since I work with images and like my
arrays to be centered at N/2, my implementation has the threads do
some change of variables magic with hairy strided pointer
walking--more memory efficient than fftshift.)

I'm wondering if people think this could be useful, and if it would be
a small effort to bring it to scipy?

here's a look at the c++ code and the weave wrapping
https://cirl.berkeley.edu/trac/browser/bic/branches/rtools_weave/root/recon/fftmod/src/blitz_ffts.cc
https://cirl.berkeley.edu/trac/browser/bic/branches/rtools_weave/root/recon/fftmod/__init__.py

The code is definitely working and passes comparison tests within
reasonable accuracy. That said, it's sure to be rough around the edges
(I'm not terribly careful coding in C++).

Has:

*If an N-D array is to be split up into T transforms (of any rank R <=
N), and T can be split evenly into P threads, then the tool
parallelizes the fft calls

*inplace and out of place xforms

*shifted or non-shifted xforms

Hasn't:

*no Microsoft threads (no clue how they work)
*no real-to-complex or c2r transforms
*no fftw plan caching -- other than what the fftw libs keep persistent
*may not work for negatively strided arrays.. haven't checked
*definitely won't work for funky strides (==0) of course


More information about the Scipy-dev mailing list