ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
ModuleBase::FFT_Bundle Class Reference

#include <fft_bundle.h>

Collaboration diagram for ModuleBase::FFT_Bundle:

Public Member Functions

 FFT_Bundle ()
 ~FFT_Bundle ()
 FFT_Bundle (std::string device_in, std::string precision_in)
 Constructor with device and precision.
void setfft (std::string device_in, std::string precision_in)
 Set device and precision.
void set_dsp_cluster_id (int id)
 Set the DSP cluster id for the FFT_DSP backend.
void initfft (int nx_in, int ny_in, int nz_in, int lixy_in, int rixy_in, int ns_in, int nplane_in, int nproc_in, bool gamma_only_in, bool xprime_in=true, bool mpifft_in=false)
 Initialize the fft parameters.
void initfftmode (int fft_mode_in)
 Initialize the fft mode.
void setupFFT ()
void clearFFT ()
void clear ()
void resource_handler (const int flag) const
template<typename FPTYPE>
FPTYPE * get_rspace_data () const
 Get the real space data.
template<typename FPTYPE>
std::complex< FPTYPE > * get_auxr_data () const
 Get the auxr data.
template<typename FPTYPE>
std::complex< FPTYPE > * get_auxg_data () const
 Get the auxg data.
template<typename FPTYPE>
std::complex< FPTYPE > * get_auxr_3d_data () const
 Get the auxr 3d data.
