forked from JuliaGPU/CUDA.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libcufft.jl
245 lines (213 loc) · 9.36 KB
/
libcufft.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Julia wrapper for header: cufft.h
# Automatically generated using Clang.jl
@checked function cufftPlan1d(plan, nx, type, batch)
initialize_context()
ccall((:cufftPlan1d, libcufft()), cufftResult,
(Ptr{cufftHandle}, Cint, cufftType, Cint),
plan, nx, type, batch)
end
@checked function cufftPlan2d(plan, nx, ny, type)
initialize_context()
ccall((:cufftPlan2d, libcufft()), cufftResult,
(Ptr{cufftHandle}, Cint, Cint, cufftType),
plan, nx, ny, type)
end
@checked function cufftPlan3d(plan, nx, ny, nz, type)
initialize_context()
ccall((:cufftPlan3d, libcufft()), cufftResult,
(Ptr{cufftHandle}, Cint, Cint, Cint, cufftType),
plan, nx, ny, nz, type)
end
@checked function cufftPlanMany(plan, rank, n, inembed, istride, idist, onembed, ostride,
odist, type, batch)
initialize_context()
ccall((:cufftPlanMany, libcufft()), cufftResult,
(Ptr{cufftHandle}, Cint, Ptr{Cint}, Ptr{Cint}, Cint, Cint, Ptr{Cint},
Cint, Cint, cufftType, Cint),
plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type,
batch)
end
@checked function cufftMakePlan1d(plan, nx, type, batch, workSize)
initialize_context()
ccall((:cufftMakePlan1d, libcufft()), cufftResult,
(cufftHandle, Cint, cufftType, Cint, Ptr{Csize_t}),
plan, nx, type, batch, workSize)
end
@checked function cufftMakePlan2d(plan, nx, ny, type, workSize)
initialize_context()
ccall((:cufftMakePlan2d, libcufft()), cufftResult,
(cufftHandle, Cint, Cint, cufftType, Ptr{Csize_t}),
plan, nx, ny, type, workSize)
end
@checked function cufftMakePlan3d(plan, nx, ny, nz, type, workSize)
initialize_context()
ccall((:cufftMakePlan3d, libcufft()), cufftResult,
(cufftHandle, Cint, Cint, Cint, cufftType, Ptr{Csize_t}),
plan, nx, ny, nz, type, workSize)
end
@checked function cufftMakePlanMany(plan, rank, n, inembed, istride, idist, onembed,
ostride, odist, type, batch, workSize)
initialize_context()
ccall((:cufftMakePlanMany, libcufft()), cufftResult,
(cufftHandle, Cint, Ptr{Cint}, Ptr{Cint}, Cint, Cint, Ptr{Cint}, Cint,
Cint, cufftType, Cint, Ptr{Csize_t}),
plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type,
batch, workSize)
end
@checked function cufftMakePlanMany64(plan, rank, n, inembed, istride, idist, onembed,
ostride, odist, type, batch, workSize)
initialize_context()
ccall((:cufftMakePlanMany64, libcufft()), cufftResult,
(cufftHandle, Cint, Ptr{Clonglong}, Ptr{Clonglong}, Clonglong,
Clonglong, Ptr{Clonglong}, Clonglong, Clonglong, cufftType, Clonglong,
Ptr{Csize_t}),
plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type,
batch, workSize)
end
@checked function cufftGetSizeMany64(plan, rank, n, inembed, istride, idist, onembed,
ostride, odist, type, batch, workSize)
initialize_context()
ccall((:cufftGetSizeMany64, libcufft()), cufftResult,
(cufftHandle, Cint, Ptr{Clonglong}, Ptr{Clonglong}, Clonglong,
Clonglong, Ptr{Clonglong}, Clonglong, Clonglong, cufftType, Clonglong,
Ptr{Csize_t}),
plan, rank, n, inembed, istride, idist, onembed, ostride, odist, type,
batch, workSize)
end
@checked function cufftEstimate1d(nx, type, batch, workSize)
initialize_context()
ccall((:cufftEstimate1d, libcufft()), cufftResult,
(Cint, cufftType, Cint, Ptr{Csize_t}),
nx, type, batch, workSize)
end
@checked function cufftEstimate2d(nx, ny, type, workSize)
initialize_context()
ccall((:cufftEstimate2d, libcufft()), cufftResult,
(Cint, Cint, cufftType, Ptr{Csize_t}),
nx, ny, type, workSize)
end
@checked function cufftEstimate3d(nx, ny, nz, type, workSize)
initialize_context()
ccall((:cufftEstimate3d, libcufft()), cufftResult,
(Cint, Cint, Cint, cufftType, Ptr{Csize_t}),
nx, ny, nz, type, workSize)
end
@checked function cufftEstimateMany(rank, n, inembed, istride, idist, onembed, ostride,
odist, type, batch, workSize)
initialize_context()
ccall((:cufftEstimateMany, libcufft()), cufftResult,
(Cint, Ptr{Cint}, Ptr{Cint}, Cint, Cint, Ptr{Cint}, Cint, Cint,
cufftType, Cint, Ptr{Csize_t}),
rank, n, inembed, istride, idist, onembed, ostride, odist, type, batch,
workSize)
end
@checked function cufftCreate(handle)
initialize_context()
ccall((:cufftCreate, libcufft()), cufftResult,
(Ptr{cufftHandle},),
handle)
end
@checked function cufftGetSize1d(handle, nx, type, batch, workSize)
initialize_context()
ccall((:cufftGetSize1d, libcufft()), cufftResult,
(cufftHandle, Cint, cufftType, Cint, Ptr{Csize_t}),
handle, nx, type, batch, workSize)
end
@checked function cufftGetSize2d(handle, nx, ny, type, workSize)
initialize_context()
ccall((:cufftGetSize2d, libcufft()), cufftResult,
(cufftHandle, Cint, Cint, cufftType, Ptr{Csize_t}),
handle, nx, ny, type, workSize)
end
@checked function cufftGetSize3d(handle, nx, ny, nz, type, workSize)
initialize_context()
ccall((:cufftGetSize3d, libcufft()), cufftResult,
(cufftHandle, Cint, Cint, Cint, cufftType, Ptr{Csize_t}),
handle, nx, ny, nz, type, workSize)
end
@checked function cufftGetSizeMany(handle, rank, n, inembed, istride, idist, onembed,
ostride, odist, type, batch, workArea)
initialize_context()
ccall((:cufftGetSizeMany, libcufft()), cufftResult,
(cufftHandle, Cint, Ptr{Cint}, Ptr{Cint}, Cint, Cint, Ptr{Cint}, Cint,
Cint, cufftType, Cint, Ptr{Csize_t}),
handle, rank, n, inembed, istride, idist, onembed, ostride, odist, type,
batch, workArea)
end
@checked function cufftGetSize(handle, workSize)
initialize_context()
ccall((:cufftGetSize, libcufft()), cufftResult,
(cufftHandle, Ptr{Csize_t}),
handle, workSize)
end
@checked function cufftSetWorkArea(plan, workArea)
initialize_context()
ccall((:cufftSetWorkArea, libcufft()), cufftResult,
(cufftHandle, CuPtr{Cvoid}),
plan, workArea)
end
@checked function cufftSetAutoAllocation(plan, autoAllocate)
initialize_context()
ccall((:cufftSetAutoAllocation, libcufft()), cufftResult,
(cufftHandle, Cint),
plan, autoAllocate)
end
@checked function cufftExecC2C(plan, idata, odata, direction)
initialize_context()
ccall((:cufftExecC2C, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftComplex}, CuPtr{cufftComplex}, Cint),
plan, idata, odata, direction)
end
@checked function cufftExecR2C(plan, idata, odata)
initialize_context()
ccall((:cufftExecR2C, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftReal}, CuPtr{cufftComplex}),
plan, idata, odata)
end
@checked function cufftExecC2R(plan, idata, odata)
initialize_context()
ccall((:cufftExecC2R, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftComplex}, CuPtr{cufftReal}),
plan, idata, odata)
end
@checked function cufftExecZ2Z(plan, idata, odata, direction)
initialize_context()
ccall((:cufftExecZ2Z, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftDoubleComplex}, CuPtr{cufftDoubleComplex},
Cint),
plan, idata, odata, direction)
end
@checked function cufftExecD2Z(plan, idata, odata)
initialize_context()
ccall((:cufftExecD2Z, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftDoubleReal}, CuPtr{cufftDoubleComplex}),
plan, idata, odata)
end
@checked function cufftExecZ2D(plan, idata, odata)
initialize_context()
ccall((:cufftExecZ2D, libcufft()), cufftResult,
(cufftHandle, CuPtr{cufftDoubleComplex}, CuPtr{cufftDoubleReal}),
plan, idata, odata)
end
@checked function cufftSetStream(plan, stream)
initialize_context()
ccall((:cufftSetStream, libcufft()), cufftResult,
(cufftHandle, CUstream),
plan, stream)
end
@checked function cufftDestroy(plan)
initialize_context()
ccall((:cufftDestroy, libcufft()), cufftResult,
(cufftHandle,),
plan)
end
@checked function cufftGetVersion(version)
ccall((:cufftGetVersion, libcufft()), cufftResult,
(Ptr{Cint},),
version)
end
@checked function cufftGetProperty(type, value)
ccall((:cufftGetProperty, libcufft()), cufftResult,
(libraryPropertyType, Ptr{Cint}),
type, value)
end