SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sirius::wf::Wave_functions_fft< T > Class Template Reference

Wave-fucntions in the FFT-friendly distribution. More...

#include <wave_functions.hpp>

Inherits sirius::wf::Wave_functions_base< T >.

Public Member Functions

 Wave_functions_fft ()
 Constructor. More...
 
 Wave_functions_fft (std::shared_ptr< fft::Gvec_fft > gkvec_fft__, Wave_functions< T > &wf__, spin_index s__, band_range br__, unsigned int shuffle_flag___)
 Constructor. More...
 
Wave_functions_fftoperator= (Wave_functions_fft &&src__)
 Move assignment operator. More...
 
 ~Wave_functions_fft ()
 Destructor. More...
 
int num_wf_local () const
 Return local number of wave-functions. More...
 
auto spl_num_wf () const
 Return the split index for the number of wave-functions. More...
 
std::complex< T > & pw_coeffs (int ig__, band_index b__)
 Return reference to the plane-wave coefficient. More...
 
T * pw_coeffs_spfft (sddk::memory_t mem__, band_index b__)
 Return pointer to the beginning of wave-functions casted to real type as required by the SpFFT library. More...
 
auto on_device () const
 Return true if data is avaliable on the device memory. More...
 
std::complex< T > const * at (sddk::memory_t mem__, int i__, band_index b__) const
 Return const pointer to the data for a given plane-wave and band indices. More...
 
auto at (sddk::memory_t mem__, int i__, band_index b__)
 Return pointer to the data for a given plane-wave and band indices. More...
 
- Public Member Functions inherited from sirius::wf::Wave_functions_base< T >
 Wave_functions_base ()
 Constructor. More...
 
 Wave_functions_base (int num_pw__, int num_mt__, num_mag_dims num_md__, num_bands num_wf__, sddk::memory_t default_mem__)
 Constructor. More...
 
auto memory_guard (sddk::memory_t mem__, wf::copy_to copy_to__=copy_to::none) const
 Return an instance of the memory guard. More...
 
auto num_sc () const
 Return number of spin components. More...
 
auto num_md () const
 Return number of magnetic dimensions. More...
 
auto num_wf () const
 Return number of wave-functions. More...
 
auto ld () const
 Return leading dimensions of the wave-functions coefficients array. More...
 
auto actual_spin_index (spin_index s__) const
 Return the actual spin index of the wave-functions. More...
 
void zero (sddk::memory_t mem__, spin_index s__, band_range br__)
 Zero a spin component of the wave-functions in a band range. More...
 
void zero (sddk::memory_t mem__)
 Zero all wave-functions. More...
 
std::complex< T > const * at (sddk::memory_t mem__, int i__, spin_index s__, band_index b__) const
 Return const pointer to the wave-function coefficient at a given index, spin and band. More...
 
auto at (sddk::memory_t mem__, int i__, spin_index s__, band_index b__)
 Return pointer to the wave-function coefficient at a given index, spin and band. More...
 
void allocate (sddk::memory_t mem__)
 Allocate wave-functions. More...
 
void deallocate (sddk::memory_t mem__)
 Deallocate wave-functions. More...
 
void copy_to (sddk::memory_t mem__)
 Copy date to host or device. More...
 

Private Member Functions

auto grid_layout (int n__)
 Return COSTA grd layout description. More...
 
void shuffle_to_fft_layout (spin_index ispn__, band_range b__)
 Shuffle wave-function to the FFT distribution. More...
 
void shuffle_to_wf_layout (spin_index ispn__, band_range b__)
 Shuffle wave-function to the original slab layout. More...
 

Private Attributes

std::shared_ptr< fft::Gvec_fftgkvec_fft_
 Pointer to FFT-friendly G+k vector deistribution. More...
 
splindex_block spl_num_wf_
 Split number of wave-functions between column communicator. More...
 
Wave_functions< T > * wf_ {nullptr}
 Pointer to the original wave-functions. More...
 
spin_index s_ {0}
 Spin-index of the wave-function component. More...
 
