(git:e70887f)
Loading...
Searching...
No Matches
fft_gpu.c File Reference
#include "fft_gpu.h"
#include "../../mpiwrap/cp_mpi.h"
#include "../../offload/offload_runtime.h"
#include "../fft_key.h"
#include "../fft_utils.h"
#include "../../base/cp_assert.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

void fft_gpu_init (void)
 Initializes the fft_gpu library.
void fft_gpu_finalize (void)
 Releases resources held by the fft_gpu library.
void ensure_memory_sizes (const size_t requested_buffer_size, const size_t requested_map_size)
 Checks size of device buffers and re-allocates them if necessary.
void fft_gpu_allocate_double (const int length, double **buffer)
 Allocate buffer of type double.
void fft_gpu_allocate_complex (const int length, double complex **buffer)
 Allocate buffer of type double complex.
void fft_gpu_free_double (double *buffer)
 Allocate buffer of type double.
void fft_gpu_free_complex (double complex *buffer)
 Allocate buffer of type double complex.
void fft_gpu_register_3d_local (const bool dir, const int *npts, const bool inplace, const int number_of_ffts, const bool transpose_in, const bool transpose_out)
 Performs a (double precision complex) 3D-FFT on the GPU.
void fft_gpu_register_3d_r2c_local (const bool dir, const int *npts, const bool inplace, const int number_of_ffts, const bool transpose_in, const bool transpose_out)
 Performs a 3D-R2C/C2R-FFT, on the GPU.
void fft_gpu_register_1d_local (const bool dir, const int n, const int m, const bool transpose_in, const bool transpose_out, const int leading_dimension_in, const int leading_dimension_out, const bool inplace)
 Performs a (double precision complex) 1D-FFT on the GPU.
void fft_gpu_register_1d_r2c_local (const bool dir, const int n, const int m, const bool transpose_in, const bool transpose_out, const int leading_dimension_in, const int leading_dimension_out, const bool inplace)
 Performs a (double precision complex) 1D-FFT on the GPU.
void fft_gpu_register_2d_local (const bool dir, const int n[2], const int m, const bool transpose_in, const bool transpose_out, const bool inplace)
 Performs a (double precision complex) 2D-FFT on the GPU.
void fft_gpu_register_2d_r2c_local (const bool dir, const int n[2], const int m, const bool transpose_in, const bool transpose_out, const bool inplace)
 Performs a (double precision complex) R2C/C2R2D-FFT on the GPU.
void fft_gpu_cfffg (const double *din, double *zout, const int *ghatmap, const int *npts, const int ngpts, const double scale)
 Performs a (double precision complex) FFT, followed by a (double precision complex) gather, on the GPU.
void fft_gpu_sfffc (const double *zin, double *dout, const int *ghatmap, const int *npts, const int ngpts, const int nmaps, const double scale)
 Performs a (double precision complex) scatter, followed by a (double precision complex) FFT, on the GPU.
void fft_gpu_3d_local (const double *zin, double *zout, const bool dir, const int *npts, const int number_of_ffts, const bool transpose_in, const bool transpose_out)
 Performs a (double precision complex) 3D-FFT on the GPU.
void fft_gpu_3d_r2c_local (const double *zin, double *zout, const bool dir, const int *npts, const int number_of_ffts, const bool transpose_in, const bool transpose_out)
 Performs a 3D-R2C/C2R-FFT, on the GPU.
void fft_gpu_cff (const double *din, double *zout, const int *npts)
 Performs a (double to complex double) blow-up and a (double precision complex) 2D-FFT on the GPU.
void fft_gpu_ffc (const double *zin, double *dout, const int *npts)
 Performs a (double precision complex) 2D-FFT and a (double complex to double) shrink-down on the GPU.
void fft_gpu_cf (const double *din, double *zout, const int *npts)
 Performs a (double to complex double) blow-up and a (double precision complex) 1D-FFT on the GPU.
void fft_gpu_fc (const double *zin, double *dout, const int *npts)
 Performs a (double precision complex) 1D-FFT and a (double complex to double) shrink-down on the GPU.
