From d8191d06f7047684687b8821023201c3310d238a Mon Sep 17 00:00:00 2001 From: Feiyu Chan Date: Fri, 19 Nov 2021 17:26:06 +0800 Subject: [PATCH] fix for cufft: some early versions of cufft do not define CUFFT_VERSION in the header (#37312) --- paddle/fluid/operators/spectral_op.cu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/spectral_op.cu b/paddle/fluid/operators/spectral_op.cu index 8e42a070a39..e97af7cea7e 100644 --- a/paddle/fluid/operators/spectral_op.cu +++ b/paddle/fluid/operators/spectral_op.cu @@ -313,7 +313,12 @@ void exec_fft(const DeviceContext& ctx, const Tensor* X, Tensor* out, // create plan FFTConfigKey key = create_fft_configkey(collapsed_input, collapsed_output, signal_ndim); - if (CUFFT_VERSION < 10200) { + bool using_cache = false; +#if !defined(CUFFT_VERSION) || (CUFFT_VERSION < 10200) + using_cache = true; +#endif + + if (using_cache) { const int64_t device_id = static_cast( reinterpret_cast(&collapsed_input.place()) ->GetDeviceId()); -- GitLab