2 /* Copyright 2005-2014 NVIDIA Corporation. All rights reserved.
6 * The source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
10 * The Licensed Deliverables contained herein are PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and are being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee. Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. THEY ARE
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
34 * U.S. Government End Users. These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government
39 * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
52 * \brief Public header file for the NVIDIA CUDA FFT library (CUFFT)
59 #include "cuComplex.h"
60 #include "driver_types.h"
64 #define CUFFTAPI __stdcall
74 // CUFFT API function return values
75 typedef enum cufftResult_t {
77 CUFFT_INVALID_PLAN = 0x1,
78 CUFFT_ALLOC_FAILED = 0x2,
79 CUFFT_INVALID_TYPE = 0x3,
80 CUFFT_INVALID_VALUE = 0x4,
81 CUFFT_INTERNAL_ERROR = 0x5,
82 CUFFT_EXEC_FAILED = 0x6,
83 CUFFT_SETUP_FAILED = 0x7,
84 CUFFT_INVALID_SIZE = 0x8,
85 CUFFT_UNALIGNED_DATA = 0x9,
86 CUFFT_INCOMPLETE_PARAMETER_LIST = 0xA,
87 CUFFT_INVALID_DEVICE = 0xB,
88 CUFFT_PARSE_ERROR = 0xC,
89 CUFFT_NO_WORKSPACE = 0xD,
90 CUFFT_NOT_IMPLEMENTED = 0xE,
91 CUFFT_LICENSE_ERROR = 0x0F
94 #define MAX_CUFFT_ERROR 0x10
97 // CUFFT defines and supports the following data types
100 // cufftReal is a single-precision, floating-point real data type.
101 // cufftDoubleReal is a double-precision, real data type.
102 typedef float cufftReal;
103 typedef double cufftDoubleReal;
105 // cufftComplex is a single-precision, floating-point complex data type that
106 // consists of interleaved real and imaginary components.
107 // cufftDoubleComplex is the double-precision equivalent.
108 typedef cuComplex cufftComplex;
109 typedef cuDoubleComplex cufftDoubleComplex;
111 // CUFFT transform directions
112 #define CUFFT_FORWARD -1 // Forward FFT
113 #define CUFFT_INVERSE 1 // Inverse FFT
115 // CUFFT supports the following transform types
116 typedef enum cufftType_t {
117 CUFFT_R2C = 0x2a, // Real to Complex (interleaved)
118 CUFFT_C2R = 0x2c, // Complex (interleaved) to Real
119 CUFFT_C2C = 0x29, // Complex to Complex, interleaved
120 CUFFT_D2Z = 0x6a, // Double to Double-Complex
121 CUFFT_Z2D = 0x6c, // Double-Complex to Double
122 CUFFT_Z2Z = 0x69 // Double-Complex to Double-Complex
125 // CUFFT supports the following data layouts
126 typedef enum cufftCompatibility_t {
127 CUFFT_COMPATIBILITY_NATIVE = 0x00, // deprecated
128 CUFFT_COMPATIBILITY_FFTW_PADDING = 0x01, // The default value
129 CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC = 0x02, // Deprecated. Asymmetric input is
130 // always treated as in FFTW.
131 CUFFT_COMPATIBILITY_FFTW_ALL = 0x03
132 } cufftCompatibility;
134 #define CUFFT_COMPATIBILITY_DEFAULT CUFFT_COMPATIBILITY_FFTW_PADDING
137 // structure definition used by the shim between old and new APIs
139 #define MAX_SHIM_RANK 3
141 // cufftHandle is a handle type used to store and access CUFFT plans.
142 typedef int cufftHandle;
145 cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan,
148 int batch /* deprecated - use cufftPlanMany */);
150 cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan,
154 cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan,
155 int nx, int ny, int nz,
158 cufftResult CUFFTAPI cufftPlanMany(cufftHandle *plan,
161 int *inembed, int istride, int idist,
162 int *onembed, int ostride, int odist,
166 cufftResult CUFFTAPI cufftMakePlan1d(cufftHandle plan,
169 int batch, /* deprecated - use cufftPlanMany */
172 cufftResult CUFFTAPI cufftMakePlan2d(cufftHandle plan,
177 cufftResult CUFFTAPI cufftMakePlan3d(cufftHandle plan,
178 int nx, int ny, int nz,
182 cufftResult CUFFTAPI cufftMakePlanMany(cufftHandle plan,
185 int *inembed, int istride, int idist,
186 int *onembed, int ostride, int odist,
191 cufftResult CUFFTAPI cufftEstimate1d(int nx,
193 int batch, /* deprecated - use cufftPlanMany */
196 cufftResult CUFFTAPI cufftEstimate2d(int nx, int ny,
200 cufftResult CUFFTAPI cufftEstimate3d(int nx, int ny, int nz,
204 cufftResult CUFFTAPI cufftEstimateMany(int rank,
206 int *inembed, int istride, int idist,
207 int *onembed, int ostride, int odist,
212 cufftResult CUFFTAPI cufftCreate(cufftHandle * cufftHandle);
214 cufftResult CUFFTAPI cufftGetSize1d(cufftHandle handle,
217 int batch, /* deprecated - use cufftGetSizeMany */
220 cufftResult CUFFTAPI cufftGetSize2d(cufftHandle handle,
225 cufftResult CUFFTAPI cufftGetSize3d(cufftHandle handle,
226 int nx, int ny, int nz,
230 cufftResult CUFFTAPI cufftGetSizeMany(cufftHandle handle,
232 int *inembed, int istride, int idist,
233 int *onembed, int ostride, int odist,
234 cufftType type, int batch, size_t *workArea);
236 cufftResult CUFFTAPI cufftGetSize(cufftHandle handle, size_t *workSize);
238 cufftResult CUFFTAPI cufftSetWorkArea(cufftHandle plan, void *workArea);
240 cufftResult CUFFTAPI cufftSetAutoAllocation(cufftHandle plan, int autoAllocate);
242 cufftResult CUFFTAPI cufftExecC2C(cufftHandle plan,
247 cufftResult CUFFTAPI cufftExecR2C(cufftHandle plan,
249 cufftComplex *odata);
251 cufftResult CUFFTAPI cufftExecC2R(cufftHandle plan,
255 cufftResult CUFFTAPI cufftExecZ2Z(cufftHandle plan,
256 cufftDoubleComplex *idata,
257 cufftDoubleComplex *odata,
260 cufftResult CUFFTAPI cufftExecD2Z(cufftHandle plan,
261 cufftDoubleReal *idata,
262 cufftDoubleComplex *odata);
264 cufftResult CUFFTAPI cufftExecZ2D(cufftHandle plan,
265 cufftDoubleComplex *idata,
266 cufftDoubleReal *odata);
270 cufftResult CUFFTAPI cufftSetStream(cufftHandle plan,
271 cudaStream_t stream);
273 cufftResult CUFFTAPI cufftSetCompatibilityMode(cufftHandle plan,
274 cufftCompatibility mode);
276 cufftResult CUFFTAPI cufftDestroy(cufftHandle plan);
278 cufftResult CUFFTAPI cufftGetVersion(int *version);
284 #endif /* _CUFFT_H_ */