Skip to content

Fix: AMReX w/ OpenMP and Ignore FFTW OMP#4941

Merged
ax3l merged 2 commits intoAMReX-Codes:developmentfrom
ax3l:fix-fftw-noomp-womp
Feb 12, 2026
Merged

Fix: AMReX w/ OpenMP and Ignore FFTW OMP#4941
ax3l merged 2 commits intoAMReX-Codes:developmentfrom
ax3l:fix-fftw-noomp-womp

Conversation

@ax3l
Copy link
Copy Markdown
Member

@ax3l ax3l commented Feb 6, 2026

Summary

In some corner cases, we sometimes work around broken FFTW installs: for some (temporary) reason we cannot have any threading in FFTW, neither with OpenMP nor threads.

In those cases, when we still want to thread the rest of AMReX with OpenMP, we can set our AMReX transitive FFTW OpenMP requirements explicitly off, e.g., via CMake -DAMReX_FFTW_IGNORE_OMP=ON. But this is not yet implemented consistently and since #4861 exposes undefined FFTW symbols when used.

This enables this work-around.

  • macro
  • CMake
  • GNUmake
  • AMReX_Config.H

Additional background

#4861 (comment)

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@WeiqunZhang
Copy link
Copy Markdown
Member

What about the call to fftw_plan_with_nthreads? If we are not using OMP, how many threads to use?

@WeiqunZhang
Copy link
Copy Markdown
Member

Okay this is confusing. Could you summarize what we are trying to support? AMReX may be built with or without OMP. FFTW on the system may or may not support threading. If it does support threading, it may or may not be OMP. In all the combinations, we do we do?

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 7, 2026

Oh yes, fftw_plan_with_nthreads needs a guard as well

@ax3l
Copy link
Copy Markdown
Member Author

ax3l commented Feb 7, 2026

Okay this is confusing. Could you summarize what we are trying to support? AMReX may be built with or without OMP. FFTW on the system may or may not support threading. If it does support threading, it may or may not be OMP. In all the combinations, we do we do?

In #4861 we decided it might be ok to default to require that FFTW supports threading if AMReX is build with OpenMP support, because other behavior is confusing for users.

I now found a corner case on conda-forge and in a CI runner where I cannot have, temporarily (I hope), FFTW with OpenMP nor threads. To now build I am forced to either disable all FFT support or all OpenMP support of AMReX.

In CMake, I had anticipated this a bit in the past by adding an opt-in AMReX_FFTW_IGNORE_OMP option, saying: I, the user, bulding AMReX with OpenMP, know that my FFTs will be slow and unthreaded, but do it nonetheless. But I forgot that we need to add support for this control in GNUmake and macros when we merged #4861 .

@ax3l ax3l changed the title Fix: AMReX w/ OpenMP and Ignore FFTW OMP [WIP] Fix: AMReX w/ OpenMP and Ignore FFTW OMP Feb 7, 2026
@ax3l ax3l force-pushed the fix-fftw-noomp-womp branch from 7624dc4 to c50ece1 Compare February 10, 2026 06:47
@ax3l ax3l changed the title [WIP] Fix: AMReX w/ OpenMP and Ignore FFTW OMP Fix: AMReX w/ OpenMP and Ignore FFTW OMP Feb 10, 2026
In some corner cases, we sometimes work around broken FFTW
installs. In those, we build with OpenMP but set FFTW
OpenMP requirements to off explicitly.

This enables this work-around.
@ax3l ax3l force-pushed the fix-fftw-noomp-womp branch from c50ece1 to 932a04d Compare February 10, 2026 06:49
@ax3l ax3l merged commit 6229666 into AMReX-Codes:development Feb 12, 2026
74 checks passed
@ax3l ax3l deleted the fix-fftw-noomp-womp branch February 12, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants