(git:e70887f)
Loading...
Searching...
No Matches
fft_gpu.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2026 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: BSD-3-Clause */
6/*----------------------------------------------------------------------------*/
7#include <complex.h>
8#include <stdbool.h>
9#include <stddef.h>
10
11/*******************************************************************************
12 * \brief Initializes the fft_gpu library.
13 * \author Ole Schuett
14 ******************************************************************************/
15void fft_gpu_init(void);
16
17/*******************************************************************************
18 * \brief Releases resources held by the fft_gpu library.
19 * \author Ole Schuett
20 ******************************************************************************/
21void fft_gpu_finalize(void);
22
23/*******************************************************************************
24 * \brief Checks size of device buffers and re-allocates them if necessary.
25 * \author Ole Schuett
26 ******************************************************************************/
27void ensure_memory_sizes(const size_t requested_buffer_size,
28 const size_t requested_map_size);
29
30/*******************************************************************************
31 * \brief Allocate buffer of type double.
32 * \author Frederick Stein
33 ******************************************************************************/
34void fft_gpu_allocate_double(const int length, double **buffer);
35
36/*******************************************************************************
37 * \brief Allocate buffer of type double complex.
38 * \author Frederick Stein
39 ******************************************************************************/
40void fft_gpu_allocate_complex(const int length, double complex **buffer);
41
42/*******************************************************************************
43 * \brief Allocate buffer of type double.
44 * \author Frederick Stein
45 ******************************************************************************/
46void fft_gpu_free_double(double *buffer);
47
48/*******************************************************************************
49 * \brief Allocate buffer of type double complex.
50 * \author Frederick Stein
51 ******************************************************************************/
52void fft_gpu_free_complex(double complex *buffer);
53
54/*******************************************************************************
55 * \brief Performs a (double precision complex) 1D-FFT on the GPU.
56 * \author Andreas Gloess, Ole Schuett
57 ******************************************************************************/
58void fft_gpu_register_1d_local(const bool dir, const int n, const int m,
59 const bool transpose_in,
60 const bool transpose_out,
61 const int leading_dimension_in,
62 const int leading_dimension_out,
63 const bool inplace);
64
65/*******************************************************************************
66 * \brief Performs a (double precision complex) R2C 1D-FFT on the GPU.
67 * \author Andreas Gloess, Ole Schuett
68 ******************************************************************************/
69void fft_gpu_register_1d_r2c_local(const bool dir, const int n, const int m,
70 const bool transpose_in,
71 const bool transpose_out,
72 const int leading_dimension_in,
73 const int leading_dimension_out,
74 const bool inplace);
75
76/*******************************************************************************
77 * \brief Performs a (double precision complex) 1D-FFT on the GPU.
78 * \author Frederick Stein
79 ******************************************************************************/
80void fft_gpu_register_2d_local(const bool dir, const int n[2], const int m,
81 const bool transpose_in,
82 const bool transpose_out, const bool inplace);
83
84/*******************************************************************************
85 * \brief Performs a (double precision complex) R2C 1D-FFT on the GPU.
86 * \author Frederick Stein
87 ******************************************************************************/
88void fft_gpu_register_2d_r2c_local(const bool dir, const int n[2], const int m,
89 const bool transpose_in,
90 const bool transpose_out,
91 const bool inplace);
92
93/*******************************************************************************
94 * \brief Performs a (double precision complex) 3D-FFT on the GPU.
95 * \author Andreas Gloess, Ole Schuett
96 ******************************************************************************/
97void fft_gpu_register_3d_local(const bool dir, const int *npts,
98 const bool inplace, const int number_of_ffts,
99 const bool transpose_in,
100 const bool transpose_out);
101
102/*******************************************************************************
103 * \brief Performs a 3D-R2C/C2R-FFT, on the GPU.
104 * \author Andreas Gloess, Ole Schuett
105 ******************************************************************************/
106void fft_gpu_register_3d_r2c_local(const bool dir, const int *npts,
107 const bool inplace, const int number_of_ffts,
108 const bool transpose_in,
109 const bool transpose_out);
110
111/*******************************************************************************
112 * \brief Performs a (double precision complex) 1D-FFT on the GPU.
113 * \author Andreas Gloess, Ole Schuett
114 ******************************************************************************/
115void fft_gpu_1d_local(const double *zin, double *zout, const bool dir,
116 const int n, const int m, const bool transpose_in,
117 const bool transpose_out, const int leading_dimension_in,
118 const int leading_dimension_out);
119
120/*******************************************************************************
121 * \brief Performs a (double precision complex) R2C 1D-FFT on the GPU.
122 * \author Andreas Gloess, Ole Schuett
123 ******************************************************************************/
124void fft_gpu_1d_r2c_local(const double *zin, double *zout, const bool dir,
125 const int n, const int m, const bool transpose_in,
126 const bool transpose_out,
127 const int leading_dimension_in,
128 const int leading_dimension_out);
129
130/*******************************************************************************
131 * \brief Performs a (double precision complex) 1D-FFT on the GPU.
132 * \author Frederick Stein
133 ******************************************************************************/
134void fft_gpu_2d_local(const double *zin, double *zout, const bool dir,
135 const int n[2], const int m, const bool transpose_in,
136 const bool transpose_out);
137
138/*******************************************************************************
139 * \brief Performs a (double precision complex) R2C 1D-FFT on the GPU.
140 * \author Frederick Stein
141 ******************************************************************************/
142void fft_gpu_2d_r2c_local(const double *zin, double *zout, const bool dir,
143 const int n[2], const int m, const bool transpose_in,
144 const bool transpose_out);
145
146/*******************************************************************************
147 * \brief Performs a (double precision complex) 3D-FFT on the GPU.
148 * \author Andreas Gloess, Ole Schuett
149 ******************************************************************************/
150void fft_gpu_3d_local(const double *zin, double *zout, const bool dir,
151 const int *npts, const int number_of_ffts,
152 const bool transpose_in, const bool transpose_out);
153
154/*******************************************************************************
155 * \brief Performs a 3D-R2C/C2R-FFT, on the GPU.
156 * \author Andreas Gloess, Ole Schuett
157 ******************************************************************************/
158void fft_gpu_3d_r2c_local(const double *zin, double *zout, const bool dir,
159 const int *npts, const int number_of_ffts,
160 const bool transpose_in, const bool transpose_out);
161
162// EOF
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.
Definition fft_gpu.c:1239
void fft_gpu_free_double(double *buffer)
Allocate buffer of type double.
Definition fft_gpu.c:218
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.
Definition fft_gpu.c:864
void fft_gpu_allocate_double(const int length, double **buffer)
Allocate buffer of type double.
Definition fft_gpu.c:185
void fft_gpu_allocate_complex(const int length, double complex **buffer)
Allocate buffer of type double complex.
Definition fft_gpu.c:202
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) 1D-FFT on the GPU.
Definition fft_gpu.c:1012
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) 1D-FFT on the GPU.
Definition fft_gpu.c:1582
void fft_gpu_init(void)
Initializes the fft_gpu library.
Definition fft_gpu.c:90
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 1D-FFT on the GPU.
Definition fft_gpu.c:1630
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.
Definition fft_gpu.c:897
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.
Definition fft_gpu.c:1190
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) R2C 1D-FFT on the GPU.
Definition fft_gpu.c:1522
void fft_gpu_finalize(void)
Releases resources held by the fft_gpu library.
Definition fft_gpu.c:119
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 1D-FFT on the GPU.
Definition fft_gpu.c:1045
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.
Definition fft_gpu.c:156
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) R2C 1D-FFT on the GPU.
Definition fft_gpu.c:973
void fft_gpu_free_complex(double complex *buffer)
Allocate buffer of type double complex.
Definition fft_gpu.c:233
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.
Definition fft_gpu.c:1457
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.
Definition fft_gpu.c:933