| kspaceFirstOrder3D-CUDA 1.1 The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Static Private Member Functions | Static Private Attributes | List of all members
TCUFFTComplexMatrix Class Reference

Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA FFT interface. More...

`#include <CUFFTComplexMatrix.h>`

Inheritance diagram for TCUFFTComplexMatrix:
[legend]
Collaboration diagram for TCUFFTComplexMatrix:
[legend]

## Public Member Functions
| TCUFFTComplexMatrix (const TDimensionSizes &DimensionSizes)
| Constructor (inherited from TComplexMatrix).
virtual | ~TCUFFTComplexMatrix ()
| Destructor (Inherited from TComplexMatrix).
void | Compute_FFT_3D_R2C (TRealMatrix &inMatrix)
| Compute 3D out-of-place Real-to-Complex FFT. More...
void | Compute_FFT_3D_C2R (TRealMatrix &outMatrix)
| Compute 3D out-of-place Complex-to-Real FFT. More...
void | Compute_FFT_1DX_R2C (TRealMatrix &inMatrix)
| Compute 1D out-of-place Real-to-Complex FFT in the X dimension. More...
void | Compute_FFT_1DY_R2C (TRealMatrix &inMatrix)
| Compute 1D out-of-place Real-to-Complex FFT in the Y dimension. More...
void | Compute_FFT_1DZ_R2C (TRealMatrix &inMatrix)
| Compute 1D out-of-place Real-to-Complex FFT in the Z dimension. More...
void | Compute_FFT_1DX_C2R (TRealMatrix &outMatrix)
| Compute 1D out-of-place Complex-to-Real FFT in the X dimension. More...
void | Compute_FFT_1DY_C2R (TRealMatrix &outMatrix)
| Compute 1D out-of-place Complex-to-Real FFT in the Y dimension. More...
void | Compute_FFT_1DZ_C2R (TRealMatrix &outMatrix)
| Compute 1D out-of-place Complex-to-Real FFT in the Z dimension. More...
Public Member Functions inherited from TComplexMatrix
| TComplexMatrix (const TDimensionSizes &dimensionSizes)
| Constructor. More...
virtual | ~TComplexMatrix ()
| Destructor. More...
TFloatComplex & | operator[] (const size_t &index)
| Operator []. More...
const TFloatComplex & | operator[] (const size_t &index) const
| Operator [], constant version. More...
virtual void | ReadDataFromHDF5File (THDF5_File &file, TMatrixName &matrixName)
| Load data from the HDF5_File. More...
virtual void | WriteDataToHDF5File (THDF5_File &file, TMatrixName &matrixName, const size_t compressionLevel)
| Write data into the HDF5_File. More...
Public Member Functions inherited from TBaseFloatMatrix
| TBaseFloatMatrix ()
| Default constructor. More...
virtual TDimensionSizes | GetDimensionSizes () const
| Get dimension sizes of the matrix.
virtual size_t | GetElementCount () const
| Get element count of the matrix.
virtual size_t | GetAllocatedElementCount () const
| Get total allocated element count (might differ from total element count used for the simulation because of padding).
virtual void | ZeroMatrix ()
| Zero all elements of the matrix (NUMA first touch). More...
virtual void | ScalarDividedBy (const float scalar)
| Divide scalar/ matrix_element[i]. More...
virtual float * | GetHostData ()
| Get raw CPU data out of the class (for direct CPU kernel access).
virtual const float * | GetHostData () const
| Get raw CPU data out of the class (for direct CPU kernel access).
virtual float * | GetDeviceData ()
| Get raw GPU data out of the class (for direct GPU kernel access).
virtual const float * | GetDeviceData () const
| Get raw GPU data out of the class (for direct GPU kernel access).
virtual void | CopyToDevice ()
| Copy data from CPU -> GPU (Host -> Device). More...
virtual void | CopyFromDevice ()
| Copy data from GPU -> CPU (Device -> Host). More...
Public Member Functions inherited from TBaseMatrix
| TBaseMatrix ()
| Default constructor.
virtual | ~TBaseMatrix ()
| Destructor.

## Static Public Member Functions
static void | Create_FFT_Plan_3D_R2C (const TDimensionSizes &inMatrixDims)
| Create static cuFFT plan for Real-to-Complex. More...
static void | Create_FFT_Plan_3D_C2R (const TDimensionSizes &outMatrixDims)
| Create static cuFFT plan for Complex-to-Real. More...
static void | Create_FFT_Plan_1DX_R2C (const TDimensionSizes &inMatrixDims)
| Create static cuFFT plan for Real-to-Complex in the X dimension. More...
static void | Create_FFT_Plan_1DY_R2C (const TDimensionSizes &inMatrixDims)
| Create static cuFFT plan for Real-to-Complex in the Y dimension. More...
static void | Create_FFT_Plan_1DZ_R2C (const TDimensionSizes &inMatrixDims)
| Create static cuFFT plan for Real-to-Complex in the Z dimension.
static void | Create_FFT_Plan_1DX_C2R (const TDimensionSizes &outMatrixDims)
| Create static cuFFT plan for Complex-to-Real in the X dimension.
static void | Create_FFT_Plan_1DY_C2R (const TDimensionSizes &outMatrixDims)
| Create static cuFFT plan for Complex-to-Real in the Y dimension.
static void | Create_FFT_Plan_1DZ_C2R (const TDimensionSizes &outMatrixDims)
| Create static cuFFT plan for Complex-to-Real in the Z dimension.
static void | DestroyAllPlansAndStaticData ()
| Destroy all static plans and error messages. More...

## Protected Member Functions
| TCUFFTComplexMatrix (const TCUFFTComplexMatrix &src)
| Copy constructor not allowed for public.
TCUFFTComplexMatrix & | operator= (const TCUFFTComplexMatrix &src)
| Operator = not allowed for public.
Protected Member Functions inherited from TComplexMatrix
| TComplexMatrix ()
| Default constructor not allowed for public.
| TComplexMatrix (const TComplexMatrix &src)
| Copy constructor not allowed for public.
TComplexMatrix & | operator= (const TComplexMatrix &src)
| Operator not allowed for public.
virtual void | InitDimensions (const TDimensionSizes &dimensionSizes)
| Initialize dimension sizes and related structures. More...
Protected Member Functions inherited from TBaseFloatMatrix
virtual void | AllocateMemory ()
| Memory allocation (both on CPU and GPU). More...
virtual void | FreeMemory ()
| Memory allocation (both on CPU and GPU). More...
| TBaseFloatMatrix (const TBaseFloatMatrix &src)
| Copy constructor is not directly allowed.
TBaseFloatMatrix & | operator= (const TBaseFloatMatrix &src)
| Operator = is not directly allowed.

## Static Protected Attributes
static cufftHandle | cufftPlan_3D_R2C = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Real-to-Complex transform.
static cufftHandle | cufftPlan_3D_C2R = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Complex-to-Real transform.
static cufftHandle | cufftPlan_1DX_R2C = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 1D Real-to-Complex transform in the X dimension.
static cufftHandle | cufftPlan_1DY_R2C = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Real-to-Complex transform in the Y dimension.
static cufftHandle | cufftPlan_1DZ_R2C = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Real-to-Complex transform in the Z dimension.
static cufftHandle | cufftPlan_1DX_C2R = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Complex-to-Real transform in the X dimension.
static cufftHandle | cufftPlan_1DY_C2R = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3D Complex-to-Real transform in the Y dimension.
static cufftHandle | cufftPlan_1DZ_C2R = static_cast<cufftHandle>(NULL)
| cuFFT plan for the 3Z Complex-to-Real transform in the Z dimension.

## Static Private Member Functions
static void | ThrowCUFFTException (const cufftResult cufftError, const std::string &transformTypeName)
| Throw an exception with a given error message. More...

## Static Private Attributes
static std::map< cufftResult, TErrorMessage > | cuFFTErrorMessages

