![]() |
(git:e70887f)
|
#include "fft_lib.h"#include "../offload/offload_runtime.h"#include "fft_lib_fftw.h"#include "fft_timer.h"#include "fft_utils.h"#include "gpu/fft_gpu.h"#include "../base/cp_assert.h"#include <math.h>#include <stdarg.h>#include <stdbool.h>#include <stddef.h>#include <stdio.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | FFT_DISPATCH_VOID(gpu_call, fftw_call) |
| Forward a void FFT call to the selected backend. | |
Functions | |
| static int | fft_timer_start (const char *format,...) |
| Start an FFT timer from a printf-style label. | |
| int | fft_init_acc_lib () |
| Initialize the accelerated FFT library. | |
| 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_acc_lib () |
| Finalize the accelerated FFT library. | |
| 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 () |
| Whether a compound MPI implementation is available. | |
| bool | fft_lib_has_guru_interface () |
| Whether a compound MPI implementation is 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_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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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_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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
Variables | |
| const int | fft_lib_default = -1 |
| fft_lib | fft_lib_choice = fft_lib_default |
| bool | fft_lib_initialized = false |
| #define FFT_DISPATCH_VOID | ( | gpu_call, | |
| fftw_call ) |
Forward a void FFT call to the selected backend.
|
static |
| int fft_init_acc_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).
| lib | FFT backend to use. |
| fftw_planning_flag | FFTW planning mode. |
| use_guru_interface | Whether the FFTW Guru interface may be used. |
| wisdom_file | Path to the FFTW wisdom file. |
Definition at line 84 of file fft_lib.c.
| void fft_finalize_acc_lib | ( | ) |
| void fft_finalize_lib | ( | const char * | wisdom_file | ) |
| int fft_lib_default_library | ( | ) |
| int fft_lib_backend_in_use | ( | ) |
| bool fft_lib_has_guru_interface | ( | ) |
| void fft_allocate_double | ( | const int | length, |
| double ** | buffer ) |
| void fft_allocate_complex | ( | const int | length, |
| double complex ** | buffer ) |
| void fft_free_double | ( | double * | buffer | ) |
| void fft_free_complex | ( | double complex * | buffer | ) |
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 233 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 266 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 300 of file fft_lib.c.
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 333 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 361 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 389 of file fft_lib.c.
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 420 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 447 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 475 of file fft_lib.c.
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 506 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 538 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| leading_dimension_in | Leading dimension of the input array. |
| leading_dimension_out | Leading dimension of the output array. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 571 of file fft_lib.c.
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 603 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 630 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 657 of file fft_lib.c.
| 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.
| dir | FFT direction (forward or backward). |
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 685 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 712 of file fft_lib.c.
| 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.
| fft_size | Size of the transform in each dimension. |
| number_of_ffts | Number of independent (batched) transforms. |
| transpose_in | Whether the input array uses the transposed layout. |
| transpose_out | Whether the output array uses the transposed layout. |
| grid_in | Input grid buffer. |
| grid_out | Output grid buffer. |
Definition at line 739 of file fft_lib.c.
| fft_lib fft_lib_choice = fft_lib_default |