(git:e70887f)
Loading...
Searching...
No Matches
fft_lib_fftw.c File Reference
#include "fft_lib_fftw.h"
#include "fft_key.h"
#include "fft_timer.h"
#include "fft_utils.h"
#include "../base/cp_assert.h"
#include <math.h>
#include <omp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int fft_fftw_init_lib (const fftw_plan_type fftw_planning_flag, const bool use_guru_interface, const char *wisdom_file)
 Initialize the FFT library (if not done externally).
void fft_fftw_finalize_lib (const char *wisdom_file)
 Finalize the FFT library (if not done externally).
bool fft_fftw_lib_has_guru_interface ()
 Whether a distributed FFT implementation is available.
void fft_fftw_allocate_double (const int length, double **buffer)
 Allocate buffer of type double.
void fft_fftw_allocate_complex (const int length, double complex **buffer)
 Allocate buffer of type double complex.
void fft_fftw_free_double (double *buffer)
 Free buffer of type double.
void fft_fftw_free_complex (double complex *buffer)
 Free buffer of type double complex.
void fft_fftw_register_1d_local (const bool direction, 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)
 Performs a local C2C 1D FFT.
void fft_fftw_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)
 Performs a local forward R2C FFT.
void fft_fftw_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)
 Performs a local backwards C2R 1D FFT.
void fft_fftw_register_2d_local (const bool direction, 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)
 Performs a local C2C 2D FFT.
void fft_fftw_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)
 Performs a local forward R2C 2D FFT.
void fft_fftw_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)
 Performs a local backwards C2R 2D FFT.
void fft_fftw_register_3d_local (const bool direction, 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)
 Performs a local C2C 3D FFT.
void fft_fftw_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)
 Performs a local forward R2C 3D FFT.
void fft_fftw_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)
 Performs a local backwards R2C 3D FFT.
void fft_fftw_1d_local (const bool direction, 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)
 Performs a local forward C2C 1D FFT.
void fft_fftw_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)
 Performs a local forward R2C FFT.
void fft_fftw_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)
 Performs a local backwards C2R 1D FFT.
void fft_fftw_2d_local (const bool direction, 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)
 Performs a local C2C 2D FFT.
void fft_fftw_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)
 Performs a local forward R2C 2D FFT.
void fft_fftw_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)
 Performs a local backwards C2R 2D FFT.
void fft_fftw_3d_local (const bool direction, 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)
 Performs a local C2C 3D FFT.
void fft_fftw_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)
 Performs a local forward R2C 3D FFT.
void fft_fftw_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)
 Performs a local backwards R2C 3D FFT.

Variables

static bool has_guru_interface = false

Function Documentation

◆ fft_fftw_init_lib()

int fft_fftw_init_lib ( const fftw_plan_type fftw_planning_flag,
const bool use_guru_interface,
const char * wisdom_file )

Initialize the FFT library (if not done externally).

\brief Initialize the FFT library (if not done externally).

Parameters
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 787 of file fft_lib_fftw.c.

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

◆ fft_fftw_finalize_lib()

void fft_fftw_finalize_lib ( const char * wisdom_file)

Finalize the FFT library (if not done externally).

Parameters
wisdom_filePath to the FFTW wisdom file.
Author
Frederick Stein

Definition at line 856 of file fft_lib_fftw.c.

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

◆ fft_fftw_lib_has_guru_interface()

bool fft_fftw_lib_has_guru_interface ( )

Whether a distributed FFT implementation is available.

Whether the guru interface is available.

Author
Frederick Stein

Definition at line 898 of file fft_lib_fftw.c.

Here is the caller graph for this function:

◆ fft_fftw_allocate_double()

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

Allocate buffer of type double.

Parameters
lengthNumber of elements.
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 906 of file fft_lib_fftw.c.

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

◆ fft_fftw_allocate_complex()

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

Allocate buffer of type double complex.

Parameters
lengthNumber of elements.
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 925 of file fft_lib_fftw.c.

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

◆ fft_fftw_free_double()

void fft_fftw_free_double ( double * buffer)

Free buffer of type double.

Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 943 of file fft_lib_fftw.c.

Here is the caller graph for this function:

◆ fft_fftw_free_complex()

void fft_fftw_free_complex ( double complex * buffer)

Free buffer of type double complex.

Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 958 of file fft_lib_fftw.c.

Here is the caller graph for this function:

◆ fft_fftw_register_1d_local()

void fft_fftw_register_1d_local ( const bool direction,
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 )

Performs a local C2C 1D FFT.

Parameters
directionFFT 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 1355 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_1d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C FFT.

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 1422 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_1d_c2r_local()

void fft_fftw_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 )

Performs a local backwards C2R 1D FFT.

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 1496 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_2d_local()

void fft_fftw_register_2d_local ( const bool direction,
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 )

Performs a local C2C 2D FFT.

Parameters
directionFFT 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 1569 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_2d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C 2D FFT.

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 1641 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_2d_c2r_local()

void fft_fftw_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 )

Performs a local backwards C2R 2D FFT.

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 1722 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_3d_local()

void fft_fftw_register_3d_local ( const bool direction,
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 )

Performs a local C2C 3D FFT.

Parameters
directionFFT 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 1804 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_3d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C 3D FFT.

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 1854 of file fft_lib_fftw.c.

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

◆ fft_fftw_register_3d_c2r_local()

void fft_fftw_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 )

Performs a local backwards R2C 3D FFT.

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 1902 of file fft_lib_fftw.c.

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

◆ fft_fftw_1d_local()

void fft_fftw_1d_local ( const bool direction,
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 )

Performs a local forward C2C 1D FFT.

Parameters
directionFFT 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 1953 of file fft_lib_fftw.c.

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

◆ fft_fftw_1d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C FFT.

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 2054 of file fft_lib_fftw.c.

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

◆ fft_fftw_1d_c2r_local()

void fft_fftw_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 )

Performs a local backwards C2R 1D FFT.

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 2156 of file fft_lib_fftw.c.

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

◆ fft_fftw_2d_local()

void fft_fftw_2d_local ( const bool direction,
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 )

Performs a local C2C 2D FFT.

Parameters
directionFFT 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 2257 of file fft_lib_fftw.c.

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

◆ fft_fftw_2d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C 2D FFT.

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 2358 of file fft_lib_fftw.c.

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

◆ fft_fftw_2d_c2r_local()

void fft_fftw_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 )

Performs a local backwards C2R 2D FFT.

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 2469 of file fft_lib_fftw.c.

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

◆ fft_fftw_3d_local()

void fft_fftw_3d_local ( const bool direction,
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 )

Performs a local C2C 3D FFT.

Parameters
directionFFT 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 2583 of file fft_lib_fftw.c.

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

◆ fft_fftw_3d_r2c_local()

void fft_fftw_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 )

Performs a local forward R2C 3D FFT.

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 2638 of file fft_lib_fftw.c.

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

◆ fft_fftw_3d_c2r_local()

void fft_fftw_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 )

Performs a local backwards R2C 3D FFT.

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 2691 of file fft_lib_fftw.c.

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

Variable Documentation

◆ has_guru_interface

bool has_guru_interface = false
static

Definition at line 131 of file fft_lib_fftw.c.