question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with consecutive 2D FFT runs on the same plan

See original GitHub issue

I have noticed a problem when CuPy 2D FFTs with the same plan are run consecutively. With certain shapes, they give different and incorrect results the second time. This seems to only happen when the longer dimension of the shape is odd, but I have not done an exhaustive scan. NumPy and SciPy FFT functions show the expected result, and the first run of CuPy always agrees with these. The second run is the problem. For now, I was able to work around by making sure the longer dimension was even, but I wanted to post this in case others were having the same issues.

  • Conditions (you can just paste the output of python -c 'import cupy; cupy.show_config()')
    • CuPy version: 8.6.0
    • OS/Platform: Windows 10
    • CUDA version: 11.2
  • Code to reproduce

import numpy as np import cupy as cp

shape = (151, 2229) a = np.random.randn(*shape)

A1 = np.fft.rfft2(a) A2 = np.fft.rfft2(a)

b = cp.asarray(a) B1 = cp.fft.rfft2(b) B2 = cp.fft.rfft2(b) if cp.any(B1 != B2): print(A1[0,0], A2[0,0], B1[0,0], B2[0,0], shape)

  • Error messages, stack traces, or logs

Output from the code above: (-84.42714344719724-2.5579538487363607e-13j) (-84.42714344719724-2.5579538487363607e-13j) (-84.42714344719798+0j) (17.20028862520553-3.1086244689504383e-15j) (151, 2229)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:27 (23 by maintainers)

github_iconTop GitHub Comments

2reactions
mnicelycommented, Apr 6, 2021

Okay, I see the issue! Looks like it’s been fixed in cuFFT 10.4.01.

@michaelmarty please install CTK 11.2

1reaction
michaelmartycommented, Apr 6, 2021

Correct, the original issue was CUDA 11.1. Upgrading to 11.2 fixed it. Thanks for tracking this down! Hopefully the fix should help others avoid going down this rabbit hole.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How the 2D FFT works - YouTube
This is part of an online course on foundations and applications of the Fourier transform. The course includes 4+ hours of video lectures, ......
Read more >
fft - Is there any practical application for performing a double ...
The FFT is applied twice on a random 32-sample signal, and flipped. As you can see, the error is small, using double precision...
Read more >
Memory Bandwidth Efficient Two-Dimensional Fast Fourier ...
In this paper, we develop high- performance FPGA implementations of the 2D-FFT for large problem sizes where the datasets must be held externally...
Read more >
Efficient 2D FFT implementation on mediaprocessors
We have developed an efficient implementation to compute the 2D fast Fourier transform (FFT) on a new very long instruction word programmable mediaprocessor ......
Read more >
Chapter 23: Parallelizing Two-dimensional FFTs
FFTs have the same length and properties (e.g., all real or complex), an appropriate sequential FFT algorithm may be applied to them one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found