band_range br_ {0}
 Range of bands in the input wave-functions to be swapped. More...
 
unsigned int shuffle_flag_ {0}
 Direction of the reshuffling: to FFT layout or back to WF layout or both. More...
 
bool on_device_ {false}
 True if the FFT wave-functions are also available on the device. More...
 

Additional Inherited Members

- Protected Attributes inherited from sirius::wf::Wave_functions_base< T >
int num_pw_ {0}
 Local number of plane-wave coefficients. More...
 
int num_mt_ {0}
 Local number of muffin-tin coefficients. More...
 
num_mag_dims num_md_ {0}
 Number of magnetic dimensions (0, 1, or 3). More...
 
num_bands num_wf_ {0}
 Total number of wave-functions. More...
 
num_spins num_sc_ {0}
 Number of spin components (1 or 2). More...
 
std::array< sddk::mdarray< std::complex< T >, 2 >, 2 > data_
 Data storage for the wave-functions. More...
 

Detailed Description

template<typename T>
class sirius::wf::Wave_functions_fft< T >

Wave-fucntions in the FFT-friendly distribution.

To reduce the FFT MPI communication volume, it is often beneficial to redistribute wave-functions from a default slab layout to a FFT-friendly layout. Often this is a full swap from G-vector to band distribution. In general this is a redistribution of data from [N x 1] to [M x K] MPI grids.

                 band index               band index               band index
              ┌──────────────┐          ┌───────┬──────┐          ┌───┬───┬───┬──┐
              │              │          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              ├──────────────┤          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              │              │ partial  │       │      │   full   │   │   │   │  │
              │              │  swap    │       │      │   swap   │   │   │   │  │
  G+k index   ├──────────────┤    ->    ├───────┼──────┤    ->    ├───┼───┼───┼──┤
(distributed) │              │          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              ├──────────────┤          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              │              │          │       │      │          │   │   │   │  │
              └──────────────┘          └───────┴──────┘          └───┴───┴───┴──┘

Wave-functions in FFT distribution are scalar with only one spin component.

Template Parameters
TPrecision type of the wave-functions (double or float).

Definition at line 838 of file wave_functions.hpp.

Constructor & Destructor Documentation

◆ Wave_functions_fft() [1/2]

template<typename T >
sirius::wf::Wave_functions_fft< T >::Wave_functions_fft ( )
inline

Constructor.

Definition at line 1062 of file wave_functions.hpp.

◆ Wave_functions_fft() [2/2]

template<typename T >
sirius::wf::Wave_functions_fft< T >::Wave_functions_fft ( std::shared_ptr< fft::Gvec_fft gkvec_fft__,
Wave_functions< T > &  wf__,
spin_index  s__,
band_range  br__,
unsigned int  shuffle_flag___ 
)
inline

Constructor.

Definition at line 1067 of file wave_functions.hpp.

◆ ~Wave_functions_fft()

template<typename T >
sirius::wf::Wave_functions_fft< T >::~Wave_functions_fft ( )
inline

Destructor.

Definition at line 1138 of file wave_functions.hpp.

Member Function Documentation

◆ grid_layout()

template<typename T >
auto sirius::wf::Wave_functions_fft< T >::grid_layout ( int  n__)
inlineprivate

Return COSTA grd layout description.

Definition at line 857 of file wave_functions.hpp.

◆ shuffle_to_fft_layout()

template<typename T >
void sirius::wf::Wave_functions_fft< T >::shuffle_to_fft_layout ( spin_index  ispn__,
band_range  b__ 
)
inlineprivate

Shuffle wave-function to the FFT distribution.

Definition at line 891 of file wave_functions.hpp.

◆ shuffle_to_wf_layout()

template<typename T >
void sirius::wf::Wave_functions_fft< T >::shuffle_to_wf_layout ( spin_index  ispn__,
band_range  b__ 
)
inlineprivate

Shuffle wave-function to the original slab layout.

Definition at line 968 of file wave_functions.hpp.

◆ operator=()

