Skip to content

Class TempLat::FFTWInterface

template <size_t NDim>

ClassList > TempLat > FFTWInterface

A class which implements all of FFTLibraryInterface . The larger methods are implemented in classes from which we inherit, in a linear chain:FFTWMemoryLayout andFFTWPlanner .More...

  • #include <fftwinterface.h>

Inherits the following classes: TempLat::FFTWMemoryLayout

Public Functions

Type Name
FFTWInterface ()
virtual IntrinsicScales getIntrinsicRescaleToGetUnnormalizedFFT (device::Idx nGridPoints)
The lattice objects expect an unnormalized FFT, such as the one FFTW gives: applying once forward and then backward should return the input values multiplied by nGridPoints^nDimensions, i.e. the total number of values in the problem. If your library does not respect that, return the factor by which we must multiply the output values to obtain the unnormalized FFT. Return defaultIntrinsicScales (exact (double) 1) in order not to waste time, if your library does it like FFTW.
virtual device::Idx getMaximumNumberOfDimensionsToDivide (device::Idx nDimensions)
Return the number of dimensions over which the MPI processes can be distributed, given a problem of dimension nDimensions. FFTW can only divide in 1 dimension: the leading dimension. ParaFaFT can divide an N dimensional setup over the leading N - 1 dimensions.

Public Functions inherited from TempLat::FFTWMemoryLayout

See TempLat::FFTWMemoryLayout

Type Name
FFTWMemoryLayout () = default
virtual FFTLayoutStruct< NDim > computeLocalSizes (MPICartesianGroup group, device::IdxArray< NDim > nGridPoints, bool forbidTransposition=false)
given an actual setup, return the description of the subarray of the global problem that this process holds.

Public Functions inherited from TempLat::FFTWPlanner

See TempLat::FFTWPlanner

Type Name
FFTWPlanner ()
virtual std::shared_ptr< FFTPlanInterface< double, NDim > > getPlans_double (const MPICartesianGroup & group, const FFTLayoutStruct< NDim > & layout)
Create fully working plans, which must self-destruct in the PlanInterface's destructor. Use shared_ptr's.
virtual std::shared_ptr< FFTPlanInterface< float, NDim > > getPlans_float (const MPICartesianGroup & group, const FFTLayoutStruct< NDim > & layout)
Create fully working plans, which must self-destruct in the PlanInterface's destructor. Use shared_ptr's.
virtual void setPlannerPatience (int level)
If your library has different levels of patience for the planning phase, set it here.

Public Functions inherited from TempLat::FFTLibraryInterface

See TempLat::FFTLibraryInterface

Type Name
FFTLibraryInterface () = default
virtual FFTLayoutStruct< NDim > computeLocalSizes (MPICartesianGroup group, device::IdxArray< NDim > nGridPoints, bool forbidTransposition=false) = 0
given an actual setup, return the description of the subarray of the global problem that this process holds.
virtual IntrinsicScales getIntrinsicRescaleToGetUnnormalizedFFT (device::Idx nGridPoints) = 0
The lattice objects expect an unnormalized FFT, such as the one FFTW gives: applying once forward and then backward should return the input values multiplied by nGridPoints^nDimensions, i.e. the total number of values in the problem. If your library does not respect that, return the factor by which we must multiply the output values to obtain the unnormalized FFT. Return defaultIntrinsicScales (exact (double) 1) in order not to waste time, if your library does it like FFTW.
virtual device::Idx getMaximumNumberOfDimensionsToDivide (device::Idx nDimensions) = 0
Return the number of dimensions over which the MPI processes can be distributed, given a problem of dimension nDimensions. FFTW can only divide in 1 dimension: the leading dimension. ParaFaFT can divide an N dimensional setup over the leading N - 1 dimensions.
virtual std::shared_ptr< FFTPlanInterface< double, NDim > > getPlans_double (const MPICartesianGroup & group, const FFTLayoutStruct< NDim > & layout) = 0
Create fully working plans, which must self-destruct in the FFTPlanInterface 's destructor. Use shared_ptr's.
virtual std::shared_ptr< FFTPlanInterface< float, NDim > > getPlans_float (const MPICartesianGroup & group, const FFTLayoutStruct< NDim > & layout) = 0
Create fully working plans, which must self-destruct in the FFTPlanInterface 's destructor. Use shared_ptr's. Since we use virtual methods here, we cannot use templates. Only one type of dynamic typing allowed by C++, either runtime (virtual) or compile time (template).
virtual void setPlannerPatience (int level) = 0
If your library has different levels of patience for the planning phase, set it here.
virtual ~FFTLibraryInterface () = default

