Skip to content

Unstable imfilter! execution time with variable FFTW threads #246

@IanButterworth

Description

@IanButterworth

I'm assuming this is due to FFTW's auto planning making different decisions. If so, it would be good to expose the plan settings, if possible.

I'm seeing unexplained significant slowdown in imfilter! on some different data sizes, and I'm wondering whether this is the culpret.

julia> v1 = rand(Float32, 100, 100, 100);

julia> v2 = rand(Float32, 100, 100, 100);

julia> for t in 1:16
              FFTW.set_num_threads(t)
              @info "FFTW: $t"
              @btime imfilter!($v2, $v1, $(centered(Kernel.gaussian((1, 1, 10)))), "symmetric", Algorithm.FFT());
          end
[ Info: FFTW: 1
  31.118 ms (172 allocations: 64.69 MiB)
[ Info: FFTW: 2
  22.252 ms (335 allocations: 64.70 MiB)
[ Info: FFTW: 3
  17.866 ms (380 allocations: 64.70 MiB)
[ Info: FFTW: 4
  16.727 ms (419 allocations: 64.70 MiB)
[ Info: FFTW: 5
  16.070 ms (463 allocations: 64.71 MiB)
[ Info: FFTW: 6
  14.941 ms (505 allocations: 64.71 MiB)
[ Info: FFTW: 7
  212.458 ms (1171542 allocations: 134.28 MiB)
[ Info: FFTW: 8
  215.672 ms (1171782 allocations: 134.29 MiB)
[ Info: FFTW: 9
  214.504 ms (1171885 allocations: 134.29 MiB)
[ Info: FFTW: 10
  213.847 ms (1171566 allocations: 134.29 MiB)
[ Info: FFTW: 11
  213.470 ms (1172045 allocations: 134.30 MiB)
[ Info: FFTW: 12
  213.978 ms (1170869 allocations: 134.27 MiB)
[ Info: FFTW: 13
  17.095 ms (2094 allocations: 64.81 MiB)
[ Info: FFTW: 14
  15.242 ms (848 allocations: 64.74 MiB)
[ Info: FFTW: 15
  15.483 ms (889 allocations: 64.74 MiB)
[ Info: FFTW: 16
  15.473 ms (1182 allocations: 64.76 MiB)

With the mkl backend the bump doesn't occur and performance increases gradually with FFTW.jl threads

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions