LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::cufft::cuFFTWrapper< InputTypeT > Class Template Reference

Wrapper around cuFFT. More...

#include <cufft_wrapper.hpp>

Classes

struct  InternalPlanType
 

Public Types

using InputType = InputTypeT
 
using OutputType = ToComplex< InputType >
 
using RealType = ToReal< InputType >
 
using ComplexType = ToComplex< InputType >
 
using RealMatType = El::Matrix< RealType, El::Device::GPU >
 
using ComplexMatType = El::Matrix< ComplexType, El::Device::GPU >
 
using ComplexBufferType = El::simple_buffer< ComplexType, El::Device::GPU >
 
using InputMatType = El::Matrix< InputType, El::Device::GPU >
 
using OutputMatType = El::Matrix< OutputType, El::Device::GPU >
 
using ExecutorType = cuFFTExecutor< InputType, OutputType >
 
using PlanType = cufftHandle
 

Public Member Functions

 cuFFTWrapper ()=default
 
 ~cuFFTWrapper ()=default
 
 cuFFTWrapper (cuFFTWrapper &&other) noexcept=default
 
 cuFFTWrapper (cuFFTWrapper const &)=delete
 
void setup_forward (InputMatType &in, OutputMatType &out, std::vector< int > const &full_dims)
 Setup the forward transform. More...
 
void setup_forward (InputMatType &in, std::vector< int > const &full_dims)
 Setup an in-place forward transform. More...
 
void setup_backward (OutputMatType &in, InputMatType &out, std::vector< int > const &full_dims)
 Setup the backward (inverse) transform. More...
 
void setup_backward (OutputMatType &in, std::vector< int > const &full_dims)
 Setup the in-place backward (inverse) transform. More...
 
void compute_forward (InputMatType &in, OutputMatType &out) const
 
void compute_forward (InputMatType &in) const
 
void compute_backward (OutputMatType &in, InputMatType &out) const
 
void compute_backward (OutputMatType &in) const
 

Private Member Functions

void compute_common (OutputMatType &in, InputMatType &out, int dir) const
 
template<typename InMatT , typename OutMatT >
void setup_common (InMatT &in, OutMatT &out, std::vector< int > const &full_dims)
 

Private Attributes

std::vector< InternalPlanTypeplans_
 

Detailed Description

template<typename InputTypeT>
class lbann::cufft::cuFFTWrapper< InputTypeT >

Wrapper around cuFFT.

The main constraint is that the sample data to which the DFT will be applied must be fully packed. Batches do not need to be fully packed, but all lower dimensions do. For example, to compute the DFT of each feature map in a batch of N samples with C feature maps of size HxW per sample, the input matrix must have width N and each column must be CHW-packed, in the cuDNN sense.

This class is structured to match the FFTWWrapper, even though the cuFFT interface is simpler and better in many ways.

Definition at line 141 of file cufft_wrapper.hpp.

Member Typedef Documentation

◆ ComplexBufferType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::ComplexBufferType = El::simple_buffer<ComplexType, El::Device::GPU>

Definition at line 153 of file cufft_wrapper.hpp.

◆ ComplexMatType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::ComplexMatType = El::Matrix<ComplexType, El::Device::GPU>

Definition at line 151 of file cufft_wrapper.hpp.

◆ ComplexType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::ComplexType = ToComplex<InputType>

Definition at line 148 of file cufft_wrapper.hpp.

◆ ExecutorType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::ExecutorType = cuFFTExecutor<InputType, OutputType>

Definition at line 158 of file cufft_wrapper.hpp.

◆ InputMatType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::InputMatType = El::Matrix<InputType, El::Device::GPU>

Definition at line 155 of file cufft_wrapper.hpp.

◆ InputType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::InputType = InputTypeT

Definition at line 144 of file cufft_wrapper.hpp.

◆ OutputMatType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::OutputMatType = El::Matrix<OutputType, El::Device::GPU>

Definition at line 156 of file cufft_wrapper.hpp.

◆ OutputType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::OutputType = ToComplex<InputType>

Definition at line 145 of file cufft_wrapper.hpp.

◆ PlanType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::PlanType = cufftHandle

Definition at line 159 of file cufft_wrapper.hpp.

◆ RealMatType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::RealMatType = El::Matrix<RealType, El::Device::GPU>

Definition at line 150 of file cufft_wrapper.hpp.

◆ RealType

