Issues with consecutive 2D FFT runs on the same plan
See original GitHub issueI 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:
- Created 2 years ago
- Comments:27 (23 by maintainers)
Top GitHub Comments
Okay, I see the issue! Looks like it’s been fixed in cuFFT 10.4.01.
@michaelmarty please install CTK 11.2
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.