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::args
, containing pointers to arrays to be used;FFTXProblem::sizes
, containing problem size;FFTXProblem::name
, a string that specifies the transform type.
FFTXProblem
is a pure virtual class; the functionsrandomProblemInstance()
andsemantics()
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
andFFTXProblem::sizes
only, to the arguments.
-
inline FFTXProblem(const std::vector<int> sizes1, std::string name1)
Constructor that sets
FFTXProblem::sizes
andFFTXProblem::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
, andFFTXProblem::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
withCUdeviceptr ptr
(orFFTX_DEVICE_PTR ptr
if you haveinclude "fftxdevice_macros.h"
).for HIP, specify
ptr
withhipDeviceptr_t ptr
(orFFTX_DEVICE_PTR ptr
if you haveinclude "fftxdevice_macros.h"
).for SYCL, specify
(void*) ptr
withsycl::buffer<double> ptr
.for CPU, specify
(void*) ptr
withdouble* 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 astd::vector<void*>
of length 3, whereargs[0]
is a pointer to a complex output array of size the product of the dimensions inFFTXProblem::sizes
;args[1]
is a pointer to a complex input array of size the product of the dimensions inFFTXProblem::sizes
;args[2]
is not used and can be set to NULL.
FFTXProblem::sizes
must be set to astd::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 astd::vector<void*>
of length 3, whereargs[0]
is a pointer to a complex output array of size the product of the dimensions inFFTXProblem::sizes
;args[1]
is a pointer to a complex input array of size the product of the dimensions inFFTXProblem::sizes
;args[2]
is not used and can be set to NULL.
FFTXProblem::sizes
must be set to astd::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 astd::vector<void*>
of length 3, whereargs[0]
is a pointer to a complex output array of size the product of a truncated version of the dimensions inFFTXProblem::sizes
: this will besizes[0]*sizes[1]*(sizes[2]+1)/2
;args[1]
is a pointer to a real input array of size the product of the dimensions inFFTXProblem::sizes
;args[2]
is not used and can be set to NULL.
FFTXProblem::sizes
must be set to astd::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 astd::vector<void*>
of length 3, whereargs[0]
is a pointer to a real output array of size the product of the dimensions inFFTXProblem::sizes
;args[1]
is a pointer to a complex input array of size the product of a truncated version of the dimensions inFFTXProblem::sizes
: this will besizes[0]*sizes[1]*(sizes[2]+1)/2
;args[2]
is not used and can be set to NULL.
FFTXProblem::sizes
must be set to astd::vector<int>
of length 3, containing the transform size in each coordinate dimension.FFTXProblem::name
must be set to"imdprdft"
.