Loading FastTransforms.jl can make FFTs via FFTW.jl 100x slower due to threading conflicts

Offen
#267 0 Kommentare 2 Reaktionen 2 zugewiesene Personen Auf GitHub ansehen

@dlfivefifty arbeitet bereits daran.

Seit 10.7.2026.

  • #270 von @copilot-swe-agent — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

While this is not a self-contained example, I would like to summarize an issue I had so that others may find it (and my workaround) when they search for it.

Loading FastTransforms.jl (import FastTransforms or using FastTransforms or loading a package depending on FastTransforms.jl) made some FFTs (of small real vectors with 256 to 4096 entries) via FFTW.jl roughly 100x slower on my system (when running Julia with one thread). Debugging this via the profiling tools showed that a huge amount of time was spent in __psynch_cvwait and __psynch_cvsignal. The reason appears to be

https://github.com/JuliaApproximation/FastTransforms.jl/blob/14a311816ffb58131ee09d7d6bf3cc50793dfc6a/src/libfasttransforms.jl#L15-L20

Reversing these settings by executing

FastTransforms.ft_set_num_threads(1)
ccall((:ft_fftw_init_threads, FastTransforms.libfasttransforms), Cint, ())
FastTransforms.ft_fftw_plan_with_nthreads(1)

after loading FastTransforms fixed the performance issue.

Vorherrschende Sprache
Julia
Sterne
284
Forks
28
Ø Merge
9 Std. 21 Min.
Gemergte PRs (30 T.)
2

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus JuliaApproximation/FastTransforms.jl

Alle Issues in JuliaApproximation/FastTransforms.jl

Ähnliche Issues

Weitere Issues zu Julia

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.