DistributedFFT

Usage

use DistributedFFT;

Provides a distributed 3D FFT.

Note

  • Currently only supports complex-complex and real-real transforms
  • Only out-of-place transforms are supported, and the output array has its first two indices transposed. The input array is unchanged.
  • Requires FFTW for the local 1D transforms.
  • The data are slab-distributed along the first dimension.

A simple example of using the module is

// Set up a slab-distributed domain
const Dom  = newSlabDom({0.. #NX, 0.. #NY, 0.. #NZ});
// And for the transposed array
const DomT = newSlabDom({0.. #NY, 0.. #NX, 0.. #NZ});

// Define the array
var inputarr  : [Dom]  complex;
var outputarr : [DomT] complex;

//Process inputarr as necessary
//then FFT in the forward direction
doFFT_Transposed(FFTtype.DFT, inputarr, outputarr, FFTW_FORWARD);

//Process outputarr as necessary
//then FFT in the reverse direction
doFFT_Transposed(FFTtype.DFT, outputarr, inputarr, FFTW_BACKWARD);
config param usePerformant = true

Compile time parameters for higher performance.

usePerformant selects between a naive pencil-and-paper algorithm and a more performant version.

config param usePrimitiveComm = true

usePrimitiveComm calls into non-user-facing Chapel communication primitives for data movement, instead of using array slicing and copying.

enum FFTtype { DFT, R2R }

The type of the transform.

Current complex-complex (DFT) and real-to-real (R2R) transforms are supported.

proc newSlabDom(dom: domain)

Construct a distributed slab distributed domain. These are currently backed by BlockDist.

Arguments:dom – Input 3D rectangular domain
Returns:Returns a slab-distributed domain.
proc newSlabDom(sz)

Construct a distributed slab distributed domain. These are currently backed by BlockDist.

Arguments:sz – Size tuple (NX, NY, NZ)
Returns:Returns a slab-distributed domain.
proc doFFT_Transposed(param ftType: FFTtype, src: [?SrcDom] ?T, dst: [?DstDom] T, signOrKind)

Do the FFT.

Arguments:
  • ftType : FFTtype – Type of transform
  • src – Input array [XYZ]
  • dst – Output array, transposed [YXZ]
  • signOrKind – Sign (for DFT), or kind (for R2R) of transform.

Refer to the FFTW documentation for the different signs/kinds.

Note that if ftType is FFTtype.R2R, then the signOrKind argument must be a 3 element array (the type for each dimension separately).

iter offset(r: range)

Iterate over the range r but in an offset manner based on the locale id.

proc copy(ref dst, const ref src, numBytes: int)

Low-level copy routine for contiguous data (a generalized memcpy).

Arguments:
  • dst – Starting element of destination block
  • src – Starting element of source block
  • numBytes – Number of bytes to copy.

Note that both dst and src cannot be remote.