Hello

I'm using julia to do some fft in for loops and I notice that julia fft is 
slower than matlab fft 2.18s for matlab and 3.06s for julia.

I did some test to see what's going on.

I first used the FFTW.set_num_threads(n) to spead up the code tat I'm using 
and noticed that the code was slower with 4 threads than with 1. But not 
that much.

I was thinking that the FFTW.set_num_threads(n) had a bug and I did this 
code to check it

nbp = 2^12;

M = rand(nbp,nbp);

println("Threds 1")
FFTW.set_num_threads(1)
@time fft(M)


println("Threds 2")
FFTW.set_num_threads(2)
@time fft(M)


println("Threds 3")
FFTW.set_num_threads(3)
@time fft(M)


println("Threds 4")
FFTW.set_num_threads(4)
@time fft(M)

after the second run I got good result

 Threds 1
  2.213230 seconds (76 allocations: 512.003 MB, 2.06% gc time)
Threds 2
  1.926431 seconds (76 allocations: 512.003 MB, 0.31% gc time)
Threds 3
  1.716771 seconds (76 allocations: 512.003 MB, 0.22% gc time)
Threds 4
  1.695626 seconds (76 allocations: 512.003 MB, 0.20% gc time)

So everything is fine with the FFTW threads.


but if I do the same fft on matlab I have 

>> nbp = 2^12;

M = rand(nbp,nbp);
>> tic; fft(M); toc
Elapsed time is 1.008783 seconds.
>> tic; fft(M); toc
Elapsed time is 0.154519 seconds.


So maybe I did something wrong because I don't understand why julia is 
slower than matlab (the julia dev say that it's a faster language).
And more than that julia and matlab use the same FFTW no? so why this time 
difference?

Maybe some one have a idea or an explanation.

Thank you in advance.

PS: I know that there is the plan_fft() function but I don't want to use it 

Reply via email to