C++ API

FFTX interfaces

The FFTX interfaces operate on constructs in namespace fftx. A multi-dimensional array is represented by an instance of struct array_t, which is defined by its domain as an instance of struct box_t, which in turn is defined by its corners, which are instances of struct point_t. An array instance also contains a pointer to the data, an instance of class global_ptr.

The class FFTXProblem defines an FFTX problem of a particular transform type of a particular size.

The documentation below is generated by doxygen.

fftx::point_t

Warning

doxygenstruct: Cannot find class “fftx::point_t” in doxygen xml output for project “FFTX” from directory: /home/runner/work/fftx/fftx/fftx/build/docs/doxygen/xml

fftx::box_t

Warning

doxygenstruct: Cannot find class “fftx::box_t” in doxygen xml output for project “FFTX” from directory: /home/runner/work/fftx/fftx/fftx/build/docs/doxygen/xml

fftx::array_t

Warning

doxygenstruct: Cannot find class “fftx::array_t” in doxygen xml output for project “FFTX” from directory: /home/runner/work/fftx/fftx/fftx/build/docs/doxygen/xml

fftx::global_ptr

Warning

doxygenclass: Cannot find class “fftx::global_ptr” in doxygen xml output for project “FFTX” from directory: /home/runner/work/fftx/fftx/fftx/build/docs/doxygen/xml

FFTXProblem

class FFTXProblem

Class for an FFTX problem defined by:

FFTXProblem is a pure virtual class; the functions randomProblemInstance() and semantics() need to be defined in any derived class.

Subclassed by IMDDFTProblem, IMDPRDFTProblem, MDDFTProblem, MDPRDFTProblem

Public Functions

inline FFTXProblem()

Default constructor that leaves FFTXProblem in an undefined state.

inline FFTXProblem(std::string name1)

Constructor that sets FFTXProblem::name only, to the argument.

inline FFTXProblem(const std::vector<void*> &args1)

Constructor that sets FFTXProblem::args only, to the argument.

inline FFTXProblem(const std::vector<int> &sizes1)

Constructor that sets FFTXProblem::sizes only, to the argument.

inline FFTXProblem(const std::vector<void*> &args1, const std::vector<int> &sizes1)

Constructor that sets FFTXProblem::args and FFTXProblem::sizes only, to the arguments.

inline FFTXProblem(const std::vector<int> sizes1, std::string name1)

Constructor that sets FFTXProblem::sizes and FFTXProblem::name only, to the arguments.

inline FFTXProblem(const std::vector<void*> &args1, const std::vector<int> &sizes1, std::string name1)

Constructor that sets FFTXProblem::args, FFTXProblem::sizes, and FFTXProblem::name, to the arguments.

inline void setSizes(const std::vector<int> &sizes1)

Sets FFTXProblem::sizes.

inline void setArgs(const std::vector<void*> &args1)

Sets FFTXProblem::args.

inline void setName(std::string name)

Sets FFTXProblem::name.

inline void transform()

Performs the transform.

inline float getTime()

Returns time taken by the GPU to perform the transform, in milliseconds.

inline ~FFTXProblem()

Destructor.

Public Members

std::vector<void*> args

Array of length 3 that contains the following.

  • args[0]: pointer to output array.

  • args[1]: pointer to input array.

  • args[2]: pointer to symbol array (not used by all transforms). If not used, then can be set to NULL.

The manner of specifying the pointer in each element of args depends on the backend:

  • for CUDA, specify &ptr with CUdeviceptr ptr (or FFTX_DEVICE_PTR ptr if you have include "fftxdevice_macros.h").

  • for HIP, specify ptr with hipDeviceptr_t ptr (or FFTX_DEVICE_PTR ptr if you have include "fftxdevice_macros.h").

  • for SYCL, specify (void*) ptr with sycl::buffer<double> ptr.

  • for CPU, specify (void*) ptr with double* ptr.

std::vector<int> sizes

Size of transform, as a std::vector<int> of length equal to the dimension, with the component in each coordinate direction representing the transform size in that direction.

std::string name

String that specifies the type of transform, which is one of the following.

  • "mddft": forward complex-to-complex 3D FFT

  • "imddft": inverse complex-to-complex 3D FFT

  • "mdprdft": real-to-complex 3D FFT

  • "imdprdft": complex-to-real 3D FFT

  • "rconv": real 3D convolution

  • "b1dft" or "dftbat": forward 1D batch FFT

  • "ib1dft" or "idftbat": inverse 1D batch FFT

MDDFTProblem

class MDDFTProblem : public FFTXProblem

Class for forward complex-to-complex 3D FFT.

FFTXProblem::args must be set to a std::vector<void*> of length 3, where

  • args[0] is a pointer to a complex output array of size the product of the dimensions in FFTXProblem::sizes;

  • args[1] is a pointer to a complex input array of size the product of the dimensions in FFTXProblem::sizes;

  • args[2] is not used and can be set to NULL.

FFTXProblem::sizes must be set to a std::vector<int> of length 3, containing the transform size in each coordinate dimension.

FFTXProblem::name must be set to "mddft".

IMDDFTProblem

class IMDDFTProblem : public FFTXProblem

Class for inverse complex-to-complex 3D FFT.

FFTXProblem::args must be set to a std::vector<void*> of length 3, where

  • args[0] is a pointer to a complex output array of size the product of the dimensions in FFTXProblem::sizes;

  • args[1] is a pointer to a complex input array of size the product of the dimensions in FFTXProblem::sizes;

  • args[2] is not used and can be set to NULL.

FFTXProblem::sizes must be set to a std::vector<int> of length 3, containing the transform size in each coordinate dimension.

FFTXProblem::name must be set to "imddft".

MDPRDFTProblem

class MDPRDFTProblem : public FFTXProblem

Class for real-to-complex 3D FFT.

FFTXProblem::args must be set to a std::vector<void*> of length 3, where

  • args[0] is a pointer to a complex output array of size the product of a truncated version of the dimensions in FFTXProblem::sizes: this will be sizes[0]*sizes[1]*(sizes[2]+1)/2;

  • args[1] is a pointer to a real input array of size the product of the dimensions in FFTXProblem::sizes;

  • args[2] is not used and can be set to NULL.

FFTXProblem::sizes must be set to a std::vector<int> of length 3, containing the transform size in each coordinate dimension.

FFTXProblem::name must be set to "mdprdft".

IMDPRDFTProblem

class IMDPRDFTProblem : public FFTXProblem

Class for complex-to-real 3D FFT.

FFTXProblem::args must be set to a std::vector<void*> of length 3, where

  • args[0] is a pointer to a real output array of size the product of the dimensions in FFTXProblem::sizes;

  • args[1] is a pointer to a complex input array of size the product of a truncated version of the dimensions in FFTXProblem::sizes: this will be sizes[0]*sizes[1]*(sizes[2]+1)/2;

  • args[2] is not used and can be set to NULL.

FFTXProblem::sizes must be set to a std::vector<int> of length 3, containing the transform size in each coordinate dimension.

FFTXProblem::name must be set to "imdprdft".