template<typename FPTYPE>
void fftzfor (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Forward fft in z direction.
template<typename FPTYPE>
void fftxyfor (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Forward fft in x-y direction.
template<typename FPTYPE>
void fftzbac (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Backward fft in z direction.
template<typename FPTYPE>
void fftxybac (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
 Backward fft in x-y direction.
template<typename FPTYPE>
void fftxyr2c (FPTYPE *in, std::complex< FPTYPE > *out) const
 Real to complex fft in x-y direction.
template<typename FPTYPE>
void fftxyc2r (std::complex< FPTYPE > *in, FPTYPE *out) const
 Complex to real fft in x-y direction.
template<typename FPTYPE>
void fft3D_forward (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
template<typename FPTYPE>
void fft3D_backward (std::complex< FPTYPE > *in, std::complex< FPTYPE > *out) const
std::string get_device () const
 the device this bundle was configured for, "cpu" or "gpu"
std::string get_precision () const
 the precision this bundle was configured for, "single" or "double"
template<>
void fftxyfor (std::complex< float > *in, std::complex< float > *out) const
template<>
void fftxyfor (std::complex< double > *in, std::complex< double > *out) const
template<>
void fftzfor (std::complex< float > *in, std::complex< float > *out) const
template<>
void fftzfor (std::complex< double > *in, std::complex< double > *out) const
template<>
void fftxybac (std::complex< float > *in, std::complex< float > *out) const
template<>
void fftxybac (std::complex< double > *in, std::complex< double > *out) const
template<>
void fftzbac (std::complex< float > *in, std::complex< float > *out) const
template<>
void fftzbac (std::complex< double > *in, std::complex< double > *out) const
template<>
void fftxyr2c (float *in, std::complex< float > *out) const
template<>
void fftxyr2c (double *in, std::complex< double > *out) const
template<>
void fftxyc2r (std::complex< float > *in, float *out) const
template<>
void fftxyc2r (std::complex< double > *in, double *out) const
template<>
void fft3D_forward (std::complex< float > *in, std::complex< float > *out) const
template<>
void fft3D_forward (std::complex< double > *in, std::complex< double > *out) const
template<>
void fft3D_backward (std::complex< float > *in, std::complex< float > *out) const
template<>
void fft3D_backward (std::complex< double > *in, std::complex< double > *out) const
template<>
float * get_rspace_data () const
template<>
double * get_rspace_data () const
template<>
std::complex< float > * get_auxr_data () const
template<>
std::complex< double > * get_auxr_data () const
template<>
std::complex< float > * get_auxg_data () const
template<>
std::complex< double > * get_auxg_data () const
template<>
std::complex< float > * get_auxr_3d_data () const
template<>
std::complex< double > * get_auxr_3d_data () const

Private Member Functions

FFT_BASE< float > * get_host_fft_float () const
FFT_BASE< double > * get_host_fft_double () const

Private Attributes

int fft_mode = 0
bool float_flag = false
bool double_flag = false
std::shared_ptr< FFT_BASE< float > > fft_float = nullptr
std::shared_ptr< FFT_BASE< double > > fft_double = nullptr
std::shared_ptr< FFT_BASE< float > > host_fft_float = nullptr
std::shared_ptr< FFT_BASE< double > > host_fft_double = nullptr
std::string device = "cpu"
std::string precision = "double"
int dsp_cluster_id_ = 0

Constructor & Destructor Documentation

◆ FFT_Bundle() [1/2]

ModuleBase::FFT_Bundle::FFT_Bundle ( )
inline

◆ ~FFT_Bundle()

ModuleBase::FFT_Bundle::~FFT_Bundle ( )
Here is the call graph for this function:

◆ FFT_Bundle() [2/2]

ModuleBase::FFT_Bundle::FFT_Bundle ( std::string device_in,
std::string precision_in )
inline

Constructor with device and precision.

Parameters
device_indevice type, cpu or gpu.
precision_inprecision type, single or double.

the function will check the input device and precision, and set the device and precision.

Member Function Documentation

◆ clear()

void ModuleBase::FFT_Bundle::clear ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearFFT()

void ModuleBase::FFT_Bundle::clearFFT ( )
Here is the caller graph for this function:

◆ fft3D_backward() [1/3]

template<>
void ModuleBase::FFT_Bundle::fft3D_backward ( std::complex< double > * in,
std::complex< double > * out ) const

◆ fft3D_backward() [2/3]

template<>
void ModuleBase::FFT_Bundle::fft3D_backward ( std::complex< float > * in,
std::complex< float > * out ) const

◆ fft3D_backward() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fft3D_backward ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

◆ fft3D_forward() [1/3]

template<>
void ModuleBase::FFT_Bundle::fft3D_forward ( std::complex< double > * in,
std::complex< double > * out ) const

◆ fft3D_forward() [2/3]

template<>
void ModuleBase::FFT_Bundle::fft3D_forward ( std::complex< float > * in,
std::complex< float > * out ) const

◆ fft3D_forward() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fft3D_forward ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

◆ fftxybac() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftxybac ( std::complex< double > * in,
std::complex< double > * out ) const
Here is the call graph for this function:

◆ fftxybac() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftxybac ( std::complex< float > * in,
std::complex< float > * out ) const
Here is the call graph for this function:

◆ fftxybac() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftxybac ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

Backward fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the backward fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxybac in the accurate fft class.

◆ fftxyc2r() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftxyc2r ( std::complex< double > * in,
double * out ) const
Here is the call graph for this function:

◆ fftxyc2r() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftxyc2r ( std::complex< float > * in,
float * out ) const
Here is the call graph for this function:

◆ fftxyc2r() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftxyc2r ( std::complex< FPTYPE > * in,
FPTYPE * out ) const

Complex to real fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the complex to real fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyc2r in the accurate fft class.

◆ fftxyfor() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftxyfor ( std::complex< double > * in,
std::complex< double > * out ) const
Here is the call graph for this function:

◆ fftxyfor() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftxyfor ( std::complex< float > * in,
std::complex< float > * out ) const
Here is the call graph for this function:

◆ fftxyfor() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftxyfor ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

Forward fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the forward fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyfor in the accurate fft class.

◆ fftxyr2c() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftxyr2c ( double * in,
std::complex< double > * out ) const
Here is the call graph for this function:

◆ fftxyr2c() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftxyr2c ( float * in,
std::complex< float > * out ) const
Here is the call graph for this function:

◆ fftxyr2c() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftxyr2c ( FPTYPE * in,
std::complex< FPTYPE > * out ) const

Real to complex fft in x-y direction.

Parameters
ininput data.
outoutput data.

the function will do the real to complex fft in x and y direction, which is used in the cpu-like fft.As an interface, the function will call the fftxyr2c in the accurate fft class.

◆ fftzbac() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftzbac ( std::complex< double > * in,
std::complex< double > * out ) const
Here is the call graph for this function:

◆ fftzbac() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftzbac ( std::complex< float > * in,
std::complex< float > * out ) const
Here is the call graph for this function:

◆ fftzbac() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftzbac ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

Backward fft in z direction.

Parameters
ininput data.
outoutput data.

the function will do the backward many fft in z direction, which is used in the cpu-like fft.As an interface, the function will call the fftzbac in the accurate fft class.

◆ fftzfor() [1/3]

template<>
void ModuleBase::FFT_Bundle::fftzfor ( std::complex< double > * in,
std::complex< double > * out ) const
Here is the call graph for this function:

◆ fftzfor() [2/3]

template<>
void ModuleBase::FFT_Bundle::fftzfor ( std::complex< float > * in,
std::complex< float > * out ) const
Here is the call graph for this function:

◆ fftzfor() [3/3]

template<typename FPTYPE>
void ModuleBase::FFT_Bundle::fftzfor ( std::complex< FPTYPE > * in,
std::complex< FPTYPE > * out ) const

Forward fft in z direction.

Parameters
ininput data.
outoutput data.

The function will do the forward many fft in z direction, As an interface, the function will call the fftzfor in the accurate fft class. which is used in the cpu-like fft.

◆ get_auxg_data() [1/3]

template<>
std::complex< double > * ModuleBase::FFT_Bundle::get_auxg_data ( ) const
Here is the call graph for this function:

◆ get_auxg_data() [2/3]

template<>
std::complex< float > * ModuleBase::FFT_Bundle::get_auxg_data ( ) const
Here is the call graph for this function:

◆ get_auxg_data() [3/3]

template<typename FPTYPE>
std::complex< FPTYPE > * ModuleBase::FFT_Bundle::get_auxg_data ( ) const

Get the auxg data.

Returns
std::complex<FPTYPE>* the auxg data.

the function will return the auxg data, which is used in the cpu-like fft.

◆ get_auxr_3d_data() [1/3]

template<>
std::complex< double > * ModuleBase::FFT_Bundle::get_auxr_3d_data ( ) const

◆ get_auxr_3d_data() [2/3]

template<>
std::complex< float > * ModuleBase::FFT_Bundle::get_auxr_3d_data ( ) const

◆ get_auxr_3d_data() [3/3]

template<typename FPTYPE>
std::complex< FPTYPE > * ModuleBase::FFT_Bundle::get_auxr_3d_data ( ) const

Get the auxr 3d data.

Returns
std::complex<FPTYPE>* the auxr 3d data.

the function will return the auxr 3d data, which is used in the gpu-like fft.

◆ get_auxr_data() [1/3]

template<>
std::complex< double > * ModuleBase::FFT_Bundle::get_auxr_data ( ) const
Here is the call graph for this function:

◆ get_auxr_data() [2/3]

template<>
std::complex< float > * ModuleBase::FFT_Bundle::get_auxr_data ( ) const
Here is the call graph for this function:

◆ get_auxr_data() [3/3]

template<typename FPTYPE>
std::complex< FPTYPE > * ModuleBase::FFT_Bundle::get_auxr_data ( ) const

Get the auxr data.

Returns
std::complex<FPTYPE>* the auxr data.

the function will return the auxr data, which is used in the cpu-like fft.

Here is the caller graph for this function:

◆ get_device()

std::string ModuleBase::FFT_Bundle::get_device ( ) const
inline

the device this bundle was configured for, "cpu" or "gpu"

Here is the caller graph for this function:

◆ get_host_fft_double()

FFT_BASE< double > * ModuleBase::FFT_Bundle::get_host_fft_double ( ) const
inlineprivate
Here is the caller graph for this function:

◆ get_host_fft_float()

FFT_BASE< float > * ModuleBase::FFT_Bundle::get_host_fft_float ( ) const
inlineprivate
Here is the caller graph for this function:

◆ get_precision()

std::string ModuleBase::FFT_Bundle::get_precision ( ) const
inline

the precision this bundle was configured for, "single" or "double"

Here is the caller graph for this function:

◆ get_rspace_data() [1/3]

template<>
double * ModuleBase::FFT_Bundle::get_rspace_data ( ) const
Here is the call graph for this function:

◆ get_rspace_data() [2/3]

template<>
float * ModuleBase::FFT_Bundle::get_rspace_data ( ) const
Here is the call graph for this function:

◆ get_rspace_data() [3/3]

template<typename FPTYPE>
FPTYPE * ModuleBase::FFT_Bundle::get_rspace_data ( ) const

Get the real space data.

Returns
FPTYPE* the real space data.

the function will return the real space data, which is used in the cpu-like fft.

◆ initfft()

void ModuleBase::FFT_Bundle::initfft ( int nx_in,
int ny_in,
int nz_in,
int lixy_in,
int rixy_in,
int ns_in,
int nplane_in,
int nproc_in,
bool gamma_only_in,
bool xprime_in = true,
bool mpifft_in = false )

Initialize the fft parameters.

Parameters
nx_innumber of grid points in x direction.
ny_innumber of grid points in y direction.
nz_innumber of grid points in z direction.
lixy_inthe position of the left boundary in the x-y plane.
rixy_inthe position of the right boundary in the x-y plane.
ns_innumber of stick whcih is used in the Z direction.
nplane_innumber of x-y planes.
nproc_innumber of processors.
gamma_only_inwhether only gamma point is used.
xprime_inwhether xprime is used.

the function will initialize the many-fft parameters Wheatley in cpu or gpu device.

Here is the call graph for this function:

◆ initfftmode()

void ModuleBase::FFT_Bundle::initfftmode ( int fft_mode_in)
inline

Initialize the fft mode.

Parameters
fft_mode_infft mode.

the function will initialize the fft mode.

Here is the caller graph for this function:

◆ resource_handler()

void ModuleBase::FFT_Bundle::resource_handler ( const int flag) const

◆ set_dsp_cluster_id()

void ModuleBase::FFT_Bundle::set_dsp_cluster_id ( int id)
inline

Set the DSP cluster id for the FFT_DSP backend.

Parameters
idcluster id, typically computed as (MPI rank % dsp_count).

Caller-injected DSP routing info; only used when device == "dsp".

◆ setfft()

void ModuleBase::FFT_Bundle::setfft ( std::string device_in,
std::string precision_in )

Set device and precision.

Parameters
device_indevice type, cpu or gpu.
precision_inprecision type, single or double.

the function will check the input device and precision, and set the device and precision.

Here is the caller graph for this function:

◆ setupFFT()

void ModuleBase::FFT_Bundle::setupFFT ( )

Member Data Documentation

◆ device

std::string ModuleBase::FFT_Bundle::device = "cpu"
private

◆ double_flag

bool ModuleBase::FFT_Bundle::double_flag = false
private

◆ dsp_cluster_id_

int ModuleBase::FFT_Bundle::dsp_cluster_id_ = 0
private

◆ fft_double

std::shared_ptr<FFT_BASE<double> > ModuleBase::FFT_Bundle::fft_double = nullptr
private

◆ fft_float

std::shared_ptr<FFT_BASE<float> > ModuleBase::FFT_Bundle::fft_float = nullptr
private

◆ fft_mode

int ModuleBase::FFT_Bundle::fft_mode = 0
private

◆ float_flag

bool ModuleBase::FFT_Bundle::float_flag = false
private

◆ host_fft_double

std::shared_ptr<FFT_BASE<double> > ModuleBase::FFT_Bundle::host_fft_double = nullptr
private

◆ host_fft_float

std::shared_ptr<FFT_BASE<float> > ModuleBase::FFT_Bundle::host_fft_float = nullptr
private

◆ precision

std::string ModuleBase::FFT_Bundle::precision = "double"
private

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