Public Static Functions

Type Name
FFTDecomposition< NDim > decomposition (MPICommReference baseComm, device::IdxArray< NDim > nGridPoints)
FFTW (including fftw-mpi) uses a slab decomposition: split only the leading dimension.
FFTTopology< NDim > topology (MPICommReference baseComm, device::IdxArray< NDim > nGridPoints)
The MPI topology FFTW-MPI will use.

Detailed Description

Unit test: ctest -R test-fftwinterface

Public Functions Documentation

function FFTWInterface

inline TempLat::FFTWInterface::FFTWInterface () 

function getIntrinsicRescaleToGetUnnormalizedFFT

The lattice objects expect an unnormalized FFT, such as the one FFTW gives: applying once forward and then backward should return the input values multiplied by nGridPoints^nDimensions, i.e. the total number of values in the problem. If your library does not respect that, return the factor by which we must multiply the output values to obtain the unnormalized FFT. Return defaultIntrinsicScales (exact (double) 1) in order not to waste time, if your library does it like FFTW.

inline virtual IntrinsicScales TempLat::FFTWInterface::getIntrinsicRescaleToGetUnnormalizedFFT (
    device::Idx nGridPoints
) 

Implements TempLat::FFTLibraryInterface::getIntrinsicRescaleToGetUnnormalizedFFT


function getMaximumNumberOfDimensionsToDivide

Return the number of dimensions over which the MPI processes can be distributed, given a problem of dimension nDimensions. FFTW can only divide in 1 dimension: the leading dimension. ParaFaFT can divide an N dimensional setup over the leading N - 1 dimensions.

inline virtual device::Idx TempLat::FFTWInterface::getMaximumNumberOfDimensionsToDivide (
    device::Idx nDimensions
) 

The calling function needs to know, because the user may switch between layouts after compilation.

Implements TempLat::FFTLibraryInterface::getMaximumNumberOfDimensionsToDivide


Public Static Functions Documentation

function decomposition

FFTW (including fftw-mpi) uses a slab decomposition: split only the leading dimension.

static inline FFTDecomposition < NDim > TempLat::FFTWInterface::decomposition (
    MPICommReference baseComm,
    device::IdxArray< NDim > nGridPoints
) 

The grid is pinned to [P, 1, ...] rather than left zeroed for MPI_Dims_create to fill. FFTW slabs the leading dimension across the ranks of its communicator in rank order, so that shape is not a choice — it is what FFTW will do. Reporting it explicitly keeps this in agreement with topology() below, and lets the group cross-check compare exact dims instead of merely counting how many dimensions are split.


function topology

The MPI topology FFTW-MPI will use.

static inline FFTTopology < NDim > TempLat::FFTWInterface::topology (
    MPICommReference baseComm,
    device::IdxArray< NDim > nGridPoints
) 

FFTW-MPI builds no Cartesian communicator of its own: it slabs the leading dimension across the ranks of whatever communicator it is given, in that communicator's rank order. So the base communicator is the authoritative topology, the grid is [P, 1, ...], and this rank sits at [rank, 0, ...]. Returning it explicitly (rather than leaving dims zeroed for MPI_Dims_create) is what lets the caller build a Cartesian group whose coordinates provably match the slab FFTW will actually produce.

Runs the same INT_MAX sendrecv-overflow check as decomposition.



The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/fft/external/fftw/fftwinterface.h