In Julia, fft of a matrix is a 2-d transform. I think the corresponding fft 
function in matlab just takes the 1-d fft of the columns. This might 
explain part of the discrepancy. 

On Friday, June 17, 2016 at 8:24:48 PM UTC-7, Logan Williams wrote:
>
> A small improvement, but still much slower than Octave.
>
> julia> R = rand(512,512)
>
> julia> @time rfft(R);
>
>   0.012027 seconds (93 allocations: 2.012 MB)
>
>
> julia> R = rand(5000,5000);
>
> julia> @time rfft(R);
>
>   1.461964 seconds (99 allocations: 190.816 MB, 1.16% gc time)
>
>
> Unfortunately, I don't know exactly how many threads Octave uses by 
> default.
>
>
> Logan
>
> On Friday, June 17, 2016 at 8:04:49 PM UTC-7, Scott Jones wrote:
>>
>> Your processor can handle 4 simultaneous threads with HyperThreading.
>> What are your results if you try setting the number of threads to 4?
>> Do you know how many threads Octave uses for FFTW on your machine?
>>
>> -Scott
>>
>> On Friday, June 17, 2016 at 3:01:45 PM UTC-4, Logan Williams wrote:
>>>
>>> Followup: setting FFTW.set_num_threads(2) (my machine only has two 
>>> cores) and using rfft closes the gap somewhat, but there's still a 
>>> substantial difference.
>>>
>>> julia> R = rand(5000,5000);
>>>
>>> julia> @time rfft(R);
>>>
>>>   1.736385 seconds (99 allocations: 190.816 MB, 0.95% gc time)
>>>
>>>
>>> julia> R = rand(512,512);
>>>
>>> julia> @time rfft(R);
>>>
>>>   0.018692 seconds (93 allocations: 2.012 MB)
>>>
>>>
>>>
>>> On Friday, June 17, 2016 at 11:56:44 AM UTC-7, Logan Williams wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm finding that a 2D FFT in Julia is an order of magnitude slower than 
>>>> GNU Octave. Does anyone know why this is happening?
>>>>
>>>> Thanks,
>>>> Logan
>>>>
>>>> In Octave:
>>>>
>>>> >> R = rand(512,512);
>>>> >> tic; fft2(R); toc;
>>>> Elapsed time is 0.00377011 seconds.
>>>>
>>>> In Julia:
>>>>
>>>> julia> R = rand(512,512);
>>>>
>>>> julia> @time fft(R);
>>>>
>>>>   0.042149 seconds (76 allocations: 8.003 MB)
>>>>
>>>>
>>>> In Octave with non-power of 2 size:
>>>>
>>>>
>>>> >> R = rand(5000,5000);
>>>>
>>>> >> tic; fft2(R); toc;
>>>>
>>>> Elapsed time is 0.556037 seconds.
>>>>
>>>>
>>>> In Julia with non-power of 2 size:
>>>>
>>>>
>>>> julia> R = rand(5000,5000);
>>>>
>>>> julia> @time fft(R);
>>>>
>>>>   6.212666 seconds (76 allocations: 762.943 MB, 1.17% gc time)
>>>>
>>>

Reply via email to