Skip to content

Commit

Permalink
added examples folder with example code for the CUFFT wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-k committed May 4, 2012
1 parent d176d0e commit d214ce7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/cufft_2d.jl
@@ -0,0 +1,27 @@
load("cumatrix.jl")

print("CUFFT version: $(cufftGetVersion())\n\n")

sx, sy = 16, 16
#sx, sy = 512, 512
#sx, sy = 1024, 1024

# create CUFFT plan
plan = cufftPlan2d(sx, sy, CUFFT_C2C)

# create data
h_data = ones(Complex64, sx, sy)
d_data = CuMatrix(h_data)
o_data = copy(d_data)
d_data_inv = copy(d_data)

# FFT
print("FFT:\n")
@time cufftExec(plan, d_data, o_data, CUFFT_FORWARD)
print(o_data)
println()

# IFFT
print("IFFT:\n")
@time cufftExec(plan, o_data, d_data_inv, CUFFT_INVERSE)
print(d_data_inv*float32(1.0/(sx*sy)))

0 comments on commit d214ce7

Please sign in to comment.