From f1cc85c793bb78d7b49aeb307271a90fd164b8a2 Mon Sep 17 00:00:00 2001 From: chenfeiyu Date: Wed, 17 Nov 2021 14:04:40 +0000 Subject: [PATCH] fix for cufft: some early versions of cufft do not define CUFFT_VERSION in the header --- 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 8e42a070a398e..e97af7cea7e08 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());