OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / cufft.h
1
2  /* Copyright 2005-2014 NVIDIA Corporation.  All rights reserved.
3   *
4   * NOTICE TO LICENSEE:
5   *
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.
9   *
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.
18   *
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.
33   *
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.
43   *
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
47   * Users Notice.
48   */
49
50 /*!
51 * \file cufft.h  
52 * \brief Public header file for the NVIDIA CUDA FFT library (CUFFT)  
53 */ 
54
55 #ifndef _CUFFT_H_
56 #define _CUFFT_H_
57
58
59 #include "cuComplex.h"
60 #include "driver_types.h"
61
62 #ifndef CUFFTAPI
63 #ifdef _WIN32
64 #define CUFFTAPI __stdcall
65 #else
66 #define CUFFTAPI 
67 #endif
68 #endif
69
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73
74 // CUFFT API function return values 
75 typedef enum cufftResult_t {
76   CUFFT_SUCCESS        = 0x0,
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
92 } cufftResult;
93
94 #define MAX_CUFFT_ERROR 0x10
95
96     
97 // CUFFT defines and supports the following data types
98
99
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;
104
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;
110
111 // CUFFT transform directions 
112 #define CUFFT_FORWARD -1 // Forward FFT
113 #define CUFFT_INVERSE  1 // Inverse FFT
114
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
123 } cufftType;
124
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;
133
134 #define CUFFT_COMPATIBILITY_DEFAULT   CUFFT_COMPATIBILITY_FFTW_PADDING
135
136 //
137 // structure definition used by the shim between old and new APIs
138 //
139 #define MAX_SHIM_RANK 3
140
141 // cufftHandle is a handle type used to store and access CUFFT plans.
142 typedef int cufftHandle;
143
144
145 cufftResult CUFFTAPI cufftPlan1d(cufftHandle *plan, 
146                                  int nx, 
147                                  cufftType type, 
148                                  int batch /* deprecated - use cufftPlanMany */);
149
150 cufftResult CUFFTAPI cufftPlan2d(cufftHandle *plan, 
151                                  int nx, int ny,
152                                  cufftType type);
153
154 cufftResult CUFFTAPI cufftPlan3d(cufftHandle *plan, 
155                                  int nx, int ny, int nz, 
156                                  cufftType type);
157
158 cufftResult CUFFTAPI cufftPlanMany(cufftHandle *plan,
159                                    int rank,
160                                    int *n,
161                                    int *inembed, int istride, int idist,
162                                    int *onembed, int ostride, int odist,
163                                    cufftType type,
164                                    int batch);
165                                    
166 cufftResult CUFFTAPI cufftMakePlan1d(cufftHandle plan, 
167                                      int nx, 
168                                      cufftType type, 
169                                      int batch, /* deprecated - use cufftPlanMany */
170                                      size_t *workSize);
171
172 cufftResult CUFFTAPI cufftMakePlan2d(cufftHandle plan, 
173                                      int nx, int ny,
174                                      cufftType type,
175                                      size_t *workSize);
176
177 cufftResult CUFFTAPI cufftMakePlan3d(cufftHandle plan, 
178                                      int nx, int ny, int nz, 
179                                      cufftType type,
180                                      size_t *workSize);
181
182 cufftResult CUFFTAPI cufftMakePlanMany(cufftHandle plan,
183                                        int rank,
184                                        int *n,
185                                        int *inembed, int istride, int idist,
186                                        int *onembed, int ostride, int odist,
187                                        cufftType type,
188                                        int batch,
189                                        size_t *workSize);
190                                    
191 cufftResult CUFFTAPI cufftEstimate1d(int nx, 
192                                      cufftType type, 
193                                      int batch, /* deprecated - use cufftPlanMany */
194                                      size_t *workSize);
195
196 cufftResult CUFFTAPI cufftEstimate2d(int nx, int ny,
197                                      cufftType type,
198                                      size_t *workSize);
199
200 cufftResult CUFFTAPI cufftEstimate3d(int nx, int ny, int nz, 
201                                      cufftType type,
202                                      size_t *workSize);
203
204 cufftResult CUFFTAPI cufftEstimateMany(int rank,
205                                        int *n,
206                                        int *inembed, int istride, int idist,
207                                        int *onembed, int ostride, int odist,
208                                        cufftType type,
209                                        int batch,
210                                        size_t *workSize);
211                                      
212 cufftResult CUFFTAPI cufftCreate(cufftHandle * cufftHandle);                                     
213
214 cufftResult CUFFTAPI cufftGetSize1d(cufftHandle handle, 
215                                     int nx, 
216                                     cufftType type, 
217                                     int batch, /* deprecated - use cufftGetSizeMany */
218                                     size_t *workSize );
219                                                                          
220 cufftResult CUFFTAPI cufftGetSize2d(cufftHandle handle, 
221                                     int nx, int ny,
222                                     cufftType type,
223                                     size_t *workSize);
224
225 cufftResult CUFFTAPI cufftGetSize3d(cufftHandle handle,
226                                     int nx, int ny, int nz, 
227                                     cufftType type,
228                                     size_t *workSize);
229
230 cufftResult CUFFTAPI cufftGetSizeMany(cufftHandle handle, 
231                                       int rank, int *n,
232                                       int *inembed, int istride, int idist,
233                                       int *onembed, int ostride, int odist,
234                                       cufftType type, int batch, size_t *workArea);
235                                      
236 cufftResult CUFFTAPI cufftGetSize(cufftHandle handle, size_t *workSize);
237                                                
238 cufftResult CUFFTAPI cufftSetWorkArea(cufftHandle plan, void *workArea);
239
240 cufftResult CUFFTAPI cufftSetAutoAllocation(cufftHandle plan, int autoAllocate);
241
242 cufftResult CUFFTAPI cufftExecC2C(cufftHandle plan, 
243                                   cufftComplex *idata,
244                                   cufftComplex *odata,
245                                   int direction);
246
247 cufftResult CUFFTAPI cufftExecR2C(cufftHandle plan, 
248                                   cufftReal *idata,
249                                   cufftComplex *odata);
250
251 cufftResult CUFFTAPI cufftExecC2R(cufftHandle plan, 
252                                   cufftComplex *idata,
253                                   cufftReal *odata);
254
255 cufftResult CUFFTAPI cufftExecZ2Z(cufftHandle plan, 
256                                   cufftDoubleComplex *idata,
257                                   cufftDoubleComplex *odata,
258                                   int direction);
259
260 cufftResult CUFFTAPI cufftExecD2Z(cufftHandle plan, 
261                                   cufftDoubleReal *idata,
262                                   cufftDoubleComplex *odata);
263
264 cufftResult CUFFTAPI cufftExecZ2D(cufftHandle plan, 
265                                   cufftDoubleComplex *idata,
266                                   cufftDoubleReal *odata);
267                                   
268
269 // utility functions
270 cufftResult CUFFTAPI cufftSetStream(cufftHandle plan,
271                                     cudaStream_t stream);
272
273 cufftResult CUFFTAPI cufftSetCompatibilityMode(cufftHandle plan,
274                                                cufftCompatibility mode);
275
276 cufftResult CUFFTAPI cufftDestroy(cufftHandle plan);
277
278 cufftResult CUFFTAPI cufftGetVersion(int *version);
279
280 #ifdef __cplusplus
281 }
282 #endif
283
284 #endif /* _CUFFT_H_ */