void fft_gpu_1d_local (const double *zin, double *zout, const bool dir, const int n, const int m, const bool transpose_in, const bool transpose_out, const int leading_dimension_in, const int leading_dimension_out)
 Performs a (double precision complex) 1D-FFT on the GPU.
void fft_gpu_1d_r2c_local (const double *zin, double *zout, const bool dir, const int n, const int m, const bool transpose_in, const bool transpose_out, const int leading_dimension_in, const int leading_dimension_out)
 Performs a (double precision complex) 1D-FFT on the GPU.
void fft_gpu_2d_local (const double *zin, double *zout, const bool dir, const int n[2], const int m, const bool transpose_in, const bool transpose_out)
 Performs a (double precision complex) 2D-FFT on the GPU.
void fft_gpu_2d_r2c_local (const double *zin, double *zout, const bool dir, const int n[2], const int m, const bool transpose_in, const bool transpose_out)
 Performs a (double precision complex) R2C/C2R2D-FFT on the GPU.
void fft_gpu_fg (const double *zin, double *zout, const int *ghatmap, const int *npts, const int mmax, const int ngpts, const double scale)
 Performs a (double precision complex) 1D-FFT, followed by a (double precision complex) gather, on the GPU.
void fft_gpu_sf (const double *zin, double *zout, const int *ghatmap, const int *npts, const int mmax, const int ngpts, const int nmaps, const double scale)
 Performs a (double precision complex) scatter, followed by a (double precision complex) 1D-FFT, on the GPU.

Function Documentation

◆ fft_gpu_init()

void fft_gpu_init ( void )

Initializes the fft_gpu library.

Author
Ole Schuett

Definition at line 90 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_finalize()

void fft_gpu_finalize ( void )

Releases resources held by the fft_gpu library.

Author
Ole Schuett

Definition at line 119 of file fft_gpu.c.

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

◆ ensure_memory_sizes()

void ensure_memory_sizes ( const size_t requested_buffer_size,
const size_t requested_map_size )

Checks size of device buffers and re-allocates them if necessary.

Parameters
requested_buffer_sizeRequested device buffer size in elements.
requested_map_sizeRequested index-map size in elements.
Author
Ole Schuett

Definition at line 156 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_allocate_double()

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

Allocate buffer of type double.

Parameters
lengthNumber of elements.
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 185 of file fft_gpu.c.

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

◆ fft_gpu_allocate_complex()

void fft_gpu_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 202 of file fft_gpu.c.

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

◆ fft_gpu_free_double()

void fft_gpu_free_double ( double * buffer)

Allocate buffer of type double.

Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 218 of file fft_gpu.c.

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

◆ fft_gpu_free_complex()

void fft_gpu_free_complex ( double complex * buffer)

Allocate buffer of type double complex.

Parameters
bufferBuffer pointer.
Author
Frederick Stein

Definition at line 233 of file fft_gpu.c.

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

◆ fft_gpu_register_3d_local()

void fft_gpu_register_3d_local ( const bool dir,
const int * npts,
const bool inplace,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out )

Performs a (double precision complex) 3D-FFT on the GPU.

Parameters
dirFFT direction (forward or backward).
nptsTransform grid dimensions.
inplaceWhether the transform is performed in-place.
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.
Author
Andreas Gloess, Ole Schuett

Definition at line 864 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_register_3d_r2c_local()

void fft_gpu_register_3d_r2c_local ( const bool dir,
const int * npts,
const bool inplace,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out )

Performs a 3D-R2C/C2R-FFT, on the GPU.

Parameters
dirFFT direction (forward or backward).
nptsTransform grid dimensions.
inplaceWhether the transform is performed in-place.
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.
Author
Andreas Gloess, Ole Schuett

Definition at line 897 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_register_1d_local()

void fft_gpu_register_1d_local ( const bool dir,
const int n,
const int m,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
const bool inplace )

Performs a (double precision complex) 1D-FFT on the GPU.

Parameters
dirFFT direction (forward or backward).
nTransform length.
mNumber of 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.
inplaceWhether the transform is performed in-place.
Author
Andreas Gloess, Ole Schuett

Definition at line 933 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_register_1d_r2c_local()

