codekingpro/portable-devtools
114k
1 /* Copyright 2005-2021 NVIDIA Corporation. All rights reserved.
2 *
3 * NOTICE TO LICENSEE:
4 *
5 * The source code and/or documentation ("Licensed Deliverables") are
6 * subject to NVIDIA intellectual property rights under U.S. and
7 * international Copyright laws.
8 *
9 * The Licensed Deliverables contained herein are PROPRIETARY and
10 * CONFIDENTIAL to NVIDIA and are being provided under the terms and
11 * conditions of a form of NVIDIA software license agreement by and
12 * between NVIDIA and Licensee ("License Agreement") or electronically
13 * accepted by Licensee. Notwithstanding any terms or conditions to
14 * the contrary in the License Agreement, reproduction or disclosure
15 * of the Licensed Deliverables to any third party without the express
16 * written consent of NVIDIA is prohibited.
17 *
18 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
19 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
20 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
21 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
22 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
23 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
24 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
25 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
26 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
27 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
28 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
29 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
30 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
31 * OF THESE LICENSED DELIVERABLES.
32 *
33 * U.S. Government End Users. These Licensed Deliverables are a
34 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
35 * 1995), consisting of "commercial computer software" and "commercial
36 * computer software documentation" as such terms are used in 48
37 * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
38 * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
39 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
40 * U.S. Government End Users acquire the Licensed Deliverables with
41 * only those rights set forth herein.
42 *
43 * Any use of the Licensed Deliverables in individual and commercial
44 * software must include, in the user documentation and internal
45 * comments to the code, the above Disclaimer and U.S. Government End
46 * Users Notice.
47 */
48
49/*!
50* \file cufft.h
51* \brief Public header file for the NVIDIA CUDA FFT library (CUFFT)
52*/
53
54#ifndef _CUFFT_H_
55#define _CUFFT_H_
56
57
58#include "cuComplex.h"
59#include "driver_types.h"
60#include "library_types.h"
61
62#ifndef CUFFTAPI
63#ifdef _WIN32
64#define CUFFTAPI __stdcall
65#elif __GNUC__ >= 4
66#define CUFFTAPI __attribute__ ((visibility ("default")))
67#else
68#define CUFFTAPI
69#endif
70#endif
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75
76#define CUFFT_VER_MAJOR 11
77#define CUFFT_VER_MINOR 2
78#define CUFFT_VER_PATCH 1
79#define CUFFT_VER_BUILD 3
80
81#define CUFFT_VERSION 11201
82
83// CUFFT API function return values
84typedef enum cufftResult_t {
85 CUFFT_SUCCESS = 0x0,
86 CUFFT_INVALID_PLAN = 0x1,
87 CUFFT_ALLOC_FAILED = 0x2,
88 CUFFT_INVALID_TYPE = 0x3,
89 CUFFT_INVALID_VALUE = 0x4,
90 CUFFT_INTERNAL_ERROR = 0x5,
91 CUFFT_EXEC_FAILED = 0x6,
92 CUFFT_SETUP_FAILED = 0x7,
93 CUFFT_INVALID_SIZE = 0x8,
94 CUFFT_UNALIGNED_DATA = 0x9,
95 CUFFT_INCOMPLETE_PARAMETER_LIST = 0xA,
96 CUFFT_INVALID_DEVICE = 0xB,
97 CUFFT_PARSE_ERROR = 0xC,
98 CUFFT_NO_WORKSPACE = 0xD,
99 CUFFT_NOT_IMPLEMENTED = 0xE,
100 CUFFT_LICENSE_ERROR = 0x0F,
101 CUFFT_NOT_SUPPORTED = 0x10
102
103} cufftResult;
104
105#define MAX_CUFFT_ERROR 0x11
106
107
108// CUFFT defines and supports the following data types
109
110
111// cufftReal is a single-precision, floating-point real data type.
112// cufftDoubleReal is a double-precision, real data type.
113typedef float cufftReal;
114typedef double cufftDoubleReal;
115
116// cufftComplex is a single-precision, floating-point complex data type that
117// consists of interleaved real and imaginary components.
118// cufftDoubleComplex is the double-precision equivalent.
119typedef cuComplex cufftComplex;
120typedef cuDoubleComplex cufftDoubleComplex;
121
122// CUFFT transform directions
123#define CUFFT_FORWARD -1 // Forward FFT
124#define CUFFT_INVERSE 1 // Inverse FFT
125
126// CUFFT supports the following transform types
127typedef enum cufftType_t {
128 CUFFT_R2C = 0x2a, // Real to Complex (interleaved)
129 CUFFT_C2R = 0x2c, // Complex (interleaved) to Real
130 CUFFT_C2C = 0x29, // Complex to Complex, interleaved
131 CUFFT_D2Z = 0x6a, // Double to Double-Complex
132 CUFFT_Z2D = 0x6c, // Double-Complex to Double
133 CUFFT_Z2Z = 0x69 // Double-Complex to Double-Complex
134} cufftType;
135
136// CUFFT supports the following data layouts
137typedef enum cufftCompatibility_t {
138 CUFFT_COMPATIBILITY_FFTW_PADDING = 0x01 // The default value
139} cufftCompatibility;
140
141#define CUFFT_COMPATIBILITY_DEFAULT CUFFT_COMPATIBILITY_FFTW_PADDING
142
143//
144// structure definition used by the shim between old and new APIs
145//
146#define MAX_SHIM_RANK 3
147
148// cufftHandle is a handle type used to store and access CUFFT plans.
149typedef int cufftHandle;
150
151
152cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan,
153 int nx,
154 cufftType type,
155 int batch);
156
157cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan,
158 int nx, int ny,
159 cufftType type);
160
161cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan,
162 int nx, int ny, int nz,
163 cufftType type);
164
165cufftResult CUFFTAPI cufftPlanMany(cufftHandle *plan,
166 int rank,
167 int *n,
168 int *inembed, int istride, int idist,
169 int *onembed, int ostride, int odist,
170 cufftType type,
171 int batch);
172
173cufftResult CUFFTAPI cufftMakePlan1d(cufftHandle plan,
174 int nx,
175 cufftType type,
176 int batch,
177 size_t *workSize);
178
179cufftResult CUFFTAPI cufftMakePlan2d(cufftHandle plan,
180 int nx, int ny,
181 cufftType type,
182 size_t *workSize);
183
184cufftResult CUFFTAPI cufftMakePlan3d(cufftHandle plan,
185 int nx, int ny, int nz,
186 cufftType type,
187 size_t *workSize);
188
189cufftResult CUFFTAPI cufftMakePlanMany(cufftHandle plan,
190 int rank,
191 int *n,
192 int *inembed, int istride, int idist,
193 int *onembed, int ostride, int odist,
194 cufftType type,
195 int batch,
196 size_t *workSize);
197
198cufftResult CUFFTAPI cufftMakePlanMany64(cufftHandle plan,
199 int rank,
200 long long int *n,
201 long long int *inembed,
202 long long int istride,
203 long long int idist,
204 long long int *onembed,
205 long long int ostride, long long int odist,
206 cufftType type,
207 long long int batch,
208 size_t * workSize);
209
210cufftResult CUFFTAPI cufftGetSizeMany64(cufftHandle plan,
211 int rank,
212 long long int *n,
213 long long int *inembed,
214 long long int istride, long long int idist,
215 long long int *onembed,
216 long long int ostride, long long int odist,
217 cufftType type,
218 long long int batch,
219 size_t *workSize);
220
221
222
223
224cufftResult CUFFTAPI cufftEstimate1d(int nx,
225 cufftType type,
226 int batch,
227 size_t *workSize);
228
229cufftResult CUFFTAPI cufftEstimate2d(int nx, int ny,
230 cufftType type,
231 size_t *workSize);
232
233cufftResult CUFFTAPI cufftEstimate3d(int nx, int ny, int nz,
234 cufftType type,
235 size_t *workSize);
236
237cufftResult CUFFTAPI cufftEstimateMany(int rank,
238 int *n,
239 int *inembed, int istride, int idist,
240 int *onembed, int ostride, int odist,
241 cufftType type,
242 int batch,
243 size_t *workSize);
244
245cufftResult CUFFTAPI cufftCreate(cufftHandle * handle);
246
247cufftResult CUFFTAPI cufftGetSize1d(cufftHandle handle,
248 int nx,
249 cufftType type,
250 int batch,
251 size_t *workSize );
252
253cufftResult CUFFTAPI cufftGetSize2d(cufftHandle handle,
254 int nx, int ny,
255 cufftType type,
256 size_t *workSize);
257
258cufftResult CUFFTAPI cufftGetSize3d(cufftHandle handle,
259 int nx, int ny, int nz,
260 cufftType type,
261 size_t *workSize);
262
263cufftResult CUFFTAPI cufftGetSizeMany(cufftHandle handle,
264 int rank, int *n,
265 int *inembed, int istride, int idist,
266 int *onembed, int ostride, int odist,
267 cufftType type, int batch, size_t *workArea);
268
269cufftResult CUFFTAPI cufftGetSize(cufftHandle handle, size_t *workSize);
270
271cufftResult CUFFTAPI cufftSetWorkArea(cufftHandle plan, void *workArea);
272
273cufftResult CUFFTAPI cufftSetAutoAllocation(cufftHandle plan, int autoAllocate);
274
275cufftResult CUFFTAPI cufftExecC2C(cufftHandle plan,
276 cufftComplex *idata,
277 cufftComplex *odata,
278 int direction);
279
280cufftResult CUFFTAPI cufftExecR2C(cufftHandle plan,
281 cufftReal *idata,
282 cufftComplex *odata);
283
284cufftResult CUFFTAPI cufftExecC2R(cufftHandle plan,
285 cufftComplex *idata,
286 cufftReal *odata);
287
288cufftResult CUFFTAPI cufftExecZ2Z(cufftHandle plan,
289 cufftDoubleComplex *idata,
290 cufftDoubleComplex *odata,
291 int direction);
292
293cufftResult CUFFTAPI cufftExecD2Z(cufftHandle plan,
294 cufftDoubleReal *idata,
295 cufftDoubleComplex *odata);
296
297cufftResult CUFFTAPI cufftExecZ2D(cufftHandle plan,
298 cufftDoubleComplex *idata,
299 cufftDoubleReal *odata);
300
301
302// utility functions
303cufftResult CUFFTAPI cufftSetStream(cufftHandle plan,
304 cudaStream_t stream);
305
306cufftResult CUFFTAPI cufftDestroy(cufftHandle plan);
307
308cufftResult CUFFTAPI cufftGetVersion(int *version);
309
310cufftResult CUFFTAPI cufftGetProperty(libraryPropertyType type,
311 int *value);
312
313//
314// Set/Get PlanProperty APIs configures per-plan behavior
315//
316typedef enum cufftProperty_t {
317 NVFFT_PLAN_PROPERTY_INT64_PATIENT_JIT = 0x1
318} cufftProperty;
319
320cufftResult CUFFTAPI cufftSetPlanPropertyInt64(cufftHandle plan,
321 cufftProperty property,
322 const long long int inputValueInt);
323
324cufftResult CUFFTAPI cufftGetPlanPropertyInt64(cufftHandle plan,
325 cufftProperty property,
326 long long int* returnPtrValue);
327
328cufftResult CUFFTAPI cufftResetPlanProperty(cufftHandle plan, cufftProperty property);
329
330#ifdef __cplusplus
331}
332#endif
333
334#endif /* _CUFFT_H_ */
335 