template<typename T >
Wave_functions_fft & sirius::wf::Wave_functions_fft< T >::operator= ( Wave_functions_fft< T > &&  src__)
inline

Move assignment operator.

Definition at line 1114 of file wave_functions.hpp.

◆ num_wf_local()

template<typename T >
int sirius::wf::Wave_functions_fft< T >::num_wf_local ( ) const
inline

Return local number of wave-functions.

Wave-function band index is distributed over the columns of MPI grid. Each group of FFT communiators is working on its local set of wave-functions.

Definition at line 1158 of file wave_functions.hpp.

◆ spl_num_wf()

template<typename T >
auto sirius::wf::Wave_functions_fft< T >::spl_num_wf ( ) const
inline

Return the split index for the number of wave-functions.

Definition at line 1164 of file wave_functions.hpp.

◆ pw_coeffs()

template<typename T >
std::complex< T > & sirius::wf::Wave_functions_fft< T >::pw_coeffs ( int  ig__,
band_index  b__ 
)
inline

Return reference to the plane-wave coefficient.

Definition at line 1170 of file wave_functions.hpp.

◆ pw_coeffs_spfft()

template<typename T >
T * sirius::wf::Wave_functions_fft< T >::pw_coeffs_spfft ( sddk::memory_t  mem__,
band_index  b__ 
)
inline

Return pointer to the beginning of wave-functions casted to real type as required by the SpFFT library.

Definition at line 1176 of file wave_functions.hpp.

◆ on_device()

template<typename T >
auto sirius::wf::Wave_functions_fft< T >::on_device ( ) const
inline

Return true if data is avaliable on the device memory.

Definition at line 1182 of file wave_functions.hpp.

◆ at() [1/2]

template<typename T >
std::complex< T > const * sirius::wf::Wave_functions_fft< T >::at ( sddk::memory_t  mem__,
int  i__,
band_index  b__ 
) const
inline

Return const pointer to the data for a given plane-wave and band indices.

Definition at line 1189 of file wave_functions.hpp.

◆ at() [2/2]

template<typename T >
auto sirius::wf::Wave_functions_fft< T >::at ( sddk::memory_t  mem__,
int  i__,
band_index  b__ 
)
inline

Return pointer to the data for a given plane-wave and band indices.

Definition at line 1196 of file wave_functions.hpp.

Member Data Documentation

◆ gkvec_fft_

template<typename T >
std::shared_ptr<fft::Gvec_fft> sirius::wf::Wave_functions_fft< T >::gkvec_fft_
private

Pointer to FFT-friendly G+k vector deistribution.

Definition at line 842 of file wave_functions.hpp.

◆ spl_num_wf_

template<typename T >
splindex_block sirius::wf::Wave_functions_fft< T >::spl_num_wf_
private

Split number of wave-functions between column communicator.

Definition at line 844 of file wave_functions.hpp.

◆ wf_

template<typename T >
Wave_functions<T>* sirius::wf::Wave_functions_fft< T >::wf_ {nullptr}
private

Pointer to the original wave-functions.

Definition at line 846 of file wave_functions.hpp.

◆ s_

template<typename T >
spin_index sirius::wf::Wave_functions_fft< T >::s_ {0}
private

Spin-index of the wave-function component.

Definition at line 848 of file wave_functions.hpp.

◆ br_

template<typename T >
band_range sirius::wf::Wave_functions_fft< T >::br_ {0}
private

Range of bands in the input wave-functions to be swapped.

Definition at line 850 of file wave_functions.hpp.

◆ shuffle_flag_

template<typename T >
unsigned int sirius::wf::Wave_functions_fft< T >::shuffle_flag_ {0}
private

Direction of the reshuffling: to FFT layout or back to WF layout or both.

Definition at line 852 of file wave_functions.hpp.

◆ on_device_

template<typename T >
bool sirius::wf::Wave_functions_fft< T >::on_device_ {false}
private

True if the FFT wave-functions are also available on the device.

Definition at line 854 of file wave_functions.hpp.


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