void fft_gpu_register_1d_r2c_local ( const bool dir,
const int n,
const int m,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out,
const bool inplace )

Performs a (double precision complex) 1D-FFT on the GPU.

Performs a (double precision complex) R2C 1D-FFT on the GPU.

Parameters
dirFFT direction (forward or backward).
nTransform length.
mNumber of 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.
inplaceWhether the transform is performed in-place.
Author
Andreas Gloess, Ole Schuett

Definition at line 973 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_register_2d_local()

void fft_gpu_register_2d_local ( const bool dir,
const int n[2],
const int m,
const bool transpose_in,
const bool transpose_out,
const bool inplace )

Performs a (double precision complex) 2D-FFT on the GPU.

Performs a (double precision complex) 1D-FFT on the GPU.

Parameters
dirFFT direction (forward or backward).
nTransform length.
mNumber of transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
inplaceWhether the transform is performed in-place.
Author
Frederick Stein

Definition at line 1012 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_register_2d_r2c_local()

void fft_gpu_register_2d_r2c_local ( const bool dir,
const int n[2],
const int m,
const bool transpose_in,
const bool transpose_out,
const bool inplace )

Performs a (double precision complex) R2C/C2R2D-FFT on the GPU.

Performs a (double precision complex) R2C 1D-FFT on the GPU.

Parameters
dirFFT direction (forward or backward).
nTransform length.
mNumber of transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
inplaceWhether the transform is performed in-place.
Author
Andreas Gloess, Ole Schuett

Definition at line 1045 of file fft_gpu.c.

Here is the caller graph for this function:

◆ fft_gpu_cfffg()

void fft_gpu_cfffg ( const double * din,
double * zout,
const int * ghatmap,
const int * npts,
const int ngpts,
const double scale )

Performs a (double precision complex) FFT, followed by a (double precision complex) gather, on the GPU.

Parameters
dinInput data buffer.
zoutOutput complex data.
ghatmapIndex map for reciprocal-space points.
nptsTransform grid dimensions.
ngptsNumber of grid points.
scaleScaling factor.
Author
Andreas Gloess, Ole Schuett

Definition at line 1079 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_sfffc()

void fft_gpu_sfffc ( const double * zin,
double * dout,
const int * ghatmap,
const int * npts,
const int ngpts,
const int nmaps,
const double scale )

Performs a (double precision complex) scatter, followed by a (double precision complex) FFT, on the GPU.

Parameters
zinInput complex data.
doutOutput data buffer.
ghatmapIndex map for reciprocal-space points.
nptsTransform grid dimensions.
ngptsNumber of grid points.
nmapsNumber of index maps.
scaleScaling factor.
Author
Andreas Gloess, Ole Schuett

Definition at line 1134 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_3d_local()

void fft_gpu_3d_local ( const double * zin,
double * zout,
const bool dir,
const int * npts,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out )

Performs a (double precision complex) 3D-FFT on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nptsTransform grid dimensions.
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.
Author
Andreas Gloess, Ole Schuett

Definition at line 1190 of file fft_gpu.c.

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

◆ fft_gpu_3d_r2c_local()

void fft_gpu_3d_r2c_local ( const double * zin,
double * zout,
const bool dir,
const int * npts,
const int number_of_ffts,
const bool transpose_in,
const bool transpose_out )

Performs a 3D-R2C/C2R-FFT, on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nptsTransform grid dimensions.
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.
Author
Andreas Gloess, Ole Schuett

Definition at line 1239 of file fft_gpu.c.

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

◆ fft_gpu_cff()

void fft_gpu_cff ( const double * din,
double * zout,
const int * npts )

Performs a (double to complex double) blow-up and a (double precision complex) 2D-FFT on the GPU.

Parameters
dinInput data buffer.
zoutOutput complex data.
nptsTransform grid dimensions.
Author
Andreas Gloess, Ole Schuett

Definition at line 1290 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_ffc()

void fft_gpu_ffc ( const double * zin,
double * dout,
const int * npts )

Performs a (double precision complex) 2D-FFT and a (double complex to double) shrink-down on the GPU.

Parameters
zinInput complex data.
doutOutput data buffer.
nptsTransform grid dimensions.
Author
Andreas Gloess, Ole Schuett