## Additional Inherited Members
Protected Attributes inherited from TBaseFloatMatrix
size_t | nElements
| Total number of elements.
size_t | nAllocatedElements
| Total number of allocated elements (in terms of floats).
struct TDimensionSizes | dimensionSizes
| Dimension sizes.
size_t | dataRowSize
| Size of a 1D row in X dimension.
size_t | dataSlabSize
| Size of a 2D slab.
float * | hostData
| Raw CPU matrix data.
float * | deviceData
| Raw GPU matrix data.

## Detailed Description

Class implementing 3D Real-To-Complex and Complex-To-Real transforms using CUDA FFT interface.

Definition at line 50 of file CUFFTComplexMatrix.h.

## Member Function Documentation

void TCUFFTComplexMatrix::Compute_FFT_1DX_C2R | ( | TRealMatrix & | outMatrix | ) |

Computer inverse out-of-place 1DX Real-to-Complex FFT.

Parameters

  [out] | outMatrix | - Output data for the inverse FFT.

Exceptions

  runtime_error | if the plan is not valid.

Definition at line 626 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_1DX_R2C | ( | TRealMatrix & | inMatrix | ) |

Computer forward out-of-place 1DX Real-to-Complex FFT.

Parameters

  [in] | inMatrix | - Input data for the forward FFT.

Exceptions

  runtime_error | if the plan is not valid.

Definition at line 550 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_1DY_C2R | ( | TRealMatrix & | outMatrix | ) |

Computer inverse out-of-place 1DY Real-to-Complex FFT. The matrix is requested to be in the transposed layout. After the FFT is calculated, an Y<->X transposed follows. The matrix is returned in the normal layout (z, y, x) format.

Parameters

  [out] | outMatrix | - Output data for the inverse FFT.

Exceptions

  runtime_error | if the plan is not valid.

Transpose a real 3D matrix back in the X-Y direction

Definition at line 646 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_1DY_R2C | ( | TRealMatrix & | inMatrix | ) |

Computer forward out-of-place 1DY Real-to-Complex FFT. The matrix is first X<->Y transposed followed by the 1D FFT. The matrix is left in the transposed format.

Parameters

  [in] | inMatrix | - Input data for the forward FFT.

Exceptions

  runtime_error | if the plan is not valid.

Transpose a real 3D matrix in the X-Y direction

Definition at line 569 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_1DZ_C2R | ( | TRealMatrix & | outMatrix | ) |

Computer forward out-of-place 1DY Real-to-Complex FFT. The matrix is requested to be in the transposed layout. After the FFT is calculated, an Z<->X transposed follows. The matrix is returned in the normal layout (z, y, x).

Parameters

  [out] | outMatrix | - Output data for the inverse FFT.

Exceptions

  runtime_error | if the plan is not valid.

Transpose a real 3D matrix in the Z<->X direction

Definition at line 677 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_1DZ_R2C | ( | TRealMatrix & | inMatrix | ) |

Computer forward out-of-place 1DY Real-to-Complex FFT. The matrix is first X<->Z transposed followed by the 1D FFT. The matrix is left in the transposed format.

Parameters

  [in] | inMatrix | - Input data for the forward FFT.

Exceptions

  runtime_error | if the plan is not valid.

Transpose a real 3D matrix in the X-Z direction

Definition at line 598 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_3D_C2R | ( | TRealMatrix & | outMatrix | ) |

Computer forward out-of-place 3D Complex-to-Real FFT.

Parameters

  [out] | outMatrix | - output of the inverse FFT.

Exceptions

  runtime_error | if the plan is not valid.

Definition at line 533 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Compute_FFT_3D_R2C | ( | TRealMatrix & | inMatrix | ) |

Computer forward out-of-place 3D Real-to-Complex FFT.

Parameters

  [in] | inMatrix | - Input data for the forward FFT

Exceptions

  runtime_error | if the plan is not valid.

Definition at line 514 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Create_FFT_Plan_1DX_R2C | ( | const TDimensionSizes & | inMatrixDims | ) |
| static

Create cuFFT plan for 1DX Real-to-Complex.
This version doesn't need any scratch place for planning. All 1D transforms are done in a single batch (no transpose needed).

Parameters

  [in] | inMatrixDims | - The dimension sizes of the input matrix

