LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::fftw::FFTWWrapper< InputTypeT > Class Template Reference

Wrapper around FFTW. More...

#include <fftw_wrapper.hpp>

Classes

struct  InternalPlanType
 

Public Types

using InputType = InputTypeT
 
using OutputType = ToComplex< InputType >
 
using RealType = ToReal< InputType >
 
using ComplexType = ToComplex< InputType >
 
using TraitsType = FFTWTraits< InputType, ToComplex< InputType > >
 
using RealMatType = El::Matrix< RealType, El::Device::CPU >
 
using ComplexMatType = El::Matrix< ComplexType, El::Device::CPU >
 
using InputMatType = El::Matrix< InputType, El::Device::CPU >
 
using OutputMatType = El::Matrix< OutputType, El::Device::CPU >
 
using PlanType = typename TraitsType::plan_type
 

Public Member Functions

 FFTWWrapper ()=default
 
 ~FFTWWrapper ()=default
 
 FFTWWrapper (FFTWWrapper &&other) noexcept=default
 
 FFTWWrapper (FFTWWrapper 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

template<typename InMatT , typename OutMatT , typename SetupManyFunctorT , typename SetupGuruFunctorT >
void setup_common (InMatT &in, OutMatT &out, std::vector< int > const &full_dims, std::vector< InternalPlanType > &plans, SetupManyFunctorT many_functor, SetupGuruFunctorT guru_functor)
 

Private Attributes

std::vector< InternalPlanTypefwd_plans_
 
std::vector< InternalPlanTypebwd_plans_
 

Detailed Description

template<typename InputTypeT>
class lbann::fftw::FFTWWrapper< InputTypeT >

Wrapper around FFTW.

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.

Definition at line 208 of file fftw_wrapper.hpp.

Member Typedef Documentation

◆ ComplexMatType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::ComplexMatType = El::Matrix<ComplexType, El::Device::CPU>

Definition at line 219 of file fftw_wrapper.hpp.

◆ ComplexType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::ComplexType = ToComplex<InputType>

Definition at line 215 of file fftw_wrapper.hpp.

◆ InputMatType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::InputMatType = El::Matrix<InputType, El::Device::CPU>

Definition at line 221 of file fftw_wrapper.hpp.

◆ InputType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::InputType = InputTypeT

Definition at line 211 of file fftw_wrapper.hpp.

◆ OutputMatType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::OutputMatType = El::Matrix<OutputType, El::Device::CPU>

Definition at line 222 of file fftw_wrapper.hpp.

◆ OutputType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::OutputType = ToComplex<InputType>

Definition at line 212 of file fftw_wrapper.hpp.

◆ PlanType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::PlanType = typename TraitsType::plan_type

Definition at line 224 of file fftw_wrapper.hpp.

◆ RealMatType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::RealMatType = El::Matrix<RealType, El::Device::CPU>

Definition at line 218 of file fftw_wrapper.hpp.

◆ RealType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::RealType = ToReal<InputType>

Definition at line 214 of file fftw_wrapper.hpp.

◆ TraitsType

template<typename InputTypeT >
using lbann::fftw::FFTWWrapper< InputTypeT >::TraitsType = FFTWTraits<InputType, ToComplex<InputType> >

Definition at line 216 of file fftw_wrapper.hpp.

Constructor & Destructor Documentation

◆ FFTWWrapper() [1/3]

template<typename InputTypeT >
lbann::fftw::FFTWWrapper< InputTypeT >::FFTWWrapper ( )
default

◆ ~FFTWWrapper()

template<typename InputTypeT >
lbann::fftw::FFTWWrapper< InputTypeT >::~FFTWWrapper ( )
default

◆ FFTWWrapper() [2/3]

template<typename InputTypeT >
lbann::fftw::FFTWWrapper< InputTypeT >::FFTWWrapper ( FFTWWrapper< InputTypeT > &&  other)
defaultnoexcept

◆ FFTWWrapper() [3/3]

template<typename InputTypeT >
lbann::fftw::FFTWWrapper< InputTypeT >::FFTWWrapper ( FFTWWrapper< InputTypeT > const &  )
delete

Member Function Documentation

◆ compute_backward() [1/2]

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

Definition at line 337 of file fftw_wrapper.hpp.

Here is the call graph for this function:

◆ compute_backward() [2/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< InputTypeT >::compute_backward ( OutputMatType in) const
inline

Definition at line 356 of file fftw_wrapper.hpp.

◆ compute_forward() [1/2]

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

Definition at line 313 of file fftw_wrapper.hpp.

Here is the call graph for this function:

◆ compute_forward() [2/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< InputTypeT >::compute_forward ( InputMatType in) const
inline

Definition at line 332 of file fftw_wrapper.hpp.

◆ setup_backward() [1/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< 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 290 of file fftw_wrapper.hpp.

◆ setup_backward() [2/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< 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 308 of file fftw_wrapper.hpp.

◆ setup_common()

template<typename InputTypeT >
template<typename InMatT , typename OutMatT , typename SetupManyFunctorT , typename SetupGuruFunctorT >
void lbann::fftw::FFTWWrapper< InputTypeT >::setup_common ( InMatT &  in,
OutMatT &  out,
std::vector< int > const &  full_dims,
std::vector< InternalPlanType > &  plans,
SetupManyFunctorT  many_functor,
SetupGuruFunctorT  guru_functor 
)
inlineprivate

Definition at line 366 of file fftw_wrapper.hpp.

Here is the call graph for this function:

◆ setup_forward() [1/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< 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 260 of file fftw_wrapper.hpp.

◆ setup_forward() [2/2]

template<typename InputTypeT >
void lbann::fftw::FFTWWrapper< 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 277 of file fftw_wrapper.hpp.

Member Data Documentation

◆ bwd_plans_

template<typename InputTypeT >
std::vector<InternalPlanType> lbann::fftw::FFTWWrapper< InputTypeT >::bwd_plans_
private

Definition at line 463 of file fftw_wrapper.hpp.

◆ fwd_plans_

template<typename InputTypeT >
std::vector<InternalPlanType> lbann::fftw::FFTWWrapper< InputTypeT >::fwd_plans_
private

Definition at line 462 of file fftw_wrapper.hpp.


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