-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FFTW: Windows, OMP & Floats #4282
FFTW: Windows, OMP & Floats #4282
Conversation
42266ed
to
52657d2
Compare
76faf17
to
877129a
Compare
This improves the FFTW CMake find logic based on the scripts that I developed for HiPACE++/WarpX/ImpactX to find FFTW on various platforms. It helps to find FFTW on Windows, where it is installed by default with CMake, and it uses more details from PkgConfig files on Linux/macOS, such as forwarding defines, using OpenMP acceleration if available, customizing floating point variants for SINGLE/DOUBLE precision builds. It also chooses sensible defaults to work around known FFTW build system bugs, linked inline.
877129a
to
19d2e44
Compare
We could make the cached plans a static variable of |
19d2e44
to
3b40c05
Compare
FFTW can be built in multiple precisions, but we will only use one at a time with `amrex::Real`. Pick the one we really use, do not require more than that. This will simplify specifications and requirements in package management.
3b40c05
to
b4fb4bc
Compare
We want to support both double and float regardless of the type of amrex::Real. |
So could you revert that part of the changes? |
I think for that to work we need to make the search more general. We can only support f and d at the same time if the FFTW library was actually built for both. Since this is a compile-time option of FFTW, we do not know until we have inspected the FFTW installation location. |
The FFTW install we find can be any combination of supporting one, or a subset of |
Let's see if this does the trick :) |
On my system, I can see both
Do you know what's going on? It does not currently matter, because we are not using the threaded version. |
Interesting, I do call the OpenMP search for each precision. Let me check. |
Good catch! Fixed and verified. |
Summary
This improves the FFTW CMake find logic based on the scripts that I developed for HiPACE++/WarpX/ImpactX to find FFTW on various platforms.
It helps to find FFTW on Windows, where it is installed by default with CMake, and it uses more details from PkgConfig files on Linux/macOS, such as forwarding defines, using OpenMP acceleration if available, customizing floating point variants for SINGLE/DOUBLE precision builds (require only the variant for
amrex::Real
, to keep requirements minimal).It also chooses sensible defaults to work around known FFTW build system bugs, linked inline. There are also options added to control the defaults, e.g., in package managers that use a different default (e.g., CMake FFTW install on Linux/macOS).
Additional background
See build issues in ECP-WarpX/impactx#760 (comment)
On Windows, try searching for
FFTW3(f)Config.cmake
files first, because:.pc
files wrongly and unconditionally add-lm
On Linux & macOS, the Autotools install tries to emulate a CMake config file, but has a bug:
.pc
files because we cannot know which install was choosen (otherwise, there is an option for it namedAMReX_FFTW_SEARCH
).Checklist
The proposed changes: