Skip to content

cmake: Link Octopus to FFTW-MPI when PFFT is found

Ensure Linking Occurs when Using PFFT

Octopus does not use FFTW-MPI, but pfft requires it. Unfortunately, pfft's build system does not find or link to FFTW-MPI.

This is addressed by having Octopus check FFTW-MPI is found when PFFT is also found, and subsequently links FFTW-MPI to Octopus. cmake does not allow one to directly modify imported targets i.e. pfft::pfft, hence why I'm linking FFTW-MPI to Octopus rather than directly to PFFT.

This closes issue 1092.

Reproducing This Test with Octopus Spack GCC Toolchains

Env

module purge
module load toolchain/foss2023a-mpi
module load octopus-dependencies/full
module rm pnfft/1.0.7-alpha
unset CPATH 
unset LIBRARY_PATH

Configure and build

export FFLAGS=-fno-var-tracking-assignments
cmake --preset ci-foss-min-mpi --fresh -DCMAKE_REQUIRE_FIND_PACKAGE_pfft=On -DCMAKE_DISABLE_FIND_PACKAGE_pfft=Off -Wno-deprecated
cmake --build cmake-build-ci-foss-min-mpi -j

Testing pfft is found when requesting pnfft with GCC

module purge
module load toolchain/foss2023a-mpi
module load octopus-dependencies/full
module rm pfft/1.0.7-alpha
unset CPATH 
unset LIBRARY_PATH

export FFLAGS=-fno-var-tracking-assignments
cmake --preset ci-foss-min-mpi --fresh -DCMAKE_REQUIRE_FIND_PACKAGE_pnfft=On -DCMAKE_DISABLE_FIND_PACKAGE_pnfft=Off -Wno-deprecated

TODOs:

  • Test linking when pfft and MKL are used
  • Add a check that pfft is found when using pnfft
    • This is already handled in Findpnfft.cmake, but I've made the error message clearer.

Issue Linking PFFT to MKL's FFTW

This is unresolved, and documented in issue #1167

Edited by Alex Buccheri

Merge request reports

Loading