JuliaMath / JuliaMath/FFTW.jl

PATIENT and EXHAUSTIVE plans v slow compared to MEASURE

Open
#239 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
300
Forks
61
PR merge metrics
No merged PRs in 30d

Description

These timings are surprising to me.

It seems that MEASURE is using the fastest plan, but the other flags are not. The others don't know about threads, judging by cpu usage.

Is this expected, or am I not using this correctly?

Also PATIENT and EXHAUSTIVE are not saving on allocations?

```julia
using FFTW, BenchmarkTools
N = 512
A = randn(ComplexF64,N,N)
B = copy(A)

## measure
FFTW.forget_wisdom()
FFTW.set_num_threads(8)

P = plan_fft(A,flags=FFTW.MEASURE);
@btime $P*$A;
1.409 ms (138 allocations: 4.01 MiB)

P! = plan_fft!(A,flags=FFTW.MEASURE);
@btime $P!*$B setup=(B .= A);
1.401 ms (137 allocations: 9.56 KiB)
```

```julia
## patient
FFTW.forget_wisdom()
FFTW.set_num_threads(8)

P = plan_fft(A,flags=FFTW.PATIENT);
@btime $P*$A;
458.462 ms (113592 allocations: 11.24 MiB)

P! = plan_fft!(A,flags=FFTW.PATIENT);
@btime $P!*$B setup=(B .= A);
914.090 ms (226997 allocations: 14.46 MiB)

```

```julia

## exhaustive
FFTW.forget_wisdom()
FFTW.set_num_threads(8)

P = plan_fft(A,flags=FFTW.EXHAUSTIVE);
@btime $P*$A;
500.417 ms (124745 allocations: 11.94 MiB)

P! = plan_fft!(A,flags=FFTW.EXHAUSTIVE);
@btime $P!*$B setup=(B .= A);
919.095 ms (227010 allocations: 14.46 MiB)
```

This is on

```julia
julia> versioninfo()
Julia Version 1.8.0-beta3
Commit 3e092a2521 (2022-03-29 15:42 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin21.3.0)
CPU: 10 × Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
Threads: 8 on 8 virtual cores
Environment:
JULIA_PKG_DEVDIR = /Users/abradley/Dropbox/Julia/Dev
JULIA_NUM_THREADS = 8
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.