Suppose you're going to be working with a 864 x 729 array of Float32s, and you 
want the rfft. Then just do this:

A = rand(Float32, 864, 729)
f = plan_rfft(A, (1,2), FFTW.PATIENT, 20)

This will devote up to ~20s testing different algorithms to compute the rfft. 
Now say B has some data you actually care about. Then 

Bfft = f(B)

will compute the same transform.

While the function f is useful, keep in mind that within this julia session, 
all future transforms of this particular element type and size will make use 
of the best algorithm found. So even if you say

Bfft = rfft(B)

you'll still get most of the benefit of planning.

--Tim

On Wednesday, June 18, 2014 02:30:29 PM Ethan Anderes wrote:
> Hi Tim:
> 
> Do you happen to know where I can find some documentation or code snippets
> on using FFTW.MEASURE or FFTW.PATIENT? I also have some performance
> critical code that I've failed to speed up with plan_fft and plan_ifft.
> After reading your suggesting I tried to search for info on FFTW.MEASURE or
> FFTW.PATIENT but couldn't really find anything (I can't follow the source
> code either).
> 
> Any help would be greatly appreciated.
> 
> Cheers,
> Ethan
> 
> On Wednesday, June 18, 2014 4:40:10 AM UTC-7, Tim Holy wrote:
> > Have you profiled it? Is most of the time spent in the ffts? Assuming it
> > is the
> > ffts that dominate, try preplanning with FFTW.MEASURE or FFTW.PATIENT.
> > 
> > I seem to recall that some months ago I posted some Matlab/Julia FFT
> > benchmarks to one of the mailing lists or the github repository. I suspect
> > that Matlab has some clever tricks up their sleeve for fft-planning---they
> > seem
> > to be able to settle on a good algorithm with much less time than I find I
> > need
> > with FFTW.MEASURE or FFTW.PATIENT. It would be lovely to figure out a
> > better
> > approach; with 3d FFTs I often find that to get good performance I need to
> > devote about 60s to planning for each different size I run, which is a bit
> > of a
> > pain.
> > 
> > --Tim
> > 
> > On Wednesday, June 18, 2014 03:35:06 AM Oliver Lylloff wrote:
> > > Hello all,
> > > 
> > > I'm computing a 2D convolution with fft and seeing a timing difference
> > > between Matlab and Julia, with Matlab being about 2x faster than Julia.
> > > I've simplified my code down to an example (see gist here:
> > > https://gist.github.com/1oly/51f39a831cef3931e7b8). The bottleneck of
> > 
> > my
> > 
> > > code is evaluating the function
> > > 
> > > function func(b,x,Fps)
> > > 
> > >     r = fftshift(ifft(fft(x).*Fps)) - b;
> > >     return r
> > > 
> > > end
> > > 
> > > Timings are after one initial run to remove overhead and Matlab is
> > 
> > single
> > 
> > > thread.
> > > 
> > > Matlab (-singleCompThread) = 0.0026s
> > > Julia = 0.005s
> > > 
> > > Does other people see this difference as well? Any suggestions to
> > 
> > possible
> > 
> > > speed-ups?
> > > 
> > > Best,
> > > Oliver

Reply via email to