(git:e70887f)
Loading...
Searching...
No Matches
fft_lib.h File Reference
#include "../mpiwrap/cp_mpi.h"
#include "fft_lib_fftw.h"
#include <complex.h>
#include <stdbool.h>

Go to the source code of this file.

Enumerations

enum  fft_lib { FFT_LIB_FFTW , FFT_LIB_GPU , FFT_LIB_DEFAULT }

Functions

int fft_init_lib (const fft_lib lib, const int fftw_planning_flag, const bool use_guru_interface, const char *wisdom_file)
 Initialize the FFT library (if not done externally).
void fft_finalize_lib (const char *wisdom_file)
 Finalize the FFT library (if not done externally).
int fft_lib_default_library ()
 Get the default library (GPU if offloading was enabled, else FFTW3).
int fft_lib_backend_in_use ()
 Inquire the library backend in use.
bool fft_lib_has_guru_interface ()
 Whether compound MPI implementations are available.
void fft_allocate_double (const int length, double **buffer)
 Allocate buffer of type double.
void fft_allocate_complex (const int length, double complex **buffer)
 Allocate buffer of type double complex.
void fft_free_double (double *buffer)
 Allocate buffer of type double.
void fft_free_complex (double complex *buffer)
 Allocate buffer of type double complex.
void fft_register_1d_local (const bool dir, const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double complex *grid_in, double complex *grid_out)
 Register a local 1D C2C FFT.
void fft_register_1d_r2c_local (const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double *grid_in, double complex *grid_out)
 Register a local 1D R2C FFT.
void fft_register_1d_c2r_local (const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double complex *grid_in, double *grid_out)
 Register a local 1D C2R FFT.
void fft_register_2d_local (const bool dir, const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double complex *grid_in, double complex *grid_out)
 Register a local 2D FFT.
void fft_register_2d_r2c_local (const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double *grid_in, double complex *grid_out)
 Register a local 2D R2C FFT.
void fft_register_2d_c2r_local (const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double complex *grid_in, double *grid_out)
 Register a local 2D C2R FFT.
void fft_register_3d_local (const bool dir, const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double complex *grid_in, double complex *grid_out)
 Register a local 3D FFT.
void fft_register_3d_r2c_local (const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double *grid_in, double complex *grid_out)
 Register a local 3D R2C FFT.
void fft_register_3d_c2r_local (const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double complex *grid_in, double *grid_out)
 Register a local 3D C2R FFT.
void fft_1d_local (const bool dir, const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double complex *grid_in, double complex *grid_out)
 Perform a local 1D FFT.
void fft_1d_r2c_local (const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double *grid_in, double complex *grid_out)
 Perform a local 1D R2C FFT.
void fft_1d_c2r_local (const int fft_size, const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, const int leading_dimension_rs, const int leading_dimension_gs, double complex *grid_in, double *grid_out)
 Perform a local 1D C2R FFT.
void fft_2d_local (const bool dir, const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double complex *grid_in, double complex *grid_out)
 Perform a local 2D FFT.
void fft_2d_r2c_local (const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double *grid_in, double complex *grid_out)
 Perform a local 2D R2C FFT.
void fft_2d_c2r_local (const int fft_size[2], const int number_of_ffts, const bool transpose_rs, const bool transpose_gs, double complex *grid_in, double *grid_out)
 Perform a local 2D C2R FFT.
void fft_3d_local (const bool dir, const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double complex *grid_in, double complex *grid_out)
 Perform a local 3D FFT.
void fft_3d_r2c_local (const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double *grid_in, double complex *grid_out)
 Perform a local 3D R2C FFT.
void fft_3d_c2r_local (const int fft_size[3], const int number_of_ffts, const bool transpose_in, const bool transpose_out, double complex *grid_in, double *grid_out)
 Perform a local 3D C2R FFT.

Enumeration Type Documentation

◆ fft_lib

enum fft_lib
Enumerator
FFT_LIB_FFTW 
FFT_LIB_GPU 
FFT_LIB_DEFAULT 

Definition at line 16 of file fft_lib.h.

Function Documentation

◆ fft_init_lib()

int fft_init_lib ( const fft_lib lib,
const int fftw_planning_flag,
const bool use_guru_interface,
const char * wisdom_file )

Initialize the FFT library (if not done externally).

Author
Frederick Stein
Parameters
libFFT backend to use.
fftw_planning_flagFFTW planning mode.
use_guru_interfaceWhether the FFTW Guru interface may be used.
wisdom_filePath to the FFTW wisdom file.
Author
Frederick Stein

Definition at line 84 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_finalize_lib()

void fft_finalize_lib ( const char * wisdom_file)

Finalize the FFT library (if not done externally).

Author
Frederick Stein
Parameters
wisdom_filePath to the FFTW wisdom file.
Author
Frederick Stein

Definition at line 134 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_lib_default_library()

int fft_lib_default_library ( )

