GPU FFT2 Discrepancies ( Different from CPU based FFT2 )

3 Ansichten (letzte 30 Tage)
Kevin Blank
Kevin Blank am 22 Okt. 2013
Kommentiert: Kevin Blank am 22 Okt. 2013
Hello, I have noticed a problem that Matlab FFT2 does not produce the same result on a GPU array as it does on a "normal" array.
The following code was used to ensure that my observation is correct.
totalDiff = 0;
for loop = 0:10000
a = rand( [2 2] ); % Obtain random numbers
cpuResult = fft2(a); % Calculate on CPU
gpuResult = gather( fft2( gpuArray(a) ) ); % Calculate on GPU
diff = sum( gpuResult(:) - cpuResult(:) ); % Calculate difference
totalDiff = totalDiff + diff; % Get a running total of differences
end
totalDiff / 10000 %Output average change per matrix
I appreciate any feedback regarding this question: Why is this changing result being observed and can it be minimized or removed? While these values are not extremely different (differing by 1e-17 or so), I would still like to ensure an exact equality between my GPU and CPU code.
P.S. fft also has changing results based on the device used for computation; but, for my system, the matrix has to be larger than 4 x 4 to observe the difference.

Akzeptierte Antwort

Ben Tordoff
Ben Tordoff am 22 Okt. 2013
  1 Kommentar
Kevin Blank
Kevin Blank am 22 Okt. 2013
Thank you, that answer is perfect and I'm sorry my searching never discovered it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu GPU Computing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by