Exceptions

  runtime_error | if the plan can't be created.

Definition at line 154 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Create_FFT_Plan_1DY_R2C | ( | const TDimensionSizes & | inMatrixDims | ) |
| static

Create cuFFT plan for 1DY Real-to-Complex.
This version doesn't need any scratch place for planning. All 1D transforms are done in a single batch. Data has to be transposed before the transform.

Parameters

  [in] | inMatrixDims | - The dimension sizes of the input matrix

Exceptions

  runtime_error | if the plan can't be created.

Definition at line 204 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Create_FFT_Plan_3D_C2R | ( | const TDimensionSizes & | outMatrixDims | ) |
| static

Create cuFFT plan for Complex-to-Real.
This version doesn't need any scratch place for planning.

Parameters

  [in] | outMatrixDims | - the dimension sizes of the output matrix

Exceptions

  runtime_error | if the plan can't be created.

Definition at line 126 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::Create_FFT_Plan_3D_R2C | ( | const TDimensionSizes & | inMatrixDims | ) |
| static

Create an cuFFT plan for 3D Real-to-Complex.
This version doesn't need any scratch place for planning.

Parameters

  [in] | inMatrixDims | - The dimension sizes of the input matrix

Exceptions

  runtime_error | if the plan can't be created.

Definition at line 101 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::DestroyAllPlansAndStaticData | ( |  | ) |
| static

Destroy all static plans created by the application.

Exceptions

  runtime_error | if the plan can't be created.

Definition at line 443 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void TCUFFTComplexMatrix::ThrowCUFFTException | ( | const cufftResult | cufftError,
|  | const std::string & | transformTypeName
| ) |  |
| staticprivate

Throw cuda FFT exception

Parameters

  [in] | cufftError | - CUDA FFT error code
  [in] | transformTypeName | - CUDA transform type name

Exceptions

  runtime | error if error occurs

Definition at line 716 of file CUFFTComplexMatrix.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

## Member Data Documentation

std::map< cufftResult, TErrorMessage > TCUFFTComplexMatrix::cuFFTErrorMessages
| staticprivate

Initial value:
{
{CUFFT_INVALID_PLAN , ERR_FMT_CUFFT_INVALID_PLAN},
{CUFFT_ALLOC_FAILED , ERR_FMT_CUFFT_ALLOC_FAILED},
{CUFFT_INVALID_TYPE , ERR_FMT_CUFFT_INVALID_TYPE},
{CUFFT_INVALID_VALUE , ERR_FMT_CUFFT_INVALID_VALUE},
{CUFFT_INTERNAL_ERROR , ERR_FMT_CUFFT_INVALID_VALUE},
{CUFFT_EXEC_FAILED , ERR_FMT_CUFFT_EXEC_FAILED},
{CUFFT_SETUP_FAILED , eRR_FMT_CUFFT_SETUP_FAILED},
{CUFFT_INVALID_SIZE , ERR_FMT_CUFFT_INVALID_SIZE},
{CUFFT_UNALIGNED_DATA , ERR_FMT_CUFFT_UNALIGNED_DATA},
{CUFFT_INCOMPLETE_PARAMETER_LIST, ERR_FMT_CUFFT_INCOMPLETE_PARAMETER_LIST},
{CUFFT_INVALID_DEVICE , ERR_FMT_CUFFT_INVALID_DEVICE},
{CUFFT_PARSE_ERROR , ERR_FMT_CUFFT_PARSE_ERROR},
{CUFFT_NO_WORKSPACE , ERR_FMT_CUFFT_NO_WORKSPACE},
{CUFFT_NOT_IMPLEMENTED , eRR_FMT_CUFFT_NOT_IMPLEMENTED},
{CUFFT_LICENSE_ERROR , ERR_FMT_CUFFT_LICENSE_ERROR}
}

Error message for the CUFFT class.

Definition at line 132 of file CUFFTComplexMatrix.h.

The documentation for this class was generated from the following files:

- MatrixClasses/CUFFTComplexMatrix.h
- MatrixClasses/CUFFTComplexMatrix.cpp