Definition at line 1332 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_cf()

void fft_gpu_cf ( const double * din,
double * zout,
const int * npts )

Performs a (double to complex double) blow-up and a (double precision complex) 1D-FFT on the GPU.

Parameters
dinInput data buffer.
zoutOutput complex data.
nptsTransform grid dimensions.
Author
Andreas Gloess, Ole Schuett

Definition at line 1374 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_fc()

void fft_gpu_fc ( const double * zin,
double * dout,
const int * npts )

Performs a (double precision complex) 1D-FFT and a (double complex to double) shrink-down on the GPU.

Parameters
zinInput complex data.
doutOutput data buffer.
nptsTransform grid dimensions.
Author
Andreas Gloess, Ole Schuett

Definition at line 1413 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_1d_local()

void fft_gpu_1d_local ( const double * zin,
double * zout,
const bool dir,
const int n,
const int m,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out )

Performs a (double precision complex) 1D-FFT on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nTransform length.
mNumber of 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.
Author
Andreas Gloess, Ole Schuett

Definition at line 1457 of file fft_gpu.c.

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

◆ fft_gpu_1d_r2c_local()

void fft_gpu_1d_r2c_local ( const double * zin,
double * zout,
const bool dir,
const int n,
const int m,
const bool transpose_in,
const bool transpose_out,
const int leading_dimension_in,
const int leading_dimension_out )

Performs a (double precision complex) 1D-FFT on the GPU.

Performs a (double precision complex) R2C 1D-FFT on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nTransform length.
mNumber of 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.
Author
Andreas Gloess, Ole Schuett

Definition at line 1522 of file fft_gpu.c.

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

◆ fft_gpu_2d_local()

void fft_gpu_2d_local ( const double * zin,
double * zout,
const bool dir,
const int n[2],
const int m,
const bool transpose_in,
const bool transpose_out )

Performs a (double precision complex) 2D-FFT on the GPU.

Performs a (double precision complex) 1D-FFT on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nTransform length.
mNumber of transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
Author
Frederick Stein

Definition at line 1582 of file fft_gpu.c.

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

◆ fft_gpu_2d_r2c_local()

void fft_gpu_2d_r2c_local ( const double * zin,
double * zout,
const bool dir,
const int n[2],
const int m,
const bool transpose_in,
const bool transpose_out )

Performs a (double precision complex) R2C/C2R2D-FFT on the GPU.

Performs a (double precision complex) R2C 1D-FFT on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
dirFFT direction (forward or backward).
nTransform length.
mNumber of transforms.
transpose_inWhether the input array uses the transposed layout.
transpose_outWhether the output array uses the transposed layout.
Author
Andreas Gloess, Ole Schuett

Definition at line 1630 of file fft_gpu.c.

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

◆ fft_gpu_fg()

void fft_gpu_fg ( const double * zin,
double * zout,
const int * ghatmap,
const int * npts,
const int mmax,
const int ngpts,
const double scale )

Performs a (double precision complex) 1D-FFT, followed by a (double precision complex) gather, on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
ghatmapIndex map for reciprocal-space points.
nptsTransform grid dimensions.
mmaxMaximum Miller index.
ngptsNumber of grid points.
scaleScaling factor.
Author
Andreas Gloess, Ole Schuett

Definition at line 1682 of file fft_gpu.c.

Here is the call graph for this function:

◆ fft_gpu_sf()

void fft_gpu_sf ( const double * zin,
double * zout,
const int * ghatmap,
const int * npts,
const int mmax,
const int ngpts,
const int nmaps,
const double scale )

Performs a (double precision complex) scatter, followed by a (double precision complex) 1D-FFT, on the GPU.

Parameters
zinInput complex data.
zoutOutput complex data.
ghatmapIndex map for reciprocal-space points.
nptsTransform grid dimensions.
mmaxMaximum Miller index.
ngptsNumber of grid points.
nmapsNumber of index maps.
scaleScaling factor.
Author
Andreas Gloess, Ole Schuett

Definition at line 1739 of file fft_gpu.c.

Here is the call graph for this function: