I am writing code which can compare between numpy.fft.fft2
and pycuda
but the results are not matching. Additionally pycuda
results are ambiguous every time.
data file : https://nofile.io/f/bjGRQGRVSCG/gauss.npy
from pyfft.cuda import Plan
import numpy as np
from pycuda.tools import make_default_context
import pycuda.gpuarray as gpuarray
import pycuda.driver as cuda
import time
import matplotlib.pyplot as plt
cuda.init()
context = make_default_context()
data = np.load('gauss.npy')
data_complex = data.astype(np.complex64)
start_time = time.time()
plan = Plan((32,32))
gpu_data = gpuarray.to_gpu(data_complex)
plan.execute(gpu_data)
result = gpu_data.get()
print("--- %s seconds (FFT calculation pycuda)---" % (time.time() - start_time))
start_time_3 = time.time()
result_np = np.fft.fft2(data)
#print(result_np)
print("--- %s seconds (FFT calculation numpy.fft.fft)---" % (time.time() - start_time))
context.pop()
#plt.plot(result)
#plt.plot(result_np)
I'm starting to wonder whether we can even perform 2D FFT with pycuda?