template<typename InputTypeT >
using lbann::cufft::cuFFTWrapper< InputTypeT >::RealType = ToReal<InputType>

Definition at line 147 of file cufft_wrapper.hpp.

Constructor & Destructor Documentation

◆ cuFFTWrapper() [1/3]

template<typename InputTypeT >
lbann::cufft::cuFFTWrapper< InputTypeT >::cuFFTWrapper ( )
default

◆ ~cuFFTWrapper()

template<typename InputTypeT >
lbann::cufft::cuFFTWrapper< InputTypeT >::~cuFFTWrapper ( )
default

◆ cuFFTWrapper() [2/3]

template<typename InputTypeT >
lbann::cufft::cuFFTWrapper< InputTypeT >::cuFFTWrapper ( cuFFTWrapper< InputTypeT > &&  other)
defaultnoexcept

◆ cuFFTWrapper() [3/3]

template<typename InputTypeT >
lbann::cufft::cuFFTWrapper< InputTypeT >::cuFFTWrapper ( cuFFTWrapper< InputTypeT > const &  )
delete

Member Function Documentation

◆ compute_backward() [1/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::compute_backward ( OutputMatType in,
InputMatType out 
) const
inline

Definition at line 254 of file cufft_wrapper.hpp.

◆ compute_backward() [2/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::compute_backward ( OutputMatType in) const
inline

Definition at line 259 of file cufft_wrapper.hpp.

◆ compute_common()

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::compute_common ( OutputMatType in,
InputMatType out,
int  dir 
) const
inlineprivate

Definition at line 265 of file cufft_wrapper.hpp.

◆ compute_forward() [1/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::compute_forward ( InputMatType in,
OutputMatType out 
) const
inline

Definition at line 244 of file cufft_wrapper.hpp.

◆ compute_forward() [2/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::compute_forward ( InputMatType in) const
inline

Definition at line 249 of file cufft_wrapper.hpp.

◆ setup_backward() [1/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::setup_backward ( OutputMatType in,
InputMatType out,
std::vector< int > const &  full_dims 
)
inline

Setup the backward (inverse) transform.

Parameters
inInput array; must be allocated, could be overwritten.
outOutput array; must be allocated, could be overwritten.
full_dimsFold dimensions for the tensors in columns of in/out. The format is expected to be [num_feature_maps, feature_map_dims].

Definition at line 226 of file cufft_wrapper.hpp.

◆ setup_backward() [2/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::setup_backward ( OutputMatType in,
std::vector< int > const &  full_dims 
)
inline

Setup the in-place backward (inverse) transform.

Parameters
inInput array; must be allocated, could be overwritten.
full_dimsFold dimensions for the tensors in columns of in/out. The format is expected to be [num_feature_maps, feature_map_dims].

Definition at line 239 of file cufft_wrapper.hpp.

◆ setup_common()

template<typename InputTypeT >
template<typename InMatT , typename OutMatT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::setup_common ( InMatT &  in,
OutMatT &  out,
std::vector< int > const &  full_dims 
)
inlineprivate

Definition at line 302 of file cufft_wrapper.hpp.

Here is the call graph for this function:

◆ setup_forward() [1/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::setup_forward ( InputMatType in,
OutputMatType out,
std::vector< int > const &  full_dims 
)
inline

Setup the forward transform.

Parameters
inInput array; must be allocated, could be overwritten.
outOutput array; must be allocated, could be overwritten.
full_dimsFold dimensions for the tensors in columns of in/out. The format is expected to be [num_feature_maps, feature_map_dims].

Definition at line 201 of file cufft_wrapper.hpp.

◆ setup_forward() [2/2]

template<typename InputTypeT >
void lbann::cufft::cuFFTWrapper< InputTypeT >::setup_forward ( InputMatType in,
std::vector< int > const &  full_dims 
)
inline

Setup an in-place forward transform.

Parameters
inInput array; must be allocated, could be overwritten.
full_dimsFold dimensions for the tensors in columns of in/out. The format is expected to be [num_feature_maps, feature_map_dims].
Todo:
Assert this is ok for R2C cases!!!

Definition at line 213 of file cufft_wrapper.hpp.

Member Data Documentation

◆ plans_

template<typename InputTypeT >
std::vector<InternalPlanType> lbann::cufft::cuFFTWrapper< InputTypeT >::plans_
private

Definition at line 397 of file cufft_wrapper.hpp.


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