Get the default library (GPU if offloading was enabled, else FFTW3).

Author
Frederick Stein

Definition at line 144 of file fft_lib.c.

Here is the caller graph for this function:

◆ fft_lib_backend_in_use()

int fft_lib_backend_in_use ( )

Inquire the library backend in use.

Author
Frederick Stein

Inquire the library backend in use.

Author
Frederick Stein

Definition at line 150 of file fft_lib.c.

Here is the caller graph for this function:

◆ fft_lib_has_guru_interface()

bool fft_lib_has_guru_interface ( )

Whether compound MPI implementations are available.

Author
Frederick Stein

Whether compound MPI implementations are available.

Author
Frederick Stein

Definition at line 156 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_allocate_double()

void fft_allocate_double ( const int length,
double ** buffer )

Allocate buffer of type double.

Author
Frederick Stein
Parameters
lengthNumber of elements.
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 174 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_allocate_complex()

void fft_allocate_complex ( const int length,
double complex ** buffer )

Allocate buffer of type double complex.

Author
Frederick Stein
Parameters
lengthNumber of elements.
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 185 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_free_double()

void fft_free_double ( double * buffer)

Allocate buffer of type double.

Author
Frederick Stein
Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 195 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_free_complex()

void fft_free_complex ( double complex * buffer)

Allocate buffer of type double complex.

Author
Frederick Stein
Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 210 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_1d_local()

void fft_register_1d_local ( const bool dir,
const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double complex * grid_in,
double complex * grid_out )

Register a local 1D C2C FFT.

Author
Frederick Stein
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 233 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_1d_r2c_local()

void fft_register_1d_r2c_local ( const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double * grid_in,
double complex * grid_out )

Register a local 1D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 266 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_1d_c2r_local()

void fft_register_1d_c2r_local ( const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double complex * grid_in,
double * grid_out )

Register a local 1D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 300 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_2d_local()

void fft_register_2d_local ( const bool dir,
const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double complex * grid_out )

Register a local 2D FFT.

Author
Frederick Stein
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 333 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_2d_r2c_local()

void fft_register_2d_r2c_local ( const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double * grid_in,
double complex * grid_out )

Register a local 2D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 361 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_2d_c2r_local()

void fft_register_2d_c2r_local ( const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double * grid_out )

Register a local 2D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 389 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_3d_local()

void fft_register_3d_local ( const bool dir,
const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double complex * grid_out )

Register a local 3D FFT.

Author
Frederick Stein
Note
fft_3d_bw_local(grid_gs, grid_rs, n) is the reverse to fft_3d_rw_local(grid_rs, grid_gs, n) (ignoring normalization).
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 420 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_3d_r2c_local()

void fft_register_3d_r2c_local ( const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double * grid_in,
double complex * grid_out )

Register a local 3D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 447 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_register_3d_c2r_local()

void fft_register_3d_c2r_local ( const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double * grid_out )

Register a local 3D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 475 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_1d_local()

void fft_1d_local ( const bool dir,
const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double complex * grid_in,
double complex * grid_out )

Perform a local 1D FFT.

Author
Frederick Stein
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 506 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_1d_r2c_local()

void fft_1d_r2c_local ( const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double * grid_in,
double complex * grid_out )

Perform a local 1D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 538 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_1d_c2r_local()

void fft_1d_c2r_local ( const int fft_size,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
double complex * grid_in,
double * grid_out )

Perform a local 1D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
leading_dimension_inLeading dimension of the input array.
leading_dimension_outLeading dimension of the output array.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 571 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_2d_local()

void fft_2d_local ( const bool dir,
const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double complex * grid_out )

Perform a local 2D FFT.

Author
Frederick Stein
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 603 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_2d_r2c_local()

void fft_2d_r2c_local ( const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double * grid_in,
double complex * grid_out )

Perform a local 2D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 630 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_2d_c2r_local()

void fft_2d_c2r_local ( const int fft_size[2],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double * grid_out )

Perform a local 2D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 657 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_3d_local()

void fft_3d_local ( const bool dir,
const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double complex * grid_out )

Perform a local 3D FFT.

Author
Frederick Stein
Parameters
dirFFT direction (forward or backward).
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 685 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_3d_r2c_local()

void fft_3d_r2c_local ( const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double * grid_in,
double complex * grid_out )

Perform a local 3D R2C FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 712 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fft_3d_c2r_local()

void fft_3d_c2r_local ( const int fft_size[3],
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out,
double complex * grid_in,
double * grid_out )

Perform a local 3D C2R FFT.

Author
Frederick Stein
Parameters
fft_sizeSize of the transform in each dimension.
number_of_fftsNumber of independent (batched) transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
grid_inInput grid buffer.
grid_outOutput grid buffer.
Author
Frederick Stein

Definition at line 739 of file fft_lib.c.

Here is the call graph for this function:
Here